This commit is contained in:
Faheed 2025-10-13 17:07:21 +03:00
parent 4caf57a3e0
commit 97d9e034cd
8 changed files with 224 additions and 168 deletions

Binary file not shown.

View File

@ -229,7 +229,7 @@ class JobPosting(Base):
parts.append(self.location_city)
if self.location_state:
parts.append(self.location_state)
if self.location_country and self.location_country != "United States":
if self.location_country:
parts.append(self.location_country)
return ", ".join(parts) if parts else "Not specified"

View File

@ -963,6 +963,8 @@ def submit_form(request, template_id):
resume=resume.get_file if resume.is_file else None,
job=submission.template.job,
)
return redirect('application_success')
except Exception as e:
logger.error(f"Candidate creation failed,{e}")
pass

View File

@ -5,7 +5,9 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ATS Form Builder - Vanilla JS</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
/* Updated CSS styles with a new Teal/Aqua theme */
:root {
@ -771,8 +773,22 @@
</div>
<!-- Main Content Area -->
<div class="main-content">
<nav>
<div class="bread" style="color: #6c757d; font-size: 0.9rem;">
<span class="me-2">
<a href="{% url 'dashboard' %}" style="color: #6c757d !important; text-decoration: none !important;">Home</a>
/
</span>
<span class="me-2">
<a href="{% url 'job_list' %}" style="color: #6c757d !important; text-decoration: none !important;">Jobs</a>
/
</span>
<span style="color: #6c757d; font-weight: 600;">Form Builder</span>
</div>
</nav>
<div class="toolbar">
<h1 id="formTitle">Resume Application Form</h1>
<div>
<button class="btn btn-outline" id="formSettingsBtn">
<i class="fas fa-cog"></i> Settings
@ -961,7 +977,9 @@
</div>
</div>
</div>
<script>
// Application State
const state = {
draggedStageIndex: null,

View File

@ -393,7 +393,7 @@
id="copyJobLinkButton"
data-url="{{ job.application_url }}">
<i class="fas fa-link me-1"></i>
{% trans "Copy Public Link" %}
{% trans "Copy and Share Public Link" %}
</button>
<span id="copyFeedback" class="text-success ms-2 small" style="display:none;">

View File

@ -13,6 +13,10 @@
--kaauh-primary-text: #343a40;
}
/* Primary Color Overrides */
.text-primary-theme { color: var(--kaauh-teal) !important; }
.bg-primary-theme { background-color: var(--kaauh-teal) !important; }
/* Enhanced Card Styling */
.card {
border: 1px solid var(--kaauh-border);
@ -20,7 +24,7 @@
box-shadow: 0 4px 12px rgba(0,0,0,0.06);
transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
.card:not(.no-hover):hover {
transform: translateY(-2px);
box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}
@ -32,6 +36,9 @@
color: white;
font-weight: 600;
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
gap: 0.25rem;
}
.btn-main-action:hover {
@ -51,17 +58,6 @@
border-color: var(--kaauh-teal-dark);
}
/* Job Card Specifics */
.job-card .card-title {
color: var(--kaauh-teal-dark);
font-weight: 600;
font-size: 1.15rem;
}
.job-card .card-text i {
color: var(--kaauh-teal);
width: 1.25rem; /* Align icons vertically */
}
/* Status Badges */
.status-badge {
font-size: 0.8rem;
@ -71,41 +67,100 @@
text-transform: uppercase;
letter-spacing: 0.7px;
}
/* Mapped color classes to theme */
.bg-draft { background-color: #6c757d !important; } /* secondary */
.bg-active { background-color: var(--kaauh-teal) !important; } /* primary teal */
.bg-closed { background-color: #dc3545 !important; } /* danger */
.bg-archived { background-color: #343a40 !important; } /* dark */
.bg-DRAFT { background-color: #6c757d !important; }
.bg-ACTIVE { background-color: var(--kaauh-teal) !important; }
.bg-CLOSED { background-color: #dc3545 !important; }
.bg-ARCHIVED { background-color: #343a40 !important; }
.bg-info { background-color: #17a2b8 !important; }
.bg-info { background-color: #17a2b8 !important; } /* LinkedIn badge */
/* --- TABLE ALIGNMENT AND SIZING FIXES --- */
.table {
table-layout: fixed; /* Ensures column widths are respected */
width: 100%;
}
.table thead th {
color: var(--kaauh-primary-text);
font-weight: 500; /* Lighter weight for smaller font */
font-size: 0.85rem; /* Smaller font size for header text */
vertical-align: middle;
border-bottom: 2px solid var(--kaauh-border);
padding: 0.5rem 0.25rem; /* Reduced vertical and horizontal padding */
}
.table-hover tbody tr:hover {
background-color: #f3f7f9;
}
/* Optimized Main Table Column Widths (Total must be 100%) */
.table th:nth-child(1) { width: 22%; } /* Job ID (Tight) */
.table th:nth-child(2) { width: 12%; } /* Source (Tight) */
.table th:nth-child(3) { width: 8%; } /* Actions (Tight, icon buttons) */
.table th:nth-child(4) { width: 8%; } /* Form (Tight, icon buttons) */
.table th:nth-child(5) { width: 50%; } /* Candidate Metrics (colspan=7) */
/* Pagination Link Styling */
.pagination .page-item .page-link {
/* NESTED TABLE STYLING FOR CANDIDATE MANAGEMENT HEADER */
.nested-header-table {
margin: 0;
padding: 0;
width: 100%;
border-collapse: collapse;
table-layout: fixed; /* CRITICAL for 1:1 data alignment */
}
.nested-header-table thead th {
background-color: transparent;
border: none;
padding: 0.3rem 0 0.1rem 0; /* Reduced padding here too */
font-weight: 500;
text-align: center;
color: #6c757d;
font-size: 0.75rem; /* Even smaller font for nested headers */
width: calc(100% / 7);
}
/* Explicit widths are technically defined by the 1/7 rule, but keeping them for clarity/safety */
.nested-header-table thead th:nth-child(1),
.nested-header-table thead th:nth-child(2),
.nested-header-table thead th:nth-child(5) {
width: calc(100% / 7);
}
.nested-header-table thead th:nth-child(3),
.nested-header-table thead th:nth-child(4) {
width: calc(100% / 7 * 2);
}
/* Inner Nested Table (P/F) */
.nested-stage-metrics {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
}
.nested-stage-metrics thead th {
padding: 0.1rem 0; /* Very minimal padding */
font-weight: 600;
color: var(--kaauh-teal-dark);
border-color: var(--kaauh-border);
}
.pagination .page-item.active .page-link {
background-color: var(--kaauh-teal);
border-color: var(--kaauh-teal);
color: white;
}
.pagination .page-item:hover .page-link:not(.active) {
background-color: #e9ecef;
font-size: 0.7rem; /* Smallest font size */
width: 50%;
}
/* Filter & Search Layout Adjustments */
.filter-buttons {
display: flex;
gap: 0.5rem; /* Space between filter and clear buttons */
/* Main TH for Candidate Management Header */
.candidate-management-header {
text-align: center;
padding: 0;
border-left: 2px solid var(--kaauh-teal);
border-right: 1px solid var(--kaauh-border) !important;
}
.form-control-search {
/* Optional: Add slight shadow/focus effect to search bar */
box-shadow: none;
border-color: var(--kaauh-border);
/* Candidate Management Data Cells (7 columns total now) */
.candidate-data-cell {
text-align: center;
vertical-align: middle;
font-weight: 600;
font-size: 0.9rem; /* Keep data readable */
border-left: 1px solid var(--kaauh-border);
}
.form-control-search:focus {
border-color: var(--kaauh-teal);
box-shadow: 0 0 0 0.1rem rgba(0, 99, 110, 0.25);
.candidate-data-cell a {
display: block;
text-decoration: none;
padding: 0.4rem 0; /* Minimized vertical padding */
}
</style>
{% endblock %}
@ -114,10 +169,10 @@
<div class="container-fluid py-4">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 style="color: var(--kaauh-teal-dark); font-weight: 700;">
<i class="fas fa-briefcase me-2"></i> Job Postings
<i class="fas fa-briefcase me-2"></i> {% trans "Job Postings" %}
</h1>
<a href="{% url 'job_create' %}" class="btn btn-main-action">
<i class="fas fa-plus me-1"></i> Create New Job
<i class="fas fa-plus me-1"></i> {% trans "Create New Job" %}
</a>
</div>
@ -125,7 +180,7 @@
<div class="card-body">
<div class="row">
<div class="col-md-4">
<label for="search" class="form-label small text-muted">Search by Title or Department</label>
<label for="search" class="form-label small text-muted">{% trans "Search by Title or Department" %}</label>
<div class="input-group input-group-lg mb-3">
<form method="get" action="" class="w-100">
{% include 'includes/search_form.html' %}
@ -133,117 +188,123 @@
</div>
</div>
<div class="col-md-8">
{% url 'job_list' as job_list_url %}
<form method="GET" class="row g-3 align-items-end" >
<div class="col-md-3">
<label for="status" class="form-label small text-muted">Filter by Status</label>
<select name="status" id="status" class="form-select form-select-sm">
<option value="">All Statuses</option>
<option value="DRAFT" {% if status_filter == 'DRAFT' %}selected{% endif %}>Draft</option>
<option value="PUBLISHED" {% if status_filter == 'PUBLISHED' %}selected{% endif %}>Published</option>
<option value="CLOSED" {% if status_filter == 'CLOSED' %}selected{% endif %}>Closed</option>
<option value="ARCHIVED" {% if status_filter == 'ARCHIVED' %}selected{% endif %}>Archived</option>
</select>
</div>
<div class="col-md-5">
<div class="filter-buttons">
<button type="submit" class="btn btn-main-action btn-lg">
<i class="fas fa-filter me-1"></i> Apply Filters
</button>
</div>
</div>
</form>
<form method="GET" class="row g-3 align-items-end" >
<div class="col-md-3">
<label for="status" class="form-label small text-muted">{% trans "Filter by Status" %}</label>
<select name="status" id="status" class="form-select form-select-sm">
<option value="">{% trans "All Statuses" %}</option>
<option value="DRAFT" {% if status_filter == 'DRAFT' %}selected{% endif %}>{% trans "Draft" %}</option>
<option value="ACTIVE" {% if status_filter == 'ACTIVE' %}selected{% endif %}>{% trans "Active" %}</option>
<option value="CLOSED" {% if status_filter == 'CLOSED' %}selected{% endif %}>{% trans "Closed" %}</option>
<option value="ARCHIVED" {% if status_filter == 'ARCHIVED' %}selected{% endif %}>{% trans "Archived" %}</option>
</select>
</div>
<div class="col-md-5">
<div class="filter-buttons">
<button type="submit" class="btn btn-main-action btn-sm">
<i class="fas fa-filter me-1"></i> {% trans "Apply Filters" %}
</button>
<a href="{% url 'job_list' %}" class="btn btn-outline-secondary btn-sm">
<i class="fas fa-times me-1"></i> {% trans "Clear" %}
</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{% if page_obj %}
<div id="job-list">
{# View Switcher #}
{% include "includes/_list_view_switcher.html" with list_id="job-list" %}
{% comment %} --- START OF TABLE VIEW (Data relied upon context variable 'jobs') --- {% endcomment %}
<div id="job-list">
{% comment %} Placeholder for View Switcher {% endcomment %}
{% include "includes/_list_view_switcher.html" with list_id="job-list" %}
{# Card View (Default) #}
<div class="card-view active row">
{% for job in page_obj %}
<div class="col-md-6 col-lg-4 mb-4 ">
<div class="card job-card h-100">
<div class="card-body d-flex flex-column">
<div class="d-flex justify-content-between align-items-start mb-2">
<h5 class="card-title flex-grow-1 me-3">{{ job.title }}</h5>
<span class="badge bg-{{ job.status|lower|striptags|yesno:'active,draft,closed,archived' }} status-badge">
{{ job.get_status_display }}
</span>
</div>
<p class="card-text text-muted small">
<i class="fas fa-building"></i> {{ job.department|default:"No Department" }}<br>
<i class="fas fa-map-marker-alt"></i> {{ job.get_location_display }}<br>
<i class="fas fa-clock"></i> {{ job.get_job_type_display }}<br>
<i class="fas fa-briefcase"></i> {{ job.get_source }}
</p>
<div class="mt-auto pt-2 border-top">
{% if job.posted_to_linkedin %}
<span class="badge bg-info mb-2">
<i class="fab fa-linkedin me-1"></i> Posted to LinkedIn
</span>
{% endif %}
<div class="d-flex gap-2">
<a href="{% url 'job_detail' job.slug %}" class="btn btn-sm btn-main-action">
<i class="fas fa-eye"></i> View
</a>
<a href="{% url 'job_update' job.slug %}" class="btn btn-sm btn-outline-secondary">
<i class="fas fa-edit"></i> Edit
</a>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
{# Table View #}
<div class="table-view">
<div class="table-responsive">
<table class="table table-hover">
<div class="table-view active">
<div class="card shadow-sm">
<div class="table-responsive ">
<table class="table table-hover align-middle mb-0 table-sm">
<thead>
<tr>
<th scope="col">{% trans "Job Title" %}</th>
<th scope="col">{% trans "Department" %}</th>
<th scope="col">{% trans "Location" %}</th>
<th scope="col">{% trans "Job Type" %}</th>
<th scope="col">{% trans "Status" %}</th>
<th scope="col">{% trans "Job ID" %}</th>
{% comment %} <th scope="col">{% trans "Job Title" %}</th>
<th scope="col">{% trans "Status" %}</th> {% endcomment %}
<th scope="col">{% trans "Source" %}</th>
<th scope="col" class="text-end">{% trans "Actions" %}</th>
<th scope="col">{% trans "Actions" %}</th>
<th scop="col" class="text-center">{% trans "Manage Forms" %}</th>
<th scope="col" colspan="7" class="candidate-management-header">
{% trans "Applicants Metrics" %}
<table class="nested-header-table">
<thead>
<tr>
<th style="width: 14.28%;">{% trans "Applied" %}</th>
<th style="width: 14.28%;">{% trans "Screened" %}</th>
<th colspan="2">{% trans "Exam" %}
<table class="nested-stage-metrics">
<thead>
<th>P</th>
<th>F</th>
</thead>
</table>
</th>
<th colspan="2">{% trans "Interview" %}
<table class="nested-stage-metrics">
<thead>
<th>P</th>
<th>F</th>
</thead>
</table>
</th>
<th style="width: 14.28%;">{% trans "Offer" %}</th>
</tr>
</thead>
</table>
</th>
</tr>
</thead>
<tbody>
{% for job in page_obj %}
{% comment %} This loop relies on the 'jobs' variable passed from the Django view {% endcomment %}
{% for job in jobs %}
<tr>
<td class="fw-medium">{{ job.title }}</td>
<td>{{ job.department|default:"N/A" }}</td>
<td>{{ job.get_location_display }}</td>
<td>{{ job.get_job_type_display }}</td>
<td><span class="badge bg-{{ job.status|lower|striptags|yesno:'active,draft,closed,archived' }} status-badge">{{ job.get_status_display }}</span></td>
<td class="fw-medium text-primary-theme">{{ job }}</td>
{% comment %} <td class="fw-medium text-primary-theme">{{ job.title }}</td>
<td><span class="badge bg-{{ job.status }} status-badge">{{ job.status }}</span></td> {% endcomment %}
<td>{{ job.get_source }}</td>
<td class="text-end">
<td>
<div class="btn-group btn-group-sm" role="group">
<a href="{% url 'job_detail' job.slug %}" class="btn btn-outline-primary" title="View">
<a href="{% url 'job_detail' job.slug %}" class="btn btn-outline-secondary" title="{% trans 'View' %}">
<i class="fas fa-eye"></i>
</a>
<a href="{% url 'job_update' job.slug %}" class="btn btn-outline-secondary" title="Edit">
<a href="{% url 'job_update' job.slug %}" class="btn btn-outline-secondary" title="{% trans 'Edit' %}">
<i class="fas fa-edit"></i>
</a>
</div>
</td>
<td class="text-end">
<div class="btn-group btn-group-sm" role="group">
<a href="{% url 'form_wizard' job.form_template.id %}" class="btn btn-outline-primary" title="{% trans 'Preview' %}">
<i class="fas fa-eye"></i>
</a>
<a href="{% url 'form_builder' job.form_template.id %}" class="btn btn-outline-secondary" title="{% trans 'Edit' %}">
<i class="fas fa-edit"></i>
</a>
<a href="{% url 'form_template_submissions_list' job.form_template.slug %}" class="btn btn-outline-secondary" title="{% trans 'Submissions' %}">
<i class="fas fa-file-alt"></i>
</a>
</div>
</td>
{# CANDIDATE MANAGEMENT DATA - 7 SEPARATE COLUMNS CORRESPONDING TO THE HEADER #}
<td class="candidate-data-cell text-primary-theme"><a href="#" class="text-primary-theme">{% if job.metrics.applied %}{{ job.metrics.applied }}{% else %}-{% endif %}</a></td>
<td class="candidate-data-cell text-info"><a href="#" class="text-info">{% if job.metrics.screening %}{{ job.metrics.screening }}{% else %}-{% endif %}</a></td>
<td class="candidate-data-cell text-success"><a href="#" class="text-success">{% if job.metrics.exam_p %}{{ job.metrics.exam_p }}{% else %}-{% endif %}</a></td>
<td class="candidate-data-cell text-danger"><a href="#" class="text-danger">{% if job.metrics.exam_f %}{{ job.metrics.exam_f }}{% else %}-{% endif %}</a></td>
<td class="candidate-data-cell text-success"><a href="#" class="text-success">{% if job.metrics.interview_p %}{{ job.metrics.interview_p }}{% else %}-{% endif %}</a></td>
<td class="candidate-data-cell text-danger"><a href="#" class="text-danger">{% if job.metrics.interview_f %}{{ job.metrics.interview_f }}{% else %}-{% endif %}</a></td>
<td class="candidate-data-cell text-success"><a href="#" class="text-success">{% if job.metrics.offer %}{{ job.metrics.offer }}{% else %}-{% endif %}</a></td>
</tr>
{% endfor %}
</tbody>
@ -251,45 +312,20 @@
</div>
</div>
</div>
{% if page_obj.has_other_pages %}
<nav aria-label="Job pagination" class="mt-4">
<ul class="pagination justify-content-center">
{% if page_obj.has_previous %}
<li class="page-item">
<a class="page-link" href="?page=1{% if status_filter %}&status={{ status_filter }}{% endif %}{% if search_query %}&q={{ search_query }}{% endif %}">First</a>
</li>
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.previous_page_number }}{% if status_filter %}&status={{ status_filter }}{% endif %}{% if search_query %}&q={{ search_query }}{% endif %}">Previous</a>
</li>
{% endif %}
<li class="page-item active">
<span class="page-link">{{ page_obj.number }} of {{ page_obj.paginator.num_pages }}</span>
</li>
{% if page_obj.has_next %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.next_page_number }}{% if status_filter %}&status={{ status_filter }}{% endif %}{% if search_query %}&q={{ search_query }}{% endif %}">Next</a>
</li>
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.paginator.num_pages }}{% if status_filter %}&status={{ status_filter }}{% endif %}{% if search_query %}&q={{ search_query }}{% endif %}">Last</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
{% else %}
</div>
{% comment %} Fallback/Empty State {% endcomment %}
{% if not jobs and not job_list_data and not page_obj %}
<div class="text-center py-5 card shadow-sm">
<div class="card-body">
<i class="fas fa-briefcase fa-3x mb-3" style="color: var(--kaauh-teal-dark);"></i>
<h3>No job postings found</h3>
<p class="text-muted">Create your first job posting to get started or adjust your filters.</p>
<h3>{% trans "No job postings found" %}</h3>
<p class="text-muted">{% trans "Create your first job posting to get started or adjust your filters." %}</p>
<a href="{% url 'job_create' %}" class="btn btn-main-action mt-3">
<i class="fas fa-plus me-1"></i> Create Job
<i class="fas fa-plus me-1"></i> {% trans "Create Job" %}
</a>
</div>
</div>
{% endif %}
</div>
{% endblock %}
{% endblock %}