update
This commit is contained in:
parent
18dd7829d9
commit
d94c5adef7
Binary file not shown.
26
haikalbot/migrations/0001_initial.py
Normal file
26
haikalbot/migrations/0001_initial.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Generated by Django 5.1.7 on 2025-04-28 12:45
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('inventory', '0006_alter_email_object_id_alter_notes_object_id'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='ChatLog',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('user_message', models.TextField()),
|
||||||
|
('chatbot_response', models.TextField()),
|
||||||
|
('timestamp', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('dealer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='chatlogs', to='inventory.dealer')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -157,7 +157,7 @@ def elm(vin):
|
|||||||
if response.get("data"):
|
if response.get("data"):
|
||||||
data = {
|
data = {
|
||||||
"maker": response["data"]["maker"],
|
"maker": response["data"]["maker"],
|
||||||
"model": response["data"]["model"],
|
"model": response["data"]["model"] if response["data"]["model"] else " ",
|
||||||
"modelYear": response["data"]["modelYear"],
|
"modelYear": response["data"]["modelYear"],
|
||||||
}
|
}
|
||||||
print(data)
|
print(data)
|
||||||
|
|||||||
@ -284,7 +284,7 @@ def dealer_signup(request, *args, **kwargs):
|
|||||||
address = wf3.get("address")
|
address = wf3.get("address")
|
||||||
|
|
||||||
if password != password_confirm:
|
if password != password_confirm:
|
||||||
return JsonResponse({"error": "Passwords do not match."}, status=400)
|
return JsonResponse({"error": _("Passwords do not match")}, status=400)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
@ -673,7 +673,7 @@ class AjaxHandlerView(LoginRequiredMixin, View):
|
|||||||
|
|
||||||
if not vin_no or len(vin_no.strip()) != 17:
|
if not vin_no or len(vin_no.strip()) != 17:
|
||||||
return JsonResponse(
|
return JsonResponse(
|
||||||
{"success": False, "error": "Invalid VIN number provided."}, status=400
|
{"success": False, "error": _("Invalid VIN number provided")}, status=400
|
||||||
)
|
)
|
||||||
|
|
||||||
vin_no = vin_no.strip()
|
vin_no = vin_no.strip()
|
||||||
@ -683,7 +683,7 @@ class AjaxHandlerView(LoginRequiredMixin, View):
|
|||||||
# manufacturer_name = model_name = year_model = None
|
# manufacturer_name = model_name = year_model = None
|
||||||
if not (result := decodevin(vin_no)):
|
if not (result := decodevin(vin_no)):
|
||||||
return JsonResponse(
|
return JsonResponse(
|
||||||
{"success": False, "error": "VIN not found in all sources."}, status=404
|
{"success": False, "error": _("VIN not found in all sources")}, status=404
|
||||||
)
|
)
|
||||||
|
|
||||||
manufacturer_name, model_name, year_model = result.values()
|
manufacturer_name, model_name, year_model = result.values()
|
||||||
@ -696,7 +696,7 @@ class AjaxHandlerView(LoginRequiredMixin, View):
|
|||||||
|
|
||||||
if not car_make:
|
if not car_make:
|
||||||
return JsonResponse(
|
return JsonResponse(
|
||||||
{"success": False, "error": "Manufacturer not found in the database."},
|
{"success": False, "error": _("Manufacturer not found in the database")},
|
||||||
status=404,
|
status=404,
|
||||||
)
|
)
|
||||||
vin_data["make_id"] = car_make.id_car_make
|
vin_data["make_id"] = car_make.id_car_make
|
||||||
@ -736,7 +736,7 @@ class AjaxHandlerView(LoginRequiredMixin, View):
|
|||||||
"id_car_serie", "name", "arabic_name", "generation_name"
|
"id_car_serie", "name", "arabic_name", "generation_name"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return JsonResponse({"error": "Server error occurred"}, status=500)
|
return JsonResponse({"error": _("Server error occurred")}, status=500)
|
||||||
return JsonResponse(list(series), safe=False)
|
return JsonResponse(list(series), safe=False)
|
||||||
|
|
||||||
def get_trims(self, request):
|
def get_trims(self, request):
|
||||||
@ -846,7 +846,7 @@ class SearchCodeView(LoginRequiredMixin, View):
|
|||||||
image_file = request.FILES.get("image")
|
image_file = request.FILES.get("image")
|
||||||
|
|
||||||
if not image_file:
|
if not image_file:
|
||||||
return JsonResponse({"success": False, "error": "No image provided"})
|
return JsonResponse({"success": False, "error": _("No image provided")})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
np_arr = np.frombuffer(image_file.read(), np.uint8)
|
np_arr = np.frombuffer(image_file.read(), np.uint8)
|
||||||
@ -858,7 +858,7 @@ class SearchCodeView(LoginRequiredMixin, View):
|
|||||||
decoded_objects = decode(gray)
|
decoded_objects = decode(gray)
|
||||||
|
|
||||||
if not decoded_objects:
|
if not decoded_objects:
|
||||||
return JsonResponse({"success": False, "error": "No QR/Barcode detected"})
|
return JsonResponse({"success": False, "error": _("No QR/Barcode detected")})
|
||||||
|
|
||||||
code = decoded_objects[0].data.decode("utf-8").strip()
|
code = decoded_objects[0].data.decode("utf-8").strip()
|
||||||
car = get_object_or_404(models.Car, vin=code)
|
car = get_object_or_404(models.Car, vin=code)
|
||||||
@ -1275,7 +1275,7 @@ class CarFinanceUpdateView(
|
|||||||
model = models.CarFinance
|
model = models.CarFinance
|
||||||
form_class = forms.CarFinanceForm
|
form_class = forms.CarFinanceForm
|
||||||
template_name = "inventory/car_finance_form.html"
|
template_name = "inventory/car_finance_form.html"
|
||||||
success_message = _("Car finance details updated successfully.")
|
success_message = _("Car finance details updated successfully")
|
||||||
permission_required = ["inventory.change_carfinance"]
|
permission_required = ["inventory.change_carfinance"]
|
||||||
|
|
||||||
def get_success_url(self):
|
def get_success_url(self):
|
||||||
@ -1327,7 +1327,7 @@ class CarUpdateView(
|
|||||||
model = models.Car
|
model = models.Car
|
||||||
form_class = forms.CarUpdateForm
|
form_class = forms.CarUpdateForm
|
||||||
template_name = "inventory/car_edit.html"
|
template_name = "inventory/car_edit.html"
|
||||||
success_message = _("Car updated successfully.")
|
success_message = _("Car updated successfully")
|
||||||
permission_required = ["inventory.change_car"]
|
permission_required = ["inventory.change_car"]
|
||||||
|
|
||||||
def get_success_url(self):
|
def get_success_url(self):
|
||||||
@ -2050,7 +2050,7 @@ def CustomerCreateView(request):
|
|||||||
.filter(email=form.cleaned_data["email"])
|
.filter(email=form.cleaned_data["email"])
|
||||||
.exists()
|
.exists()
|
||||||
):
|
):
|
||||||
messages.error(request, _("Customer with this email already exists."))
|
messages.error(request, _("Customer with this email already exists"))
|
||||||
else:
|
else:
|
||||||
customer_name = (
|
customer_name = (
|
||||||
f"{form.cleaned_data['first_name']} "
|
f"{form.cleaned_data['first_name']} "
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user