changes20

This commit is contained in:
Flatlogic Bot 2026-01-23 15:58:41 +00:00
parent 3da5d477df
commit 066a111def
6 changed files with 1332 additions and 589 deletions

View File

@ -58,7 +58,7 @@ class UserRegistrationForm(UserCreationForm):
return cleaned_data
class OTPVerifyForm(forms.Form):
otp_code = forms.CharField(max_length=6, widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': '123456'}))
otp_code = forms.CharField(label=_("OTP Code"), max_length=6, widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': '123456'}))
class TruckForm(forms.ModelForm):
class Meta:
@ -144,4 +144,4 @@ class ShipperOfferForm(forms.Form):
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}))
comments = forms.CharField(label=_('Comments'), required=False, widget=forms.Textarea(attrs={'class': 'form-control', 'rows': 2}))

View File

@ -36,7 +36,7 @@ def register(request):
# Send OTP
full_phone = f"{registration_data['country_code']}{registration_data['phone_number']}"
otp = OTPCode.generate_code(full_phone)
msg = f"Your verification code for MASAR CARGO is: {otp.code}"
msg = _("Your verification code for MASAR CARGO is: %(code)s") % {"code": otp.code}
if send_whatsapp_message(full_phone, msg):
messages.info(request, _("A verification code has been sent to your WhatsApp."))
return redirect('verify_otp_registration')
@ -104,7 +104,7 @@ def custom_login(request):
# Send OTP
full_phone = profile.full_phone_number
otp = OTPCode.generate_code(full_phone)
msg = f"Your login verification code for MASAR CARGO is: {otp.code}"
msg = _("Your login verification code for MASAR CARGO is: %(code)s") % {"code": otp.code}
if send_whatsapp_message(full_phone, msg):
messages.info(request, _("A verification code has been sent to your WhatsApp."))
return redirect('verify_otp_login')
@ -236,7 +236,7 @@ def approve_truck(request, truck_id):
owner_phone = getattr(truck.owner.profile, 'full_phone_number', None)
if owner_phone:
msg = f"Your truck ({truck.plate_no}) has been approved! You can now receive offers for shipments."
msg = _("Your truck (%(plate)s) has been approved! You can now receive offers for shipments.") % {"plate": truck.plate_no}
send_whatsapp_message(owner_phone, msg)
messages.success(request, _("Truck approved successfully!"))
@ -318,7 +318,7 @@ def place_bid(request, truck_id):
# Notify Truck Owner via WhatsApp
owner_phone = getattr(truck.owner.profile, 'full_phone_number', None)
if owner_phone:
msg = f"New offer received for your truck ({truck.plate_no})! Route: {shipment.display_origin} to {shipment.display_destination}. Amount: {bid.amount}"
msg = _("New offer received for your truck (%(plate)s)! Route: %(origin)s to %(dest)s. Amount: %(amount)s") % {"plate": truck.plate_no, "origin": shipment.display_origin, "dest": shipment.display_destination, "amount": bid.amount}
send_whatsapp_message(owner_phone, msg)
messages.success(request, _("Offer sent successfully!"))
@ -361,7 +361,7 @@ def accept_bid(request, bid_id):
# Notify Shipper via WhatsApp
shipper_phone = getattr(bid.shipment.shipper.profile, 'full_phone_number', None)
if shipper_phone:
msg = f"Your offer for truck {bid.truck.plate_no} ({bid.shipment.display_origin} to {bid.shipment.display_destination}) has been accepted!"
msg = _("Your offer for truck %(plate)s (%(origin)s to %(dest)s) has been accepted!") % {"plate": bid.truck.plate_no, "origin": bid.shipment.display_origin, "dest": bid.shipment.display_destination}
send_whatsapp_message(shipper_phone, msg)
messages.success(request, _("Offer accepted! Shipment is now in progress."))

Binary file not shown.

File diff suppressed because it is too large Load Diff