diff --git a/inventory/__pycache__/urls.cpython-311.pyc b/inventory/__pycache__/urls.cpython-311.pyc index 264b9178..cfa14e6f 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 946e968a..83f8d4a4 100644 Binary files a/inventory/__pycache__/views.cpython-311.pyc and b/inventory/__pycache__/views.cpython-311.pyc differ diff --git a/inventory/urls.py b/inventory/urls.py index e1e894a6..b36ba066 100644 --- a/inventory/urls.py +++ b/inventory/urls.py @@ -94,9 +94,9 @@ urlpatterns = [ ), path("crm/leads//delete/", views.LeadDeleteView, name="lead_delete"), path("crm/leads//lead-convert/", views.lead_convert, name="lead_convert"), - path("crm/leads//add-note/", views.add_note_to_lead, name="add_note"), - path('crm/leads//update-note/', views.update_note, name='update_note'), - path("crm/leads//delete-note/", views.delete_note, name="delete_note"), + path("crm/leads//add-note/", views.add_note_to_lead, name="add_note_to_lead"), + path('crm/leads//update-note/', views.update_note, name='update_note_to_lead'), + path("crm/leads//delete-note/", views.delete_note, name="delete_note_to_lead"), path( "crm/leads//add-activity/", views.add_activity_to_lead, diff --git a/inventory/views.py b/inventory/views.py index 8eb572d1..b3782913 100644 --- a/inventory/views.py +++ b/inventory/views.py @@ -652,9 +652,7 @@ class CarInventory(LoginRequiredMixin, ListView): id_car_trim=trim_id, ).order_by("receiving_date") - if query: - cars = cars.filter(Q(vin__icontains=query)) - return cars + return apply_search_filters(cars, query) def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) @@ -1234,13 +1232,7 @@ class CustomerListView(LoginRequiredMixin, ListView): customers = dealer.entity.get_customers().filter(additional_info__type="customer") - if query: - customers = customers.filter( - Q(first_name__icontains=query) - | Q(last_name__icontains=query) - | Q(additional_info__info__icontains=query) - ) - return customers + return apply_search_filters(customers, query) def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) @@ -1287,7 +1279,7 @@ def add_note_to_customer(request, pk): return redirect("customer_detail", pk=pk) else: form = forms.NoteForm() - return render(request, "crm/add_note.html", {"form": form, "customer": customer}) + return render(request, "crm/note_form.html", {"form": form, "customer": customer}) def add_activity_to_customer(request, pk): @@ -1421,10 +1413,11 @@ class VendorListView(LoginRequiredMixin, ListView): ordering = ["-created"] def get_queryset(self): + query = self.request.GET.get("q") dealer = get_user_type(self.request) - # vendors = models.Vendor.objects.filter(dealer=dealer) - return dealer.entity.get_vendors().filter(active=True) - # return vendors + vendors = dealer.entity.get_vendors().filter(active=True) + return apply_search_filters(vendors, query) + # class VendorDetailView(LoginRequiredMixin, DetailView): @@ -1861,8 +1854,10 @@ class UserListView(LoginRequiredMixin, ListView): template_name = "users/user_list.html" def get_queryset(self): + query = self.request.GET.get("q") dealer = get_user_type(self.request) - return models.Staff.objects.filter(dealer=dealer).all() + staff = models.Staff.objects.filter(dealer=dealer).all() + return apply_search_filters(staff, query) class UserDetailView(LoginRequiredMixin, DetailView): @@ -1944,12 +1939,13 @@ class OrganizationListView(LoginRequiredMixin, ListView): paginate_by = 10 def get_queryset(self): + query = self.request.GET.get("q") dealer = get_user_type(self.request) - return ( - dealer.entity.get_customers() - .filter(additional_info__type="organization", active=True) - .all() - ) + organization = dealer.entity.get_customers().filter(additional_info__type="organization", active=True) + + return apply_search_filters(organization, query) + + class OrganizationDetailView(DetailView): @@ -2040,8 +2036,10 @@ class RepresentativeListView(LoginRequiredMixin, ListView): paginate_by = 10 def get_queryset(self): + query = self.request.GET.get("q") dealer = get_user_type(self.request) - return models.Representative.objects.filter(dealer=dealer).all() + representative = models.Representative.objects.filter(dealer=dealer) + return apply_search_filters(representative, query) class RepresentativeDetailView(DetailView): @@ -2266,8 +2264,10 @@ class BankAccountListView(LoginRequiredMixin, ListView): paginate_by = 10 def get_queryset(self): + query = self.request.GET.get("q") dealer = get_user_type(self.request) - return BankAccountModel.objects.filter(entity_model=dealer.entity) + bank_accounts = BankAccountModel.objects.filter(entity_model=dealer.entity) + return apply_search_filters(bank_accounts, query) class BankAccountCreateView(LoginRequiredMixin, SuccessMessageMixin, CreateView): @@ -2337,9 +2337,10 @@ class AccountListView(LoginRequiredMixin, ListView): paginate_by = 10 def get_queryset(self): + query = self.request.GET.get("q") dealer = get_user_type(self.request) - entity = dealer.entity - return entity.get_all_accounts() + accounts = dealer.entity.get_all_accounts() + return apply_search_filters(accounts, query) class AccountCreateView(LoginRequiredMixin, SuccessMessageMixin, CreateView): @@ -2436,7 +2437,7 @@ def sales_list_view(request): entity = dealer.entity transactions = ItemTransactionModel.objects.for_entity(entity_slug=entity.slug, user_model=dealer.user) - paginator = Paginator(transactions, 20) + paginator = Paginator(transactions, 10) page_number = request.GET.get('page') page_obj = paginator.get_page(page_number) txs = get_item_transactions(page_obj) @@ -2803,9 +2804,10 @@ class InvoiceListView(LoginRequiredMixin, ListView): paginate_by = 20 def get_queryset(self): + query = self.request.GET.get("q") dealer = get_user_type(self.request) - entity = dealer.entity - return entity.get_invoices() + invoices = dealer.entity.get_invoices() + return apply_search_filters(invoices, query) class InvoiceDetailView(LoginRequiredMixin, DetailView): @@ -4356,8 +4358,24 @@ class EmployeeCalendarView(ListView): context_object_name = 'appointments' def get_queryset(self): + query = self.request.GET.get('q') dealer = get_user_type(self.request) - staff = self.request.user.staff - return Appointment.objects.filter(appointment_request__staff_member=staff).all() + staff = getattr(self.request, 'staff', None) + if staff: + appointments = Appointment.objects.filter(appointment_request__staff_member=staff, ppointment_request__date__gt=timezone.now()) + appointments = Appointment.objects.filter(appointment_request__date__gt=timezone.now()) + return apply_search_filters(appointments, query) + +def apply_search_filters(queryset, query): + if not query: + return queryset + + search_filters = Q() + model = queryset.model + + for field in model._meta.get_fields(): + if hasattr(field, 'attname') and field.get_internal_type() in ["CharField", "TextField", "EmailField"]: + search_filters |= Q(**{f"{field.name}__icontains": query}) + return queryset.filter(search_filters).distinct() \ No newline at end of file diff --git a/static/images/car_make/Abarth_WQexAcP.png b/static/images/car_make/Abarth_WQexAcP.png new file mode 100644 index 00000000..4132df76 Binary files /dev/null and b/static/images/car_make/Abarth_WQexAcP.png differ diff --git a/static/images/car_make/Alfa-Romeo-2_jj41jXd.png b/static/images/car_make/Alfa-Romeo-2_jj41jXd.png new file mode 100644 index 00000000..9c019410 Binary files /dev/null and b/static/images/car_make/Alfa-Romeo-2_jj41jXd.png differ diff --git a/static/images/car_make/Aston-Martin_UVYOY98.png b/static/images/car_make/Aston-Martin_UVYOY98.png new file mode 100644 index 00000000..848387f5 Binary files /dev/null and b/static/images/car_make/Aston-Martin_UVYOY98.png differ diff --git a/static/images/car_make/Dodge.png b/static/images/car_make/Dodge.png new file mode 100644 index 00000000..0458a06c Binary files /dev/null and b/static/images/car_make/Dodge.png differ diff --git a/static/images/car_make/FAW.png b/static/images/car_make/FAW.png new file mode 100644 index 00000000..1b479d3f Binary files /dev/null and b/static/images/car_make/FAW.png differ diff --git a/static/images/car_make/Ford.png b/static/images/car_make/Ford.png new file mode 100644 index 00000000..f494aecd Binary files /dev/null and b/static/images/car_make/Ford.png differ diff --git a/static/images/car_make/Jeep.png b/static/images/car_make/Jeep.png new file mode 100644 index 00000000..2e4b247e Binary files /dev/null and b/static/images/car_make/Jeep.png differ diff --git a/static/images/car_make/KIA.png b/static/images/car_make/KIA.png new file mode 100644 index 00000000..00fb330e Binary files /dev/null and b/static/images/car_make/KIA.png differ diff --git a/static/images/car_make/KIA_RcrUDZf.png b/static/images/car_make/KIA_RcrUDZf.png new file mode 100644 index 00000000..93c32c7d Binary files /dev/null and b/static/images/car_make/KIA_RcrUDZf.png differ diff --git a/static/images/car_make/Maserati.png b/static/images/car_make/Maserati.png new file mode 100644 index 00000000..7cb2e6e3 Binary files /dev/null and b/static/images/car_make/Maserati.png differ diff --git a/static/images/car_make/Nissan.png b/static/images/car_make/Nissan.png new file mode 100644 index 00000000..0be14268 Binary files /dev/null and b/static/images/car_make/Nissan.png differ diff --git a/static/images/car_make/Peugeot.png b/static/images/car_make/Peugeot.png new file mode 100644 index 00000000..0702e75a Binary files /dev/null and b/static/images/car_make/Peugeot.png differ diff --git a/static/images/car_make/Toyota.png b/static/images/car_make/Toyota.png new file mode 100644 index 00000000..2220f0f0 Binary files /dev/null and b/static/images/car_make/Toyota.png differ diff --git a/templates/crm/employee_calendar.html b/templates/crm/employee_calendar.html index 614afadf..3153fee1 100644 --- a/templates/crm/employee_calendar.html +++ b/templates/crm/employee_calendar.html @@ -1,22 +1,38 @@ - -

Upcoming Test Drives

- +{% extends 'base.html' %} +{% load static %} +{% block content %} +
+
+
- - + + + + + + {% for appointment in appointments %} - - - - + + + + + + + + {% endfor %} -
CustomerVehicleDate/TimeServiceDateStart TimeEnd Time StaffStatus
{{ appointment.client.name }}{{ appointment.service.name }}{{ appointment.start_time|date:"M j, Y H:i" }}{{ appointment.staff.user.get_full_name }}{{ appointment.get_client_name }}{{ appointment.get_service }}{{ appointment.appointment_request.date|date:"Y-m-d" }}{{ appointment.appointment_request.start_time }}{{ appointment.appointment_request.end_time }}{{ appointment.get_staff_member_name }} + view +
\ No newline at end of file + + + +{% endblock %} \ No newline at end of file diff --git a/templates/crm/leads/lead_detail.html b/templates/crm/leads/lead_detail.html index 597c0575..e162e3ee 100644 --- a/templates/crm/leads/lead_detail.html +++ b/templates/crm/leads/lead_detail.html @@ -181,7 +181,7 @@

{{ _("Notes") }}

- "> + "> {% trans 'Add Note' %} @@ -197,7 +197,7 @@ - + {% for note in notes %} @@ -205,17 +205,17 @@ {% if note.created_by.staff %} {{ note.created_by.staff.name }} {% else %} - {{ note.created_by.dealer.get_local_name }} + {{ note.created_by.dealer.get_local_name|default:note.created_by.dealer.name }} {% endif %} {{ note.created }} {% if note.created_by == request.user %} - "> + ">
-
- +
{{lead.full_name}}

diff --git a/templates/crm/note_form.html b/templates/crm/note_form.html index 2539d25c..77f8b528 100644 --- a/templates/crm/note_form.html +++ b/templates/crm/note_form.html @@ -1,9 +1,9 @@ {% load i18n static crispy_forms_filters %} {% if form.instance.pk %} -
+ {% else %} - + {% endif %} {% csrf_token %} diff --git a/templates/customers/customer_list.html b/templates/customers/customer_list.html index 36c4b46c..e06d2fdf 100644 --- a/templates/customers/customer_list.html +++ b/templates/customers/customer_list.html @@ -6,7 +6,7 @@ {% block content %}
-

{{ _("Customers")|capfirst }}

+

{{ _("Customers")|capfirst }}

@@ -17,25 +17,15 @@
- + {% include 'partials/search_box.html' %}
{% if page_obj.object_list %} -
+
- +
@@ -104,11 +94,9 @@ {% endif %}
-
- {% if is_paginated %} + {% include 'partials/pagination.html' %} - {% endif %} -
+
{% include 'modal/delete_modal.html' %} diff --git a/templates/customers/view_customer.html b/templates/customers/view_customer.html index cc557b9d..be9d1bfd 100644 --- a/templates/customers/view_customer.html +++ b/templates/customers/view_customer.html @@ -106,7 +106,10 @@
-
- -
- -
    - -
    -
    + {% include 'partials/pagination.html' %}
    +{% include 'partials/notes.html' %}
    {% endblock %} \ No newline at end of file diff --git a/templates/header.html b/templates/header.html index cee137d7..e234b5b5 100644 --- a/templates/header.html +++ b/templates/header.html @@ -436,15 +436,17 @@ {% else %} {% endif %} + {% if user.dealer %} + {% endif %} diff --git a/templates/inventory/car_list_view.html b/templates/inventory/car_list_view.html index 2b1051f3..92b7bca9 100644 --- a/templates/inventory/car_list_view.html +++ b/templates/inventory/car_list_view.html @@ -38,20 +38,20 @@ - +
    Loading...
    -
    @@ -94,8 +94,6 @@
    -
    -
    @@ -164,17 +162,13 @@
    -
    -
    -
    -
    + {% include 'partials/pagination.html' %} +
    - {% if is_paginated %} - {% include 'partials/pagination.html' %} - {% endif %} + + +
    diff --git a/templates/items/service/service_create.html b/templates/items/service/service_create.html index a7883526..53835e8b 100644 --- a/templates/items/service/service_create.html +++ b/templates/items/service/service_create.html @@ -7,7 +7,7 @@
    -
    +
    {% if service.pk %} {{ _("Update Service") }} @@ -19,7 +19,7 @@
    {% csrf_token %} {{ form|crispy }} - +
    diff --git a/templates/items/service/service_list.html b/templates/items/service/service_list.html index 0634ad41..b42e0521 100644 --- a/templates/items/service/service_list.html +++ b/templates/items/service/service_list.html @@ -4,16 +4,16 @@ {% block title %}{{ _("Expenses") }}{% endblock title %} {% block content %} -
    -
    - -

    {% trans "Services" %}

    - {% trans "Add Service" %} +
    +
    + +

    {% trans "Services" %}

    + {% trans "Add Service" %}
    -
    + -
    - +
    +
    @@ -56,5 +56,4 @@
    - {% endblock %} \ No newline at end of file diff --git a/templates/partials/search_box.html b/templates/partials/search_box.html new file mode 100644 index 00000000..cea634fd --- /dev/null +++ b/templates/partials/search_box.html @@ -0,0 +1,15 @@ + + diff --git a/templates/sales/sales_list.html b/templates/sales/sales_list.html index 551d500b..3db0d4cf 100644 --- a/templates/sales/sales_list.html +++ b/templates/sales/sales_list.html @@ -52,24 +52,7 @@ /> - - - - - - - - - - - - - - - - - - + @@ -109,24 +92,16 @@ hx-on::before-request="filter_before_request()" hx-on::after-request="filter_after_request()">Search - +
    -
    -
    -
    +
    +
    - {% if page_obj.has_previous %} - - {% endif %} -
      Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
    - {% if page_obj.has_next %} - - {% endif %}
    -
    -
    {% trans "Item Number" %}
    + +
    {% for tx in txs %} - - - - - + - - - - -
    @@ -147,29 +122,29 @@
    +

    {{tx.customer.customer_name}}

    +

    {{tx.customer.address_1}}

    +

    {{tx.customer.phone}}

    {{tx.info.make}} + {{tx.info.make}}

    {{tx.info.model}}

    +

    {{tx.info.vin}}

    +

    {{tx.info.trim}}

    +

    {{tx.finance.total}}

    + {% if tx.has_estimate %}

    @@ -187,7 +162,7 @@

    {% endif %}
    + {% if tx.has_invoice %}

    @@ -235,18 +210,15 @@ {% endfor %}

    - -
    -
    - {% if is_paginated %} - {% include 'partials/pagination.html' %} - {% endif %} -
    - +
    + + + +
    -
    + {% endblock %} {% block customJS %}