table for job list

This commit is contained in:
Faheed 2025-10-13 17:10:43 +03:00
commit c532ca97b6
16 changed files with 736 additions and 152 deletions

View File

@ -234,12 +234,12 @@ class JobPostingForm(forms.ModelForm):
'value': 'United States'
}),
'salary_range': forms.TextInput(attrs={
'class': 'form-control',
'placeholder': '$60,000 - $80,000'
}),
# Application Information
# 'application_url': forms.URLInput(attrs={
@ -255,7 +255,7 @@ class JobPostingForm(forms.ModelForm):
'class': 'form-control',
'type': 'date'
}),
'open_positions': forms.NumberInput(attrs={
'class': 'form-control',
'min': 1,
@ -483,4 +483,12 @@ class JobPostingStatusForm(forms.ModelForm):
class FormTemplateIsActiveForm(forms.ModelForm):
class Meta:
model = FormTemplate
fields = ['is_active']
fields = ['is_active']
class CandidateExamDateForm(forms.ModelForm):
class Meta:
model = Candidate
fields = ['exam_date']
widgets = {
'exam_date': forms.DateTimeInput(attrs={'type': 'datetime-local', 'class': 'form-control'}),
}

View File

@ -0,0 +1,23 @@
# Generated by Django 5.2.6 on 2025-10-12 12:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recruitment', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='candidate',
name='is_potential_candidate',
field=models.BooleanField(default=False, verbose_name='Potential Candidate'),
),
migrations.AlterField(
model_name='jobposting',
name='status',
field=models.CharField(choices=[('DRAFT', 'Draft'), ('ACTIVE', 'Active'), ('CLOSED', 'Closed'), ('CANCELLED', 'Cancelled'), ('ARCHIVED', 'Archived')], default='DRAFT', max_length=20),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 5.2.6 on 2025-10-12 15:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recruitment', '0002_candidate_is_potential_candidate_and_more'),
]
operations = [
migrations.AlterField(
model_name='candidate',
name='exam_date',
field=models.DateTimeField(blank=True, null=True, verbose_name='Exam Date'),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 5.2.6 on 2025-10-12 15:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recruitment', '0003_alter_candidate_exam_date'),
]
operations = [
migrations.AlterField(
model_name='candidate',
name='interview_date',
field=models.DateTimeField(blank=True, null=True, verbose_name='Interview Date'),
),
]

View File

@ -295,6 +295,9 @@ class Candidate(Base):
is_resume_parsed = models.BooleanField(
default=False, verbose_name=_("Resume Parsed")
)
is_potential_candidate = models.BooleanField(
default=False, verbose_name=_("Potential Candidate")
)
parsed_summary = models.TextField(blank=True, verbose_name=_("Parsed Summary"))
applied = models.BooleanField(default=False, verbose_name=_("Applied"))
stage = models.CharField(
@ -311,7 +314,7 @@ class Candidate(Base):
blank=True,
verbose_name=_("Applicant Status"),
)
exam_date = models.DateField(null=True, blank=True, verbose_name=_("Exam Date"))
exam_date = models.DateTimeField(null=True, blank=True, verbose_name=_("Exam Date"))
exam_status = models.CharField(
choices=ExamStatus.choices,
max_length=100,
@ -319,7 +322,7 @@ class Candidate(Base):
blank=True,
verbose_name=_("Exam Status"),
)
interview_date = models.DateField(
interview_date = models.DateTimeField(
null=True, blank=True, verbose_name=_("Interview Date")
)
interview_status = models.CharField(

View File

@ -65,8 +65,15 @@ urlpatterns = [
path('forms/builder/<int:template_id>/', views.form_builder, name='form_builder'),
path('forms/', views.form_templates_list, name='form_templates_list'),
path('forms/create-template/', views.create_form_template, name='create_form_template'),
path('jobs/<slug:slug>/candidate-tiers/', views.candidate_tier_management_view, name='candidate_tier_management'),
path('jobs/<slug:slug>/candidate_exam_view/', views.candidate_exam_view, name='candidate_exam_view'),
path('jobs/<slug:slug>/update_candidate_exam_status/', views.update_candidate_exam_status, name='update_candidate_exam_status'),
path('jobs/<slug:slug>/bulk_update_candidate_exam_status/', views.bulk_update_candidate_exam_status, name='bulk_update_candidate_exam_status'),
path('htmx/<int:pk>/candidate_criteria_view/', views.candidate_criteria_view_htmx, name='candidate_criteria_view_htmx'),
path('htmx/<slug:slug>/candidate_set_exam_date/', views.candidate_set_exam_date, name='candidate_set_exam_date'),
path('htmx/bulk_candidate_move_to_exam/', views.bulk_candidate_move_to_exam, name='bulk_candidate_move_to_exam'),
# path('forms/form/<int:template_id>/submit/', views.submit_form, name='submit_form'),
# path('forms/form/<int:template_id>/', views.form_wizard_view, name='form_wizard'),

View File

@ -12,6 +12,7 @@ from django.urls import reverse
from django.conf import settings
from django.utils import timezone
from .forms import (
CandidateExamDateForm,
ZoomMeetingForm,
JobPostingForm,
FormTemplateForm,
@ -216,7 +217,7 @@ def create_job(request):
job.created_by = request.POST.get("created_by", "").strip()
if not job.created_by:
job.created_by = "University Administrator"
job.save()
job_apply_url_relative=reverse('job_detail_candidate',kwargs={'slug':job.slug})
job_apply_url_absolute=request.build_absolute_uri(job_apply_url_relative)
@ -273,7 +274,7 @@ def edit_job(request, slug):
def job_detail(request, slug):
"""View details of a specific job"""
job = get_object_or_404(JobPosting, slug=slug)
# Get all candidates for this job, ordered by most recent
applicants = job.candidates.all().order_by("-created_at")
@ -291,22 +292,22 @@ def job_detail(request, slug):
# 2. Check for POST request (Status Update Submission)
if request.method == 'POST':
status_form = JobPostingStatusForm(request.POST, instance=job)
if status_form.is_valid():
status_form.save()
# Add a success message
messages.success(request, f"Status for '{job.title}' updated to '{job.get_status_display()}' successfully!")
return redirect('job_detail', slug=slug)
else:
messages.error(request, "Failed to update status due to validation errors.")
context = {
"job": job,
@ -327,15 +328,15 @@ def job_image_upload(request, slug):
image_upload_form=JobPostingImageForm(request.POST,request.FILES)
if image_upload_form.is_valid():
image_upload_form = image_upload_form.save(commit=False)
image_upload_form.job = job
image_upload_form.save()
messages.success(request, f"Image uploaded successfully for {job.title}.")
return redirect('job_detail', slug=job.slug)
else:
messages.error(request, "Image upload failed: Please ensure a valid image file was selected.")
return redirect('job_detail', slug=job.slug)
return redirect('job_detail', slug=job.slug)
@ -1240,102 +1241,102 @@ def candidate_tier_management_view(request, slug):
job = get_object_or_404(JobPosting, slug=slug)
# Get all candidates for this job, ordered by match score (descending)
candidates = job.candidates.all().order_by("-match_score")
candidates = job.candidates.filter(stage="Applied").order_by("-match_score")
# Get tier categorization parameters
tier1_count = int(request.GET.get("tier1_count", 100))
# tier1_count = int(request.GET.get("tier1_count", 100))
# Categorize candidates into tiers
tier1_candidates = candidates[:tier1_count] if tier1_count > 0 else []
remaining_candidates = candidates[tier1_count:] if tier1_count > 0 else []
# # Categorize candidates into tiers
# tier1_candidates = candidates[:tier1_count] if tier1_count > 0 else []
# remaining_candidates = candidates[tier1_count:] if tier1_count > 0 else []
if len(remaining_candidates) > 0:
# Tier 2: Next 50% of remaining candidates
tier2_count = max(1, len(remaining_candidates) // 2)
tier2_candidates = remaining_candidates[:tier2_count]
tier3_candidates = remaining_candidates[tier2_count:]
else:
tier2_candidates = []
tier3_candidates = []
# if len(remaining_candidates) > 0:
# # Tier 2: Next 50% of remaining candidates
# tier2_count = max(1, len(remaining_candidates) // 2)
# tier2_candidates = remaining_candidates[:tier2_count]
# tier3_candidates = remaining_candidates[tier2_count:]
# else:
# tier2_candidates = []
# tier3_candidates = []
# Handle form submissions
if request.method == "POST":
# Update tier categorization
if "update_tiers" in request.POST:
tier1_count = int(request.POST.get("tier1_count", 100))
messages.success(request, f"Tier categorization updated. Tier 1: {tier1_count} candidates")
return redirect("candidate_tier_management", slug=slug)
# # Handle form submissions
# if request.method == "POST":
# # Update tier categorization
# if "update_tiers" in request.POST:
# tier1_count = int(request.POST.get("tier1_count", 100))
# messages.success(request, f"Tier categorization updated. Tier 1: {tier1_count} candidates")
# return redirect("candidate_tier_management", slug=slug)
# Update individual candidate stages
elif "update_stage" in request.POST:
candidate_id = request.POST.get("candidate_id")
new_stage = request.POST.get("new_stage")
candidate = get_object_or_404(Candidate, id=candidate_id, job=job)
# # Update individual candidate stages
# elif "update_stage" in request.POST:
# candidate_id = request.POST.get("candidate_id")
# new_stage = request.POST.get("new_stage")
# candidate = get_object_or_404(Candidate, id=candidate_id, job=job)
if candidate.can_transition_to(new_stage):
old_stage = candidate.stage
candidate.stage = new_stage
candidate.save()
messages.success(request, f"Updated {candidate.name} from {old_stage} to {new_stage}")
else:
messages.error(request, f"Cannot transition {candidate.name} from {candidate.stage} to {new_stage}")
# if candidate.can_transition_to(new_stage):
# old_stage = candidate.stage
# candidate.stage = new_stage
# candidate.save()
# messages.success(request, f"Updated {candidate.name} from {old_stage} to {new_stage}")
# else:
# messages.error(request, f"Cannot transition {candidate.name} from {candidate.stage} to {new_stage}")
# Update exam status
elif "update_exam_status" in request.POST:
candidate_id = request.POST.get("candidate_id")
exam_status = request.POST.get("exam_status")
exam_date = request.POST.get("exam_date")
candidate = get_object_or_404(Candidate, id=candidate_id, job=job)
# # Update exam status
# elif "update_exam_status" in request.POST:
# candidate_id = request.POST.get("candidate_id")
# exam_status = request.POST.get("exam_status")
# exam_date = request.POST.get("exam_date")
# candidate = get_object_or_404(Candidate, id=candidate_id, job=job)
if candidate.stage == "Exam":
candidate.exam_status = exam_status
if exam_date:
candidate.exam_date = exam_date
candidate.save()
messages.success(request, f"Updated exam status for {candidate.name}")
else:
messages.error(request, f"Can only update exam status for candidates in Exam stage")
# if candidate.stage == "Exam":
# candidate.exam_status = exam_status
# if exam_date:
# candidate.exam_date = exam_date
# candidate.save()
# messages.success(request, f"Updated exam status for {candidate.name}")
# else:
# messages.error(request, f"Can only update exam status for candidates in Exam stage")
# Bulk stage update
elif "bulk_update_stage" in request.POST:
selected_candidates = request.POST.getlist("selected_candidates")
new_stage = request.POST.get("bulk_new_stage")
updated_count = 0
# # Bulk stage update
# elif "bulk_update_stage" in request.POST:
# selected_candidates = request.POST.getlist("selected_candidates")
# new_stage = request.POST.get("bulk_new_stage")
# updated_count = 0
for candidate_id in selected_candidates:
candidate = get_object_or_404(Candidate, id=candidate_id, job=job)
if candidate.can_transition_to(new_stage):
candidate.stage = new_stage
candidate.save()
updated_count += 1
# for candidate_id in selected_candidates:
# candidate = get_object_or_404(Candidate, id=candidate_id, job=job)
# if candidate.can_transition_to(new_stage):
# candidate.stage = new_stage
# candidate.save()
# updated_count += 1
messages.success(request, f"Updated {updated_count} candidates to {new_stage} stage")
# messages.success(request, f"Updated {updated_count} candidates to {new_stage} stage")
# Mark individual candidate as Candidate
elif "mark_as_candidate" in request.POST:
candidate_id = request.POST.get("candidate_id")
candidate = get_object_or_404(Candidate, id=candidate_id, job=job)
# # Mark individual candidate as Candidate
# elif "mark_as_candidate" in request.POST:
# candidate_id = request.POST.get("candidate_id")
# candidate = get_object_or_404(Candidate, id=candidate_id, job=job)
if candidate.applicant_status == "Applicant":
candidate.applicant_status = "Candidate"
candidate.save()
messages.success(request, f"Marked {candidate.name} as Candidate")
else:
messages.info(request, f"{candidate.name} is already marked as Candidate")
# if candidate.applicant_status == "Applicant":
# candidate.applicant_status = "Candidate"
# candidate.save()
# messages.success(request, f"Marked {candidate.name} as Candidate")
# else:
# messages.info(request, f"{candidate.name} is already marked as Candidate")
# Mark all Tier 1 candidates as Candidates
elif "mark_as_candidates" in request.POST:
updated_count = 0
for candidate in tier1_candidates:
if candidate.applicant_status == "Applicant":
candidate.applicant_status = "Candidate"
candidate.save()
updated_count += 1
# # Mark all Tier 1 candidates as Candidates
# elif "mark_as_candidates" in request.POST:
# updated_count = 0
# for candidate in tier1_candidates:
# if candidate.applicant_status == "Applicant":
# candidate.applicant_status = "Candidate"
# candidate.save()
# updated_count += 1
if updated_count > 0:
messages.success(request, f"Marked {updated_count} Tier 1 candidates as Candidates")
else:
messages.info(request, "All Tier 1 candidates are already marked as Candidates")
# if updated_count > 0:
# messages.success(request, f"Marked {updated_count} Tier 1 candidates as Candidates")
# else:
# messages.info(request, "All Tier 1 candidates are already marked as Candidates")
# Group candidates by current stage for display
stage_groups = {
@ -1347,17 +1348,75 @@ def candidate_tier_management_view(request, slug):
context = {
"job": job,
"tier1_candidates": tier1_candidates,
"tier2_candidates": tier2_candidates,
"tier3_candidates": tier3_candidates,
"stage_groups": stage_groups,
"tier1_count": tier1_count,
"total_candidates": candidates.count(),
"candidates": candidates,
# "stage_groups": stage_groups,
# "tier1_count": tier1_count,
# "total_candidates": candidates.count(),
}
return render(request, "recruitment/candidate_tier_management.html", context)
def candidate_exam_view(request, slug):
"""
Manage candidate tiers and stage transitions
"""
job = get_object_or_404(JobPosting, slug=slug)
candidates = job.candidates.filter(stage="Exam").order_by("-match_score")
return render(request, "recruitment/candidate_exam_view.html", {"job": job, "candidates": candidates})
def update_candidate_exam_status(request, slug):
candidate = get_object_or_404(Candidate, slug=slug)
if request.method == "POST":
form = CandidateExamDateForm(request.POST, instance=candidate)
if form.is_valid():
form.save()
return redirect("candidate_exam_view", slug=candidate.job.slug)
else:
form = CandidateExamDateForm(request.POST, instance=candidate)
return render(request, "includes/candidate_exam_status_form.html", {"candidate": candidate,"form": form})
def bulk_update_candidate_exam_status(request,slug):
job = get_object_or_404(JobPosting, slug=slug)
print(request.headers)
status = request.headers.get('status')
print(status)
if status:
for c in request.POST.items():
try:
candidate = Candidate.objects.get(pk=c[0])
candidate.exam_status = "Passed" if status == "pass" else "Failed"
candidate.stage = "Interview"
candidate.save()
except Exception as e:
print(e)
messages.success(request, f"Updated exam status selected candidates")
return redirect("candidate_exam_view", slug=job.slug)
def candidate_criteria_view_htmx(request, pk):
candidate = get_object_or_404(Candidate, pk=pk)
print(candidate)
return render(request, "includes/candidate_modal_body.html", {"candidate": candidate})
return render(request, "includes/candidate_modal_body.html", {"candidate": candidate})
def candidate_set_exam_date(request, slug):
candidate = get_object_or_404(Candidate, slug=slug)
candidate.exam_date = timezone.now()
candidate.save()
messages.success(request, f"Set exam date for {candidate.name} to {candidate.exam_date}")
return redirect("candidate_tier_management", slug=candidate.job.slug)
def bulk_candidate_move_to_exam(request):
for c in request.POST.items():
try:
candidate = Candidate.objects.get(pk=c[0])
candidate.stage = "Exam"
candidate.applicant_status = "Candidate"
candidate.exam_date = timezone.now()
candidate.save()
except Exception as e:
print(e)
messages.success(request, f"Moved {candidate.name} to Exam stage")
return redirect("candidate_tier_management", slug=candidate.job.slug)
# def response():
# yield SSE.patch_elements("","")
# yield SSE.execute_script("console.log('hello world');")
# return DatastarResponse(response())

View File

@ -245,7 +245,7 @@
</style>
{% block customCSS %}{% endblock %}
</head>
<body class="d-flex flex-column min-vh-100">
<body class="d-flex flex-column min-vh-100" hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
<div class="top-bar d-none d-md-block">
{# Changed container to container-fluid and added max-width-1600 to inner div #}
@ -587,7 +587,8 @@
});
});
</script>
<script type="module" src="https://cdn.jsdelivr.net/gh/starfederation/datastar@1.0.0-RC.5/bundles/datastar.js"></script>
<script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.7/dist/htmx.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/gh/starfederation/datastar@1.0.0-RC.5/bundles/datastar.js"></script>
{% block customJS %}{% endblock %}

View File

@ -0,0 +1,7 @@
{% load i18n %}
{% url 'update_candidate_exam_status' slug=candidate.slug as url %}
<form data-on-submit="@post('{{url}}', {contentType: 'form', headers: {'X-CSRFToken': '{{ csrf_token }}'}})">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="btn btn-primary">{% trans "Update" %}</button>
</form>

View File

@ -14,7 +14,11 @@
{% for key, value in candidate.criteria_checklist.items %}
<li class="list-group-item d-flex justify-content-between">
<span>{{ key }}</span>
<span class="badge bg-{{ value|yesno:"success,danger" }}">{{ value|yesno:"Yes,No" }}</span>
{% if value == 'Met' %}
<span class="badge bg-success">Yes</span>
{% else %}
<span class="badge bg-danger">Not Mentioned</span>
{% endif %}
</li>
{% endfor %}
</ul>

View File

@ -0,0 +1,363 @@
{% extends 'base.html' %}
{% load static i18n %}
{% block title %}Candidate Tier Management - {{ job.title }} - ATS{% endblock %}
{% block customCSS %}
<style>
/* Minimal Tier Management Styles */
.tier-controls {
background-color: #f8f9fa;
padding: 1rem;
border-radius: 0.375rem;
margin-bottom: 1.5rem;
}
.tier-controls .form-row {
display: flex;
align-items: end;
gap: 0.75rem;
}
.tier-controls .form-group {
flex: 1;
margin-bottom: 0;
}
.bulk-update-controls {
background-color: #f8f9fa;
padding: 1rem;
border-radius: 0.375rem;
margin-bottom: 1.5rem;
}
.stage-groups {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 1rem;
margin-bottom: 2rem;
}
.stage-group {
border: 1px solid #dee2e6;
border-radius: 0.375rem;
overflow: hidden;
}
.stage-group .stage-header {
background-color: #495057;
color: white;
padding: 0.5rem 0.75rem;
font-weight: 500;
font-size: 0.95rem;
}
.stage-group .stage-body {
padding: 0.75rem;
min-height: 80px;
}
.stage-candidate {
padding: 0.375rem;
border-bottom: 1px solid #f1f3f4;
}
.stage-candidate:last-child {
border-bottom: none;
}
.match-score {
font-weight: 600;
color: #0056b3;
}
.btn-sm {
font-size: 0.75rem;
padding: 0.2rem 0.4rem;
}
/* Tab Styles for Tiers */
.nav-tabs {
border-bottom: 1px solid #dee2e6;
margin-bottom: 1rem;
}
.nav-tabs .nav-link {
border: none;
color: #495057;
font-weight: 500;
padding: 0.5rem 1rem;
transition: all 0.2s;
}
.nav-tabs .nav-link:hover {
border: none;
background-color: #f8f9fa;
}
.nav-tabs .nav-link.active {
color: #495057;
background-color: #fff;
border: none;
border-bottom: 2px solid #007bff;
font-weight: 600;
}
.tier-1 .nav-link {
color: #155724;
}
.tier-1 .nav-link.active {
border-bottom-color: #28a745;
}
.tier-2 .nav-link {
color: #856404;
}
.tier-2 .nav-link.active {
border-bottom-color: #ffc107;
}
.tier-3 .nav-link {
color: #721c24;
}
.tier-3 .nav-link.active {
border-bottom-color: #dc3545;
}
/* Candidate Table Styles */
.candidate-table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
background-color: white;
border-radius: 0.375rem;
overflow: hidden;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.candidate-table thead {
background-color: #f8f9fa;
}
.candidate-table th {
padding: 0.75rem;
text-align: left;
font-weight: 600;
font-size: 0.875rem;
color: #495057;
border-bottom: 1px solid #dee2e6;
}
.candidate-table td {
padding: 0.75rem;
border-bottom: 1px solid #f1f3f4;
vertical-align: middle;
}
.candidate-table tbody tr:hover {
background-color: #f8f9fa;
}
.candidate-table tbody tr:last-child td {
border-bottom: none;
}
.candidate-name {
font-weight: 600;
font-size: 0.95rem;
}
.candidate-details {
font-size: 0.8rem;
color: #6c757d;
}
.candidate-table-responsive {
overflow-x: auto;
margin-bottom: 1rem;
}
.stage-badge {
padding: 0.125rem 0.5rem;
border-radius: 0.5rem;
font-size: 0.7rem;
font-weight: 600;
margin-left: 0.375rem;
}
.stage-Applied {
background-color: #e9ecef;
color: #495057;
}
.stage-Exam {
background-color: #cce5ff;
color: #004085;
}
.stage-Interview {
background-color: #d1ecf1;
color: #0c5460;
}
.stage-Offer {
background-color: #d4edda;
color: #155724;
}
.exam-controls {
display: flex;
align-items: center;
gap: 0.375rem;
margin-top: 0.375rem;
}
.exam-controls select,
.exam-controls input {
font-size: 0.75rem;
padding: 0.125rem 0.25rem;
}
.tier-badge {
font-size: 0.7rem;
padding: 0.125rem 0.375rem;
border-radius: 0.25rem;
background-color: rgba(0,0,0,0.1);
color: #495057;
margin-left: 0.375rem;
}
</style>
{% endblock %}
{% block content %}
<div class="container py-4">
<div class="d-flex justify-content-between align-items-center mb-4">
<div>
<h1 class="h3 mb-1">
<i class="fas fa-layer-group me-2"></i>
{% trans "Exam" %} - {{ job.title }}
</h1>
<p class="text-muted mb-0">
Total Candidates: {{ total_candidates }}
</p>
</div>
<a href="{% url 'job_detail' job.slug %}" class="btn btn-outline-secondary">
<i class="fas fa-arrow-left me-1"></i> {% trans "Back to Job" %}
</a>
</div>
<!-- Tier Controls -->
<div class="tier-controls">
<form method="post" class="mb-0">
{% csrf_token %}
<div class="form-row">
<div class="form-group">
<label for="tier1_count">{% trans "Number of candidates in Tier 1 (Top N)" %}</label>
<input type="number" name="tier1_count" id="tier1_count" class="form-control"
value="{{ tier1_count }}" min="1" max="{{ total_candidates }}">
</div>
<div class="form-group">
<button type="submit" name="update_tiers" class="btn btn-primary">
<i class="fas fa-sync-alt me-1"></i> {% trans "Update Tiers" %}
</button>
</div>
</div>
</form>
</div>
<!-- Tier Display -->
<h2 class="h4 mb-3 mt-5">{% trans "Candidate Tiers" %}</h2>
<div class="candidate-table-responsive" data-signals__ifmissing="{_fetching: false, selections: Array({{ candidates|length }}).fill(false)}">
{% url "bulk_update_candidate_exam_status" job.slug as bulk_update_candidate_exam_status_url %}
{% if candidates %}
<button class="btn btn-primary"
data-attr="{disabled: !$selections.filter(Boolean).length}"
data-on-click="@post('{{bulk_update_candidate_exam_status_url}}',{
contentType: 'form',
selector: '#myform',
headers: {'X-CSRFToken': '{{ csrf_token }}','status': 'pass'}
})"
>Mark as Pass and move to Interview</button>
<button class="btn btn-danger"
data-attr="{disabled: !$selections.filter(Boolean).length}"
data-on-click="@post('{{bulk_update_candidate_exam_status_url}}',{
contentType: 'form',
selector: '#myform',
headers: {'X-CSRFToken': '{{ csrf_token }}','status': 'fail'}
})"
>Mark as Failed</button>
{% endif %}
<form id="myform" action="{{move_to_exam_url}}" method="post">
<table class="candidate-table">
<thead>
<tr>
<th>
{% if candidates %}
<div class="form-check">
<input
data-bind-_all
data-on-change="$selections = Array({{ candidates|length }}).fill($_all)"
data-effect="$selections; $_all = $selections.every(Boolean)"
data-attr-disabled="$_fetching"
type="checkbox" class="form-check-input" id="candidate-{{ candidate.id }}">
</div>
{% endif %}
</th>
<th>{% trans "Name" %}</th>
<th>{% trans "Contact" %}</th>
<th>{% trans "AI Score" %}</th>
<th>{% trans "Exam Status" %}</th>
<th>{% trans "Exam Date" %}</th>
<th>{% trans "Actions" %}</th>
</tr>
</thead>
<tbody>
{% for candidate in candidates %}
<tr>
<td>
<div class="form-check">
<input
data-bind-selections
data-attr-disabled="$_fetching"
name="{{ candidate.id }}"
type="checkbox" class="form-check-input" id="candidate-{{ candidate.id }}">
</div>
</td>
<td>
<div class="candidate-name">{{ candidate.name }}</div>
</td>
<td>
<div class="candidate-details">
Email: {{ candidate.email }}<br>
Phone: {{ candidate.phone }}<br>
</div>
</td>
<td>
<span class="badge bg-success">{{ candidate.match_score|default:"0" }}</span>
</td>
<td>
{% if candidate.exam_status == "Passed" %}
<span class="badge bg-success">{{ candidate.exam_status }}</span>
{% elif candidate.exam_status == "Failed" %}
<span class="badge bg-danger">{{ candidate.exam_status }}</span>
{% endif %}
</td>
<td>{{candidate.exam_date|date:"M d, Y h:i A"}}</td>
<td>
<button class="btn btn-primary"
data-bs-toggle="modal"
data-bs-target="#candidateviewModal"
hx-get="{% url 'candidate_criteria_view_htmx' candidate.pk %}"
hx-target="#candidateviewModalBody"
>
{% include "icons/view.html" %}
{% trans "View" %}</button>
<button class="btn btn-primary"
data-bs-toggle="modal"
data-bs-target="#candidateviewModal"
hx-get="{% url 'update_candidate_exam_status' candidate.slug %}"
hx-target="#candidateviewModalBody"
>
{% include "icons/view.html" %}
{% trans "Set Exam Date" %}</button>
{% if candidate.stage != "Exam" %}
<button hx-post="{% url 'candidate_set_exam_date' candidate.slug %}"
hx-target=".candidate-table"
hx-select=".candidate-table"
hx-swap="outerHTML"
class="btn btn-primary"> {% trans "Move to Exam" %} {% include "icons/right.html" %}</button>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</form>
</div>
<!-- Tab Content -->
<div class="modal fade modal-lg" id="candidateviewModal" tabindex="-1" aria-labelledby="candidateviewModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="candidateviewModalLabel">Form Settings</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div id="candidateviewModalBody" class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -174,59 +174,132 @@
{% trans "Number of Potential Candidates (Top N)" %}
</label>
<input type="number" name="tier1_count" id="tier1_count" class="form-control"
value="{{ tier1_count }}" min="1" max="{{ total_candidates }}"
placeholder="Enter N for top candidates">
value="{{ tier1_count }}" min="1" max="{{ total_candidates }}">
</div>
<div class="col-md-auto">
<button type="submit" name="update_tiers" class="btn btn-main-action">
<i class="fas fa-filter me-1"></i> {% trans "Apply Filter" %}
<div class="form-group">
<button type="submit" name="update_tiers" class="btn btn-primary">
<i class="fas fa-sync-alt me-1"></i> {% trans "Update Tiers" %}
</button>
</div>
</div>
<p class="small text-muted mt-2 mb-0">
{% trans "The candidates list is filtered by either the minimum AI Score OR the Top N candidates, whichever criteria results in a smaller set." %}
</p>
</form>
</div>
<hr class="my-4">
<!-- Tier Display -->
<h2 class="h4 mb-3 mt-5">{% trans "Candidate Tiers" %}</h2>
<div class="candidate-table-responsive" data-signals__ifmissing="{_fetching: false, selections: Array({{ candidates|length }}).fill(false)}">
{% url "bulk_candidate_move_to_exam" as move_to_exam_url %}
{% if candidates %}
<button class="btn btn-primary"
data-attr="{disabled: !$selections.filter(Boolean).length}"
data-on-click="@post('{{move_to_exam_url}}',{
contentType: 'form',
selector: '#myform',
headers: {'X-CSRFToken': '{{ csrf_token }}'}})"
>Bulk Move To Exam</button>
{% endif %}
<form id="myform" action="{{move_to_exam_url}}" method="post">
<table class="candidate-table">
<thead>
<tr>
<th>
{% if candidates %}
<div class="form-check">
<input
data-bind-_all
data-on-change="$selections = Array({{ candidates|length }}).fill($_all)"
data-effect="$selections; $_all = $selections.every(Boolean)"
data-attr-disabled="$_fetching"
type="checkbox" class="form-check-input" id="candidate-{{ candidate.id }}">
</div>
{% endif %}
</th>
<th>{% trans "Name" %}</th>
<th>{% trans "Contact" %}</th>
<th>{% trans "AI Score" %}</th>
<th>{% trans "Status" %}</th>
<th>{% trans "Stage" %}</th>
<th>{% trans "Actions" %}</th>
</tr>
</thead>
<tbody>
{% for candidate in candidates %}
<tr>
<td>
<div class="form-check">
<input
data-bind-selections
data-attr-disabled="$_fetching"
name="{{ candidate.id }}"
<ul class="nav nav-pills mb-3 justify-content-center" id="candidateViewTabs" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="all-applicants-tab" data-bs-toggle="tab" data-bs-target="#all-applicants" type="button"
role="tab" aria-controls="all-applicants" aria-selected="true">
<i class="fas fa-users me-1"></i> {% trans "All Applicants" %}
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="potential-candidates-tab" data-bs-toggle="tab" data-bs-target="#potential-candidates" type="button"
role="tab" aria-controls="potential-candidates" aria-selected="false">
<i class="fas fa-trophy me-1"></i> {% trans "Potential Candidates" %}
<span class="candidate-indicator-badge">{{ tier1_candidates|length }}</span>
</button>
</li>
</ul>
type="checkbox" class="form-check-input" id="candidate-{{ candidate.id }}">
</div>
</td>
<td>
<div class="candidate-name">{{ candidate.name }}</div>
</td>
<td>
<div class="candidate-details">
Email: {{ candidate.email }}<br>
Phone: {{ candidate.phone }}<br>
</div>
</td>
<td>
<span class="badge bg-success">{{ candidate.match_score|default:"0" }}</span>
</td>
<td>
<span class="badge {% if candidate.applicant_status == 'Candidate' %}bg-success{% else %}bg-secondary{% endif %}">
{{ candidate.get_applicant_status_display }}
</span>
</td>
<td>
<span class="stage-badge stage-{{ candidate.stage }}">
{{ candidate.get_stage_display }}
</span>
{% if candidate.stage == "Exam" and candidate.exam_status %}
<br>
<span class="badge bg-info">{{ candidate.get_exam_status_display }}</span>
{% endif %}
</td>
<td>
<button class="btn btn-primary"
data-bs-toggle="modal"
data-bs-target="#candidateviewModal"
hx-get="{% url 'candidate_criteria_view_htmx' candidate.pk %}"
hx-target="#candidateviewModalBody"
>
{% include "icons/view.html" %}
{% trans "View" %}</button>
{% if candidate.stage != "Exam" %}
<button hx-post="{% url 'candidate_move_to_exam' candidate.pk %}"
hx-target=".candidate-table"
hx-select=".candidate-table"
hx-swap="outerHTML"
class="btn btn-primary"> {% trans "Move to Exam" %} {% include "icons/right.html" %}</button>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</form>
</div>
<!-- Tab Content -->
<div class="tab-content kaauh-card p-3 shadow-sm" id="candidateViewTabContent">
<div class="modal fade modal-lg" id="candidateviewModal" tabindex="-1" aria-labelledby="candidateviewModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="candidateviewModalLabel">Form Settings</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div id="candidateviewModalBody" class="modal-body">
<div class="tab-pane fade show active" id="all-applicants" role="tabpanel" aria-labelledby="all-applicants-tab">
<h2 class="h5 mb-3" style="color: var(--kaauh-teal-dark);">{% trans "Complete List of All Submissions" %}</h2>
{% include "recruitment/partials/_candidate_table.html" with candidates=all_applicants_list is_potential_view=False only %}
</div>
<div class="tab-pane fade" id="potential-candidates" role="tabpanel" aria-labelledby="potential-candidates-tab">
<h2 class="h5 mb-3" style="color: var(--kaauh-teal-dark);">
{% trans "Top" %} {{ tier1_candidates|length }} {% trans "Candidates by AI Score" %}
</h2>
{% include "recruitment/partials/_candidate_table.html" with candidates=tier1_candidates is_potential_view=True only %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
{% comment %}
Modals for candidate view and exam status update should be included here,
e.g., {% include "includes/_modals_for_candidate_management.html" %}
{% endcomment %}
{% endblock %}