diff --git a/core/__pycache__/forms.cpython-311.pyc b/core/__pycache__/forms.cpython-311.pyc index b9f3e54..82e7cc0 100644 Binary files a/core/__pycache__/forms.cpython-311.pyc and b/core/__pycache__/forms.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index fddd747..aadbeb1 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 be364c3..0d02fbb 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 b575ed7..d48204e 100644 --- a/core/forms.py +++ b/core/forms.py @@ -115,4 +115,13 @@ class BidForm(forms.ModelForm): # 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.") \ No newline at end of file + self.fields['truck'].help_text = _("You must have an approved truck to place a bid.") + +class ShipperOfferForm(forms.Form): + description = forms.CharField(label=_('Goods Description'), widget=forms.Textarea(attrs={'class': 'form-control', 'rows': 3})) + weight = forms.CharField(label=_('Weight/Volume'), widget=forms.TextInput(attrs={'class': 'form-control'})) + origin = forms.CharField(label=_('Origin'), widget=forms.TextInput(attrs={'class': 'form-control'})) + destination = forms.CharField(label=_('Destination'), widget=forms.TextInput(attrs={'class': 'form-control'})) + delivery_date = forms.DateField(label=_('Requested Delivery Date'), widget=forms.DateInput(attrs={'class': 'form-control', 'type': 'date'})) + amount = forms.DecimalField(label=_('Offer Amount'), max_digits=10, decimal_places=2, widget=forms.NumberInput(attrs={'class': 'form-control', 'step': '0.01'})) + comments = forms.CharField(label=_('Comments'), required=False, widget=forms.Textarea(attrs={'class': 'form-control', 'rows': 2})) diff --git a/core/templates/core/marketplace.html b/core/templates/core/marketplace.html index d3c8358..359a453 100644 --- a/core/templates/core/marketplace.html +++ b/core/templates/core/marketplace.html @@ -1,39 +1,50 @@ {% extends "base.html" %} {% load i18n %} +{% load static %} {% block content %}
{% trans "Browse available trucks and send your shipping offers directly to truck owners." %}
+{{ shipment.description|truncatechars:100 }}
-+ {% trans "Owner" %}: {{ truck.owner.username }} +
+ + {% trans "Send Shipping Offer" %} +{% trans "No shipments available at the moment." %}
+{% trans "No approved trucks are currently available." %}
+{{ shipment.description }}
+{{ shipment.description }}
| {% trans "Truck Owner" %} | {% trans "Truck" %} | {% trans "Amount" %} | +{% trans "Status" %} | {% trans "Action" %} | |||
|---|---|---|---|---|---|---|---|
| {{ bid.truck_owner.username }} | -{{ bid.truck.display_truck_type }} | +{{ bid.truck.display_truck_type }} ({{ bid.truck.plate_no }}) | ${{ bid.amount }} | - {% trans "Accept" %} + + {{ bid.get_status_display }} + + | ++ {% if bid.status == 'PENDING' and user == bid.truck_owner %} + + {% else %} + {% trans "No action available" %} + {% endif %} | ||
| {% trans "No bids received yet." %} | +{% trans "No offers for this shipment." %} | ||||||
| {% trans "Description" %} | -{% trans "Route" %} | -{% trans "Delivery Date" %} | -{% trans "Status" %} | -{% trans "Bids" %} | -{% trans "Action" %} | -
|---|---|---|---|---|---|
| {{ shipment.description|truncatechars:30 }} | -{{ shipment.origin }} {{ shipment.destination }} | -{{ shipment.delivery_date }} | -- - {{ shipment.get_status_display }} - - | -{{ shipment.bids.count }} | -- {% trans "View Details" %} - | -
| {% trans "No shipments posted yet." %} | -|||||
| {% trans "Truck" %} | +{% trans "Route" %} | +{% trans "Amount" %} | +{% trans "Date Sent" %} | +{% trans "Status" %} | +{% trans "Action" %} | +
|---|---|---|---|---|---|
|
+ {{ bid.truck.display_truck_type }}
+ {{ bid.truck.plate_no }}
+ |
+ + {{ bid.shipment.origin }} + + {{ bid.shipment.destination }} + | +${{ bid.amount }} | +{{ bid.created_at|date:"d M Y" }} | ++ {% if bid.status == 'PENDING' %} + {% trans "Pending" %} + {% elif bid.status == 'ACCEPTED' %} + {% trans "Accepted" %} + {% else %} + {% trans "Rejected" %} + {% endif %} + | ++ {% trans "Details" %} + | +
|
+
+ {% trans "You haven't sent any offers yet." %} + {% trans "Find a Truck" %} + |
+ |||||
| {% trans "Description" %} | +{% trans "Route" %} | +{% trans "Delivery Date" %} | +{% trans "Status" %} | +{% trans "Assigned Truck" %} | +{% trans "Action" %} | +
|---|---|---|---|---|---|
| {{ shipment.description|truncatechars:30 }} | +{{ shipment.origin }} {{ shipment.destination }} | +{{ shipment.delivery_date }} | ++ + {{ shipment.get_status_display }} + + | ++ {% if shipment.assigned_truck %} + {{ shipment.assigned_truck.plate_no }} + {% else %} + {% trans "None" %} + {% endif %} + | ++ {% trans "Track" %} + | +
| {% trans "No active shipments." %} | +|||||
{% trans "Manage your fleet and active bids." %}
+{% trans "Manage your fleet and incoming shipping offers." %}
{% trans "Plate No:" %} {{ truck.plate_no }}
-{% trans "Model:" %} {{ truck.display_model }} ({{ truck.year }})
-{% trans "Capacity:" %} {{ truck.display_load_capacity }}
- {% if truck.registration_expiry_date %} -{% trans "Expiry Date:" %} {{ truck.registration_expiry_date }}
- {% endif %} - - {% trans "Edit Details" %} - -| {% trans "Route" %} | +{% trans "Truck" %} | +{% trans "Shipper" %} | +{% trans "Offer Amount" %} | +{% trans "Status" %} | +{% trans "Action" %} | +
|---|---|---|---|---|---|
|
+ {{ bid.shipment.origin }} {{ bid.shipment.destination }}
+ {{ bid.shipment.delivery_date }}
+ |
+ {{ bid.truck.plate_no }} | +{{ bid.shipment.shipper.username }} | +${{ bid.amount }} | ++ {% if bid.status == 'PENDING' %} + {% trans "Pending" %} + {% elif bid.status == 'ACCEPTED' %} + {% trans "Accepted" %} + {% else %} + {% trans "Rejected" %} + {% endif %} + | ++ {% if bid.status == 'PENDING' %} + + {% else %} + {% trans "View Details" %} + {% endif %} + | +
|
+
+ {% trans "No offers received yet." %} + |
+ |||||
{% trans "No approved trucks yet." %}
-{% trans "Plate No:" %} {{ truck.plate_no }}
-{% trans "Submitted on:" %} {{ truck.created_at|date }}
- - {% trans "Edit Details" %} +{% trans "Plate No:" %} {{ truck.plate_no }}
+{% trans "Capacity:" %} {{ truck.display_load_capacity }}
+ + {% trans "Edit Truck" %}{% trans "Plate No:" %} {{ truck.plate_no }}
+{% trans "Waiting for admin approval..." %}
| {% trans "Shipment" %} | -{% trans "Amount" %} | -{% trans "Status" %} | -{% trans "Date" %} | -
|---|---|---|---|
| {{ bid.shipment.origin }} - {{ bid.shipment.destination }} | -${{ bid.amount }} | -- - {{ bid.get_status_display }} - - | -{{ bid.created_at|date }} | -
| {% trans "No bids placed yet." %} | -|||