This commit is contained in:
ismail 2025-05-12 19:15:15 +03:00
parent 842322e963
commit cca37be3b3
5 changed files with 184 additions and 13 deletions

View File

@ -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(

View File

@ -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
)

View File

@ -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;
}
});
});
});

View File

@ -0,0 +1,143 @@
{% extends 'base.html' %}
{% load static i18n %}
{% block customCSS %}
<style>
.card {
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
border: none;
}
.card-header {
background-color: #f0f2f5;
font-weight: 600;
}
.table thead {
background-color: #f9fafb;
}
.empty-state {
text-align: center;
padding: 50px;
color: #aaa;
}
</style>
{% endblock customCSS %}
{% block content %}
<div class="container-fluid">
<!-- Welcome Row -->
<div class="d-flex justify-content-between align-items-center mb-3">
<h5 class="mb-0">مرحبًا ismail mosa</h5>
<div>
<button class="btn btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown">الصفحة الرئيسية لـ ismail mosa</button>
</div>
</div>
<!-- Main Row -->
<div class="row">
<!-- Tasks -->
<div class="col-md-6 mb-4">
<div class="card h-100">
<div class="card-header">المهام المفتوحة الخاصة بي</div>
<div class="card-body p-0">
<table class="table table-hover align-middle mb-0">
<thead>
<tr>
<th>الموضوع</th>
<th>تاريخ الاستحقاق</th>
<th>الحالة</th>
<th>الأولوية</th>
<th>مرتبط بـ</th>
<th>اسم جهة الاتصال</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="#">Register for upcoming CRM Webinars</a></td>
<td>16/02/2025</td>
<td>Not Started</td>
<td>Low</td>
<td>King (Sample)</td>
<td>Kris Marrier (Sample)</td>
</tr>
<tr>
<td><a href="#">Refer CRM Videos</a></td>
<td>18/02/2025</td>
<td>In Progress</td>
<td>Normal</td>
<td>Morlong Associates</td>
<td>Mitsue Tollner (Sample)</td>
</tr>
<!-- Add more rows as needed -->
</tbody>
</table>
</div>
</div>
</div>
<!-- Meetings -->
<div class="col-md-6 mb-4">
<div class="card h-100">
<div class="card-header d-flex justify-content-between align-items-center">
<span>الاجتماعات الخاصة بي</span>
<span class="spinner-border spinner-border-sm text-muted" role="status" aria-hidden="true"></span>
</div>
<div class="card-body p-0">
<table class="table table-hover align-middle mb-0">
<thead>
<tr>
<th>العنوان</th>
<th>المرسل</th>
<th>إلى</th>
<th>اسم جهة الاتصال</th>
<th>مرتبط بـ</th>
</tr>
</thead>
<tbody>
<tr>
<td>Demo</td>
<td>03:12 16/02/2025</td>
<td>04:12 16/02/2025</td>
<td>Donette Foller (Sample)</td>
<td>Printing Dimensions</td>
</tr>
<tr>
<td>Webinar</td>
<td>03:12 16/02/2025</td>
<td>04:12 16/02/2025</td>
<td>Leota Dilliard (Sample)</td>
<td>Commercial Press</td>
</tr>
<!-- Add more rows as needed -->
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Bottom Row -->
<div class="row">
<!-- Today's Leads -->
<div class="col-md-6 mb-4">
<div class="card h-100">
<div class="card-header">العملاء المحتملون لليوم</div>
<div class="card-body empty-state">
<img src="https://cdn-icons-png.flaticon.com/512/1828/1828945.png" width="64" alt="No Data">
<p class="mt-3">لم يتم العثور على أي العملاء المحتملون.</p>
</div>
</div>
</div>
<!-- Deals Closed This Month -->
<div class="col-md-6 mb-4">
<div class="card h-100">
<div class="card-header">تم إقفال صفقات هذا الشهر</div>
<div class="card-body empty-state">
<img src="https://cdn-icons-png.flaticon.com/512/1828/1828945.png" width="64" alt="No Data">
<p class="mt-3">لم يتم العثور على أي صفقات.</p>
</div>
</div>
</div>
</div>
</div>
{% endblock content %}

View File

@ -299,7 +299,7 @@
<button class="btn btn-phoenix-primary px-6">Add Activity</button>
</div>
</div>
{% for activity in opportunity.lead.get_activities %}
{% for activity in activities %}
<div class="border-bottom border-translucent py-4">
<div class="d-flex">
<div class="d-flex bg-primary-subtle rounded-circle flex-center me-3 bg-primary-subtle" style="width:25px; height:25px">