diff --git a/car_inventory/__pycache__/settings.cpython-311.pyc b/car_inventory/__pycache__/settings.cpython-311.pyc index d02b6ee9..85e59d4f 100644 Binary files a/car_inventory/__pycache__/settings.cpython-311.pyc and b/car_inventory/__pycache__/settings.cpython-311.pyc differ diff --git a/inventory/__pycache__/urls.cpython-311.pyc b/inventory/__pycache__/urls.cpython-311.pyc index 1cee5da4..fb809f08 100644 Binary files a/inventory/__pycache__/urls.cpython-311.pyc and b/inventory/__pycache__/urls.cpython-311.pyc differ diff --git a/inventory/__pycache__/views.cpython-311.pyc b/inventory/__pycache__/views.cpython-311.pyc index b8d18c66..5e9e0822 100644 Binary files a/inventory/__pycache__/views.cpython-311.pyc and b/inventory/__pycache__/views.cpython-311.pyc differ diff --git a/inventory/views.py b/inventory/views.py index 1402e7e3..3a926300 100644 --- a/inventory/views.py +++ b/inventory/views.py @@ -1285,8 +1285,12 @@ class CustomerDetailView(LoginRequiredMixin, DetailView): # context["estimates"] = entity.get_estimates().filter( # customer__customer_name=name # ) - context["estimates"] = entity.get_estimates().filter(customer=self.object) - context["invoices"] = entity.get_invoices().filter(customer=self.object) + estimates = entity.get_estimates().filter(customer=self.object) + invoices = entity.get_invoices().filter(customer=self.object) + total = estimates.count() + invoices.count() + context["estimates"] = estimates + context["invoices"] = invoices + context["total"] = total # context["notes"] = models.Notes.objects.filter( @@ -1298,8 +1302,8 @@ class CustomerDetailView(LoginRequiredMixin, DetailView): return context -def add_note_to_customer(request, pk): - customer = get_object_or_404(CustomerModel, pk=pk) +def add_note_to_customer(request, customer_id): + customer = get_object_or_404(CustomerModel, pk=customer_id) if request.method == "POST": form = forms.NoteForm(request.POST) if form.is_valid(): @@ -1308,10 +1312,10 @@ def add_note_to_customer(request, pk): note.created_by = request.user note.save() - return redirect("customer_detail", pk=pk) + return redirect("customer_detail", pk=customer.pk) else: form = forms.NoteForm() - return render(request, "crm/note_form.html", {"form": form, "customer": customer}) + return render(request, "customers/note_form.html", {"form": form, "customer": customer}) def add_activity_to_customer(request, pk): diff --git a/templates/customers/view_customer.html b/templates/customers/view_customer.html index 17341925..cb3ad776 100644 --- a/templates/customers/view_customer.html +++ b/templates/customers/view_customer.html @@ -4,40 +4,9 @@ {% block title %}{{ _("View Customer") }}{% endblock title %} {% block content %} - -
- +{% include 'modal/delete_modal.html' %}{{invoices.count}}
@@ -133,7 +105,7 @@