diff --git a/core/__pycache__/forms.cpython-311.pyc b/core/__pycache__/forms.cpython-311.pyc index 5638d92..d73f1af 100644 Binary files a/core/__pycache__/forms.cpython-311.pyc and b/core/__pycache__/forms.cpython-311.pyc differ diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index 6eff269..cab1269 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index 244821d..6f3a076 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 60cc7da..5089a78 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/forms.py b/core/forms.py index 5970473..f03e4b7 100644 --- a/core/forms.py +++ b/core/forms.py @@ -77,4 +77,7 @@ class BidForm(forms.ModelForm): user = kwargs.pop('user', None) super().__init__(*args, **kwargs) if user: - self.fields['truck'].queryset = Truck.objects.filter(owner=user) \ No newline at end of file + # Only allow bidding with approved trucks + self.fields['truck'].queryset = Truck.objects.filter(owner=user, is_approved=True) + if not self.fields['truck'].queryset.exists(): + self.fields['truck'].help_text = _("You must have an approved truck to place a bid.") diff --git a/core/migrations/0003_truck_is_approved.py b/core/migrations/0003_truck_is_approved.py new file mode 100644 index 0000000..c9ad86f --- /dev/null +++ b/core/migrations/0003_truck_is_approved.py @@ -0,0 +1,18 @@ +# Generated by Django 5.2.7 on 2026-01-23 10:20 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0002_shipment_message_truck_shipment_assigned_truck_bid'), + ] + + operations = [ + migrations.AddField( + model_name='truck', + name='is_approved', + field=models.BooleanField(default=False, verbose_name='Is Approved'), + ), + ] diff --git a/core/migrations/__pycache__/0003_truck_is_approved.cpython-311.pyc b/core/migrations/__pycache__/0003_truck_is_approved.cpython-311.pyc new file mode 100644 index 0000000..0e0325d Binary files /dev/null and b/core/migrations/__pycache__/0003_truck_is_approved.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index de81f2d..f1f1ddc 100644 --- a/core/models.py +++ b/core/models.py @@ -32,6 +32,7 @@ class Truck(models.Model): registration_back = models.ImageField(_('Registration Back'), upload_to='docs/', blank=True, null=True) driver_license = models.ImageField(_('Driver License'), upload_to='docs/', blank=True, null=True) + is_approved = models.BooleanField(_('Is Approved'), default=False) created_at = models.DateTimeField(auto_now_add=True) def __str__(self): @@ -96,4 +97,4 @@ def save_user_profile(sender, instance, **kwargs): if hasattr(instance, 'profile'): instance.profile.save() else: - Profile.objects.create(user=instance) + Profile.objects.create(user=instance) \ No newline at end of file diff --git a/core/templates/core/admin_dashboard.html b/core/templates/core/admin_dashboard.html index dd8715d..0b50a02 100644 --- a/core/templates/core/admin_dashboard.html +++ b/core/templates/core/admin_dashboard.html @@ -17,7 +17,7 @@ -
| {% trans "Owner" %} | +{% trans "Truck Details" %} | +{% trans "Plate No" %} | +{% trans "Documents" %} | +{% trans "Actions" %} | +
|---|---|---|---|---|
| {{ truck.owner.username }} {{ truck.owner.email }} |
+
+ {{ truck.truck_type }} + {{ truck.model }} ({{ truck.year }}) - {{ truck.color }} + |
+ {{ truck.plate_no }} | +
+
+ {% if truck.truck_picture %}
+ {% trans "Photo" %}
+ {% endif %}
+ {% if truck.registration_front %}
+ {% trans "Reg. Front" %}
+ {% endif %}
+ {% if truck.registration_back %}
+ {% trans "Reg. Back" %}
+ {% endif %}
+
+ |
+ + + {% trans "Approve" %} + + | +
| {% trans "No trucks awaiting approval." %} | +||||
{% trans "Manage your fleet and active bids." %}
+{% trans "No trucks registered." %}
+{% trans "Plate No:" %} {{ truck.plate_no }}
+{% trans "Model:" %} {{ truck.model }} ({{ truck.year }})
+{% trans "Capacity:" %} {{ truck.load_capacity }}
+{% trans "No approved trucks yet." %}
+{% trans "Plate No:" %} {{ truck.plate_no }}
+{% trans "Submitted on:" %} {{ truck.created_at|date }}
+| {% trans "Shipment" %} | {% trans "Amount" %} | {% trans "Status" %} | +{% trans "Date" %} | |||
|---|---|---|---|---|---|---|
| {{ bid.shipment.origin }} - {{ bid.shipment.destination }} | -{{ bid.amount }} | +${{ bid.amount }} | - + {{ bid.get_status_display }} | +{{ bid.created_at|date }} | ||
| {% trans "No bids placed." %} | +{% trans "No bids placed yet." %} | |||||