From cca37be3b34bbf101801de4f14e1cc11662f9de1 Mon Sep 17 00:00:00 2001 From: ismail <=> Date: Mon, 12 May 2025 19:15:15 +0300 Subject: [PATCH] update --- inventory/urls.py | 1 + inventory/views.py | 4 +- templates/crm/leads/lead_list.html | 47 ++++-- templates/crm/leads/lead_view.html | 143 ++++++++++++++++++ .../crm/opportunities/opportunity_detail.html | 2 +- 5 files changed, 184 insertions(+), 13 deletions(-) create mode 100644 templates/crm/leads/lead_view.html diff --git a/inventory/urls.py b/inventory/urls.py index 4d0a7a85..110dc778 100644 --- a/inventory/urls.py +++ b/inventory/urls.py @@ -101,6 +101,7 @@ urlpatterns = [ ), path('update-lead-actions/', views.update_lead_actions, name='update_lead_actions'), path('crm/leads/lead_tracking/', views.lead_tracking, name='lead_tracking'), + path('crm/leads/lead_view/', views.lead_view, name='lead_view'), path("crm/leads/", views.LeadListView.as_view(), name="lead_list"), path( diff --git a/inventory/views.py b/inventory/views.py index a56acefb..16940292 100644 --- a/inventory/views.py +++ b/inventory/views.py @@ -4503,6 +4503,8 @@ class UserActivityLogListView(LoginRequiredMixin, ListView): queryset = queryset.filter(user__email=self.request.GET["user"]) return queryset[:100] # will update later with better pagination +def lead_view(request): + return render(request, "crm/leads/lead_view.html") # CRM RELATED VIEWS class LeadListView(LoginRequiredMixin, PermissionRequiredMixin, ListView): @@ -5255,7 +5257,7 @@ class OpportunityDetailView(LoginRequiredMixin, DetailView): context["status_form"] = form context["notes"] = models.Notes.objects.filter( content_type__model="opportunity", object_id=self.object.id - ) + ).order_by("-created") context["activities"] = models.Activity.objects.filter( content_type__model="opportunity", object_id=self.object.id ) diff --git a/templates/crm/leads/lead_list.html b/templates/crm/leads/lead_list.html index 93d880d1..c6429153 100644 --- a/templates/crm/leads/lead_list.html +++ b/templates/crm/leads/lead_list.html @@ -408,11 +408,17 @@ // Show loading indicator Swal.fire({ - title: 'Updating Actions', + toast: true, + icon: 'info', text: 'Please wait...', allowOutsideClick: false, - didOpen: () => { - Swal.showLoading(); + position: "top-end", + showConfirmButton: false, + timer: 2000, + timerProgressBar: false, + didOpen: (toast) => { + toast.onmouseenter = Swal.stopTimer; + toast.onmouseleave = Swal.resumeTimer; } }); @@ -429,22 +435,34 @@ if (data.success) { // Success notification Swal.fire({ + toast: true, icon: 'success', - title: 'Success!', + position: "top-end", text: data.message || 'Actions updated successfully', - confirmButtonText: 'OK', - timer: 3000, - timerProgressBar: true + showConfirmButton: false, + timer: 2000, + timerProgressBar: false, + didOpen: (toast) => { + toast.onmouseenter = Swal.stopTimer; + toast.onmouseleave = Swal.resumeTimer; + } }).then(() => { location.reload(); // Refresh after user clicks OK }); } else { // Error notification Swal.fire({ + toast: true, icon: 'error', - title: 'Error', + position: "top-end", text: data.message || 'Failed to update actions', - confirmButtonText: 'OK' + showConfirmButton: false, + timer: 2000, + timerProgressBar: false, + didOpen: (toast) => { + toast.onmouseenter = Swal.stopTimer; + toast.onmouseleave = Swal.resumeTimer; + } }); } }) @@ -452,10 +470,17 @@ Swal.close(); console.error('Error:', error); Swal.fire({ + toast: true, icon: 'error', - title: 'Error', + position: "top-end", text: 'An unexpected error occurred', - confirmButtonText: 'OK' + showConfirmButton: false, + timer: 2000, + timerProgressBar: false, + didOpen: (toast) => { + toast.onmouseenter = Swal.stopTimer; + toast.onmouseleave = Swal.resumeTimer; + } }); }); }); diff --git a/templates/crm/leads/lead_view.html b/templates/crm/leads/lead_view.html new file mode 100644 index 00000000..8c4dabbf --- /dev/null +++ b/templates/crm/leads/lead_view.html @@ -0,0 +1,143 @@ +{% extends 'base.html' %} +{% load static i18n %} + +{% block customCSS %} + + {% endblock customCSS %} + + {% block content %} +
| الموضوع | +تاريخ الاستحقاق | +الحالة | +الأولوية | +مرتبط بـ | +اسم جهة الاتصال | +
|---|---|---|---|---|---|
| Register for upcoming CRM Webinars | +16/02/2025 | +Not Started | +Low | +King (Sample) | +Kris Marrier (Sample) | +
| Refer CRM Videos | +18/02/2025 | +In Progress | +Normal | +Morlong Associates | +Mitsue Tollner (Sample) | +
| العنوان | +المرسل | +إلى | +اسم جهة الاتصال | +مرتبط بـ | +
|---|---|---|---|---|
| Demo | +03:12 16/02/2025 | +04:12 16/02/2025 | +Donette Foller (Sample) | +Printing Dimensions | +
| Webinar | +03:12 16/02/2025 | +04:12 16/02/2025 | +Leota Dilliard (Sample) | +Commercial Press | +
لم يتم العثور على أي العملاء المحتملون.
+لم يتم العثور على أي صفقات.
+