filters in the agency portal

This commit is contained in:
Faheed 2025-11-24 13:28:10 +03:00
parent 7366d07e49
commit fe5fd7424d
4 changed files with 21 additions and 19 deletions

View File

@ -799,10 +799,6 @@ def _task_send_individual_email(subject, body_message, recipient, attachments,se
logger.error(f"Email sent to {recipient}, but failed to store in DB: {str(e)}") logger.error(f"Email sent to {recipient}, but failed to store in DB: {str(e)}")
else:
logger.error("failed to send email")
except Exception as e: except Exception as e:
logger.error(f"Failed to send email to {recipient}: {str(e)}", exc_info=True) logger.error(f"Failed to send email to {recipient}: {str(e)}", exc_info=True)

View File

@ -3316,7 +3316,8 @@ def agency_detail(request, slug):
).count() ).count()
hired_candidates = candidates.filter(stage="Hired").count() hired_candidates = candidates.filter(stage="Hired").count()
rejected_candidates = candidates.filter(stage="Rejected").count() rejected_candidates = candidates.filter(stage="Rejected").count()
job_assignments=AgencyJobAssignment.objects.filter(agency=agency)
print(job_assignments)
context = { context = {
"agency": agency, "agency": agency,
"candidates": candidates[:10], # Show recent 10 candidates "candidates": candidates[:10], # Show recent 10 candidates
@ -3327,6 +3328,7 @@ def agency_detail(request, slug):
"generated_password": agency.generated_password "generated_password": agency.generated_password
if agency.generated_password if agency.generated_password
else None, else None,
"job_assignments":job_assignments
} }
return render(request, "recruitment/agency_detail.html", context) return render(request, "recruitment/agency_detail.html", context)
@ -4169,13 +4171,13 @@ def agency_portal_persons_list(request):
| Q(last_name__icontains=search_query) | Q(last_name__icontains=search_query)
| Q(email__icontains=search_query) | Q(email__icontains=search_query)
| Q(phone__icontains=search_query) | Q(phone__icontains=search_query)
| Q(job__title__icontains=search_query)
) )
# Filter by stage if provided # Filter by stage if provided
stage_filter = request.GET.get("stage", "") # stage_filter = request.GET.get("stage", "")
if stage_filter: # if stage_filter:
persons = persons.filter(stage=stage_filter) # persons = persons.filter(stage=stage_filter)
# Pagination # Pagination
paginator = Paginator(persons, 20) # Show 20 persons per page paginator = Paginator(persons, 20) # Show 20 persons per page
@ -4184,6 +4186,7 @@ def agency_portal_persons_list(request):
# Get stage choices for filter dropdown # Get stage choices for filter dropdown
stage_choices = Application.Stage.choices stage_choices = Application.Stage.choices
print(stage_choices)
person_form = PersonForm() person_form = PersonForm()
person_form.initial["agency"] = agency person_form.initial["agency"] = agency
@ -4191,7 +4194,7 @@ def agency_portal_persons_list(request):
"agency": agency, "agency": agency,
"page_obj": page_obj, "page_obj": page_obj,
"search_query": search_query, "search_query": search_query,
"stage_filter": stage_filter, # "stage_filter": stage_filter,
"stage_choices": stage_choices, "stage_choices": stage_choices,
"total_persons": persons.count(), "total_persons": persons.count(),
"person_form": person_form, "person_form": person_form,

View File

@ -604,19 +604,22 @@
from your Django view context to populate this section. from your Django view context to populate this section.
{% endcomment %} {% endcomment %}
{% if assigned_jobs %} {% if job_assignments %}
{% for assignment in assigned_jobs %} {% for assignment in job_assignments%}
<div class="job-item"> <div class="job-item">
<div class="d-flex justify-content-between align-items-center"> <div class="d-flex justify-content-between align-items-center">
<div> <div>
<div class="job-title"> <div class="job-title">
<a href="{% url 'job_details' assignment.job.slug %}" class="text-decoration-none text-primary-theme"> <a href="{% url 'job_detail' assignment.job.slug %}" class="text-decoration-none text-primary-theme">
{{ assignment.job.title }} {{ assignment.job.title }}
</a> </a>
</div> </div>
<div class="job-details"> <div class="job-details">
<i class="fas fa-map-pin me-1"></i> {{ assignment.job.location }} <i class="fas fa-map-pin me-1"></i> {{ assignment.job.get_location_display }}
<span class="ms-3"><i class="fas fa-user-tie me-1"></i> {{ assignment.job.department.name }}</span> {% if assessment.job.department %}
<span class="ms-3"><i class="fas fa-user-tie me-1"></i> {{ assignment.job.department|default:"" }}</span>
{% endif %}
</div> </div>
</div> </div>
<div class="text-end"> <div class="text-end">

View File

@ -93,7 +93,7 @@
value="{{ search_query }}" value="{{ search_query }}"
placeholder="{% trans 'Search by name, email, phone, or job title...' %}"> placeholder="{% trans 'Search by name, email, phone, or job title...' %}">
</div> </div>
<div class="col-md-3"> {% comment %} <div class="col-md-3">
<label for="stage" class="form-label fw-semibold"> <label for="stage" class="form-label fw-semibold">
<i class="fas fa-filter me-1"></i>{% trans "Stage" %} <i class="fas fa-filter me-1"></i>{% trans "Stage" %}
</label> </label>
@ -111,7 +111,7 @@
<button type="submit" class="btn btn-main-action w-100"> <button type="submit" class="btn btn-main-action w-100">
<i class="fas fa-search me-1"></i> {% trans "Search" %} <i class="fas fa-search me-1"></i> {% trans "Search" %}
</button> </button>
</div> </div> {% endcomment %}
</div> </div>
</form> </form>
</div> </div>
@ -154,7 +154,7 @@
<th scope="col">{% trans "Name" %}</th> <th scope="col">{% trans "Name" %}</th>
<th scope="col">{% trans "Email" %}</th> <th scope="col">{% trans "Email" %}</th>
<th scope="col">{% trans "Phone" %}</th> <th scope="col">{% trans "Phone" %}</th>
<th scope="col">{% trans "Job" %}</th> <th scope="col">{% trans "Created At" %}</th>
{% comment %} <th scope="col">{% trans "Stage" %}</th> {% comment %} <th scope="col">{% trans "Stage" %}</th>
<th scope="col">{% trans "Applied Date" %}</th> {% endcomment %} <th scope="col">{% trans "Applied Date" %}</th> {% endcomment %}
<th scope="col" class="text-center">{% trans "Actions" %}</th> <th scope="col" class="text-center">{% trans "Actions" %}</th>
@ -202,7 +202,7 @@
</span> </span>
{% endwith %} {% endwith %}
</td> {% endcomment %} </td> {% endcomment %}
<td>{{ person.created_at|date:"Y-m-d" }}</td> <td>{{ person.created_at|date:"d-m-Y" }}</td>
<td class="text-center"> <td class="text-center">
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<button type="button" data-bs-toggle="modal" data-bs-target="#updateModal" <button type="button" data-bs-toggle="modal" data-bs-target="#updateModal"