diff --git a/inventory/models.py b/inventory/models.py index 0cddfef4..9e43c3c1 100644 --- a/inventory/models.py +++ b/inventory/models.py @@ -589,10 +589,11 @@ class AdditionalServices(models.Model, LocalizedNameMixin): verbose_name_plural = _("Additional Services") def __str__(self): - return self.name + " - " + str(self.price) + return self.name + " - " + str(self.price_) class Car(Base): + item_model = models.OneToOneField( ItemModel, models.DO_NOTHING, diff --git a/inventory/views.py b/inventory/views.py index 65a5b8ca..9d733272 100644 --- a/inventory/views.py +++ b/inventory/views.py @@ -2266,6 +2266,49 @@ class CustomerListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): return context +# class CustomerDetailView(LoginRequiredMixin, PermissionRequiredMixin, DetailView): +# """ +# CustomerDetailView handles retrieving and presenting detailed information about +# a specific customer. It ensures that the user is authenticated and has the +# necessary permissions before accessing the customer's details. This view +# provides context data including estimates and invoices related to the customer. + +# :ivar model: The model associated with the view. +# :type model: CustomerModel +# :ivar template_name: The path to the template used for rendering the view. +# :type template_name: str +# :ivar context_object_name: The name of the variable in the template context +# for the object being viewed. +# :type context_object_name: str +# :ivar permission_required: The list of permissions required to access this view. +# :type permission_required: list[str] +# """ + +# model = models.Customer +# template_name = "customers/view_customer.html" +# context_object_name = "customer" +# permission_required = ["inventory.view_customer"] + +# def get_context_data(self, **kwargs): +# dealer = get_user_type(self.request) +# entity = dealer.entity +# context = super().get_context_data(**kwargs) + +# context["notes"] = models.Notes.objects.filter( +# dealer=dealer, +# content_type__model="customer", object_id=self.object.id +# ) +# estimates = entity.get_estimates().filter(customer=self.object.customer_model) +# invoices = entity.get_invoices().filter(customer=self.object.customer_model) + +# total = estimates.count() + invoices.count() + +# context["estimates"] = estimates +# context["invoices"] = invoices +# context["total"] = total +# context["note_form"] = forms.NoteForm() +# return context + class CustomerDetailView(LoginRequiredMixin, PermissionRequiredMixin, DetailView): """ CustomerDetailView handles retrieving and presenting detailed information about @@ -2300,6 +2343,8 @@ class CustomerDetailView(LoginRequiredMixin, PermissionRequiredMixin, DetailView ) estimates = entity.get_estimates().filter(customer=self.object.customer_model) invoices = entity.get_invoices().filter(customer=self.object.customer_model) + context['leads']=self.object.customer_leads.all() + total = estimates.count() + invoices.count() @@ -4830,7 +4875,7 @@ def create_sale_order(request, dealer_slug, pk): estimate.save() for item in estimate.get_itemtxs_data()[0].all(): try: - item.item_model.additional_info["car_info"]["status"] = "sold" + # item.item_model.additional_info["car_info"]["status"] = "sold" item.item_model.save() logger.debug( f"Car status updated to 'sold' for item.item_model PK: {getattr(item.item_model, 'pk', 'N/A')}." @@ -7180,8 +7225,8 @@ class ItemServiceCreateView( dealer = get_user_type(self.request) vat = models.VatRate.objects.get(dealer=dealer, is_active=True) form.instance.dealer = dealer - if form.instance.taxable: - form.instance.price = (form.instance.price * vat.rate) + form.instance.price + # if form.instance.taxable: + # form.instance.price = (form.instance.price * vat.rate) + form.instance.price return super().form_valid(form) def get_success_url(self): @@ -7229,8 +7274,8 @@ class ItemServiceUpdateView( dealer = get_user_type(self.request) vat = models.VatRate.objects.get(dealer=dealer, is_active=True) form.instance.dealer = dealer - if form.instance.taxable: - form.instance.price = (form.instance.price * vat.rate) + form.instance.price + # if form.instance.taxable: + # form.instance.price = (form.instance.price * vat.rate) + form.instance.price return super().form_valid(form) def get_success_url(self): diff --git a/locale/ar/LC_MESSAGES/django.po b/locale/ar/LC_MESSAGES/django.po index 8bff4a73..a0951ff0 100644 --- a/locale/ar/LC_MESSAGES/django.po +++ b/locale/ar/LC_MESSAGES/django.po @@ -31,10 +31,7 @@ msgstr "" #: templates/inventory/transfer_details.html:89 #: templates/sales/estimates/estimate_detail.html:234 #: templates/sales/estimates/sale_order_form.html:123 -#: templates/sales/estimates/sale_order_preview.html:203 -#: templates/sales/invoices/invoice_detail.html:328 -#: templates/sales/orders/order_details.html:201 -#: templates/sales/orders/order_details.html:503 +#: templates/sales/estimates/sale_or ils.html:503 msgid "VIN" msgstr "رقم الهيكل" diff --git a/static/images/logos/no-content-new.jpg b/static/images/logos/no-content-new.jpg new file mode 100644 index 00000000..e71780d9 Binary files /dev/null and b/static/images/logos/no-content-new.jpg differ diff --git a/static/user-logo.png b/static/user-logo1.png similarity index 100% rename from static/user-logo.png rename to static/user-logo1.png diff --git a/templates/base.html b/templates/base.html index 03e3a73c..91c22188 100644 --- a/templates/base.html +++ b/templates/base.html @@ -66,6 +66,7 @@ rel="stylesheet" id="user-style-default"> {% endif %} + diff --git a/templates/crm/leads/lead_detail.html b/templates/crm/leads/lead_detail.html index bb7283d3..ff4654d3 100644 --- a/templates/crm/leads/lead_detail.html +++ b/templates/crm/leads/lead_detail.html @@ -37,17 +37,9 @@ {% include "crm/leads/partials/update_action.html" %}
-

{{ _("Lead Details") }}

-
-
-
-
- -
-
+

{{ _("Lead Details") }}

+
@@ -55,12 +47,7 @@
-
-

{{ _("Lead Details") }}

- -
+
@@ -807,21 +794,13 @@
-
+
-

-
- +
@@ -968,20 +947,17 @@ } // Close modal after successful form submission - /*document.body.addEventListener('htmx:afterSwap', function(evt) { + document.body.addEventListener('htmx:afterSwap', function(evt) { if (evt.detail.target.id === 'main_content') { - document.querySelectorAll('.modal').forEach(function(modal) { - var modal = bootstrap.Modal.getInstance(); - if (modal) { - modal.hide(); - } - }); - } + var modal = bootstrap.Modal.getInstance(document.getElementById('exampleModal')); + if (modal) { + modal.hide(); + } + } }); - */ // Cleanup modal backdrop if needed -/* document.body.addEventListener('htmx:beforeSwap', function(evt) { + document.body.addEventListener('htmx:beforeSwap', function(evt) { if (evt.detail.target.id === 'main_content') { var backdrops = document.querySelectorAll('.modal-backdrop'); backdrops.forEach(function(backdrop) { diff --git a/templates/crm/leads/lead_list.html b/templates/crm/leads/lead_list.html index 3dd7069c..e61a1a66 100644 --- a/templates/crm/leads/lead_list.html +++ b/templates/crm/leads/lead_list.html @@ -1,9 +1,11 @@ + {% extends 'base.html' %} {% load i18n static humanize %} {% block title %} {{ _("Leads") |capfirst }} {% endblock title %} {% block content %} +{% if page_obj.object_list %}

{{ _("Leads") |capfirst }} @@ -11,6 +13,7 @@

{% comment %} {% include "crm/leads/partials/update_action.html" %} {% endcomment %} +
@@ -26,6 +29,7 @@
{% include 'partials/search_box.html' %}
+
{% if page_obj.object_list %} @@ -201,26 +205,7 @@
- {% comment %} - {% if lead.opportunity.stage == "prospect" %} - {{ lead.opportunity.stage|upper }} - {% elif lead.opportunity.stage == "proposal" %} - {{ lead.opportunity.stage|upper }} - {% elif lead.opportunity.stage == "negotiation" %} - {{ lead.opportunity.stage|upper }} - {% elif lead.opportunity.stage == "closed_won" %} - {{ lead.opportunity.stage|upper }} - {% elif lead.opportunity.stage == "closed_lost" %} - {{ lead.opportunity.stage|upper }} - {% endif %} - {% endcomment %} - {% comment %} - {% if lead.opportunity %} - - Opportunity {{ lead.opportunity.lead}} - - {% endif %} - {% endcomment %} + {% if user == lead.staff.user or request.is_dealer %}
@@ -268,14 +253,15 @@
{% include 'partials/pagination.html' %}
{% endif %} - {% else %} - - {% trans "No Lead Yet" %} - - {% endif %} + + {% endif %}
+{% else %} +{% url 'lead_create' request.dealer.slug as create_lead_url %} +{% include "empty-illustration-page.html" with value="lead" url=create_lead_url %} +{% endif %} {% endblock %} {% block customJS %} {% endblock customJS %} + + diff --git a/templates/crm/leads/lead_tracking.html b/templates/crm/leads/lead_tracking.html index 55367f33..54d62cf9 100644 --- a/templates/crm/leads/lead_tracking.html +++ b/templates/crm/leads/lead_tracking.html @@ -168,6 +168,11 @@ {% endfor %}
+ {% if not new and not follow_up and not negotiation %} + {% url 'lead_create' request.dealer.slug as create_lead_url %} + {% include "empty-illustration-page.html" with value="lead" url=create_lead_url %} + {% endif %} +
diff --git a/templates/crm/opportunities/opportunity_list.html b/templates/crm/opportunities/opportunity_list.html index a6224eed..5991dbec 100644 --- a/templates/crm/opportunities/opportunity_list.html +++ b/templates/crm/opportunities/opportunity_list.html @@ -5,6 +5,7 @@ {{ _("Opportunities") }} {% endblock title %} {% block content %} + {% if opportunities %}

@@ -87,6 +88,7 @@ {% endif %}

+
{% include 'crm/opportunities/partials/opportunity_grid.html' %} @@ -96,6 +98,10 @@
{% include 'partials/pagination.html' %}
{% endif %} +{% else %} +{% url 'opportunity_create' request.dealer.slug as create_opportunity_url %} +{% include "empty-illustration-page.html" with value="opportunity" url=create_opportunity_url %} +{% endif %} {% block customJS %}