fix the resume prev stage not rendring

This commit is contained in:
ismail 2025-12-17 17:17:58 +03:00
parent 99ec8b0171
commit ade0f1506c
7 changed files with 239 additions and 206 deletions

6
.env
View File

@ -1,3 +1,3 @@
DB_NAME=haikal_db
DB_USER=faheed
DB_PASSWORD=Faheed@215
DB_NAME=norahuniversity
DB_USER=norahuniversity
DB_PASSWORD=norahuniversity

View File

@ -17,6 +17,7 @@ urlpatterns = [
# Job CRUD Operations
path("jobs/", views.JobListView.as_view(), name="job_list"),
path("jobs/create/", views.create_job, name="job_create"),
path("jobs/bank/", views.job_bank_view, name="job_bank"),
path("jobs/<slug:slug>/", views.job_detail, name="job_detail"),
path("jobs/<slug:slug>/update/", views.edit_job, name="job_update"),
path("jobs/<slug:slug>/upload-image/", views.job_image_upload, name="job_image_upload"),
@ -25,7 +26,6 @@ urlpatterns = [
path("jobs/<slug:slug>/applicants/", views.job_applicants_view, name="job_applicants"),
path("jobs/<slug:slug>/applications/", views.JobApplicationListView.as_view(), name="job_applications_list"),
path("jobs/<slug:slug>/calendar/", views.interview_calendar_view, name="interview_calendar"),
path("jobs/bank/", views.job_bank_view, name="job_bank"),
# Job Actions & Integrations
path("jobs/<slug:slug>/post-to-linkedin/", views.post_to_linkedin, name="post_to_linkedin"),

View File

@ -2230,60 +2230,60 @@ def reschedule_meeting_for_application(request, slug):
def interview_calendar_view(request, slug):
job = get_object_or_404(JobPosting, slug=slug)
# # Get all scheduled interviews for this job
# scheduled_interviews = ScheduledInterview.objects.filter(job=job).select_related(
# "applicaton", "zoom_meeting"
# )
# Get all scheduled interviews for this job
scheduled_interviews = ScheduledInterview.objects.filter(job=job).select_related(
"interview","application"
)
# # Convert interviews to calendar events
# events = []
# for interview in scheduled_interviews:
# # Create start datetime
# start_datetime = datetime.combine(
# interview.interview_date, interview.interview_time
# )
# Convert interviews to calendar events
events = []
for interview in scheduled_interviews:
# Create start datetime
start_datetime = datetime.combine(
interview.interview_date, interview.interview_time
)
# # Calculate end datetime based on interview duration
# duration = interview.zoom_meeting.duration if interview.zoom_meeting else 60
# end_datetime = start_datetime + timedelta(minutes=duration)
# Calculate end datetime based on interview duration
duration = interview.interview.duration if interview.interview else 60
end_datetime = start_datetime + timedelta(minutes=duration)
# # Determine event color based on status
# color = "#00636e" # Default color
# if interview.status == "confirmed":
# color = "#00a86b" # Green for confirmed
# elif interview.status == "cancelled":
# color = "#e74c3c" # Red for cancelled
# elif interview.status == "completed":
# color = "#95a5a6" # Gray for completed
# Determine event color based on status
color = "#00636e" # Default color
if interview.status == "confirmed":
color = "#00a86b" # Green for confirmed
elif interview.status == "cancelled":
color = "#e74c3c" # Red for cancelled
elif interview.status == "completed":
color = "#95a5a6" # Gray for completed
# events.append(
# {
# "title": f"Interview: {interview.candidate.name}",
# "start": start_datetime.isoformat(),
# "end": end_datetime.isoformat(),
# "url": f"{request.path}interview/{interview.id}/",
# "color": color,
# "extendedProps": {
# "candidate": interview.candidate.name,
# "email": interview.candidate.email,
# "status": interview.status,
# "meeting_id": interview.zoom_meeting.meeting_id
# if interview.zoom_meeting
# else None,
# "join_url": interview.zoom_meeting.join_url
# if interview.zoom_meeting
# else None,
# },
# }
# )
events.append(
{
"title": f"Interview: {interview.application.person.full_name}",
"start": start_datetime.isoformat(),
"end": end_datetime.isoformat(),
"url": f"{request.path}interview/{interview.id}/",
"color": color,
"extendedProps": {
"candidate": interview.application.person.full_name,
"email": interview.application.person.email,
"status": interview.interview.status,
"meeting_id": interview.interview.meeting_id
if interview.interview
else None,
"join_url": interview.interview.join_url
if interview.interview
else None,
},
}
)
# context = {
# "job": job,
# "events": events,
# "calendar_color": "#00636e",
# }
context = {
"job": job,
"events": events,
"calendar_color": "#00636e",
}
# return render(request, "recruitment/interview_calendar.html", context)
return render(request, "recruitment/interview_calendar.html", context)
def user_profile_image_update(request, pk):

View File

@ -877,6 +877,10 @@
}
function renderCurrentStage() {
// Always show stage container and hide preview container initially
elements.stageContainer.style.display = 'block';
elements.previewContainer.style.display = 'none';
if (state.isPreview) {
renderPreview();
return;
@ -884,7 +888,6 @@
const currentStage = state.stages[state.currentStage];
elements.stageContainer.innerHTML = '';
elements.previewContainer.style.display = 'none';
const stageTitle = document.createElement('h2');
stageTitle.className = 'stage-title';
@ -900,11 +903,14 @@
elements.backBtn.style.display = state.currentStage > 0 ? 'flex' : 'none';
elements.submitBtn.style.display = 'none';
elements.nextBtn.style.display = 'flex';
elements.nextBtn.textContent = state.currentStage === state.stages.length - 1 ?
'Preview' :
'Next'
// Fix: Update the Next button text correctly
elements.nextBtn.innerHTML = state.currentStage === state.stages.length - 1 ?
'Preview <i class="fas fa-arrow-right"></i>' :
'Next <i class="fas fa-arrow-right"></i>';
}
function createFieldElement(field) {
const fieldDiv = document.createElement('div');
fieldDiv.className = 'field-container';
@ -1245,11 +1251,14 @@
function prevStage() {
if (state.isPreview) {
// Go back to last stage
// Go back to last stage from preview
state.isPreview = false;
// Set to the last form stage
state.currentStage = state.stages.length - 1;
renderCurrentStage();
updateProgress();
} else if (state.currentStage > 0) {
// Go to previous stage
state.currentStage--;
renderCurrentStage();
updateProgress();

View File

@ -234,11 +234,7 @@
</a>
</li>
{% endif %}
<li><hr class="dropdown-divider my-1"></li>
<li>
<form method="post" action="{% url 'account_logout'%}" class="d-inline">
{% csrf_token %}

View File

@ -147,6 +147,30 @@
{% block content %}
<div class="container-fluid py-4">
<!-- Modal for Staff Assignment -->
<div class="modal fade" id="staffAssignmentModal" tabindex="-1" aria-labelledby="staffAssignmentModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="staffAssignmentModalLabel">
<i class="fas fa-user-plus me-2"></i> {% trans "Assign Staff Member" %}
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form method="post" action="{% url 'staff_assignment_view' job.slug %}">
{% csrf_token %}
{{staff_form|crispy}}
<div class="d-flex justify-content-end mt-3">
<button type="submit" class="btn btn-main-action">
<i class="fas fa-save me-1"></i> {% trans "Save Assignment" %}
</button>
</div>
</form>
</div>
</div>
</div>
</div>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
@ -223,7 +247,14 @@
{% endif %}
<div class="float-end">
<div class="d-flex align-items-center">
<i class="fas fa-user-tie me-2 text-primary"></i> <strong>{% trans "Assigned to :" %} </strong> {{ job.assigned_to|default:"" }}
{% if job.assigned_to %}
<i class="fas fa-user-tie me-2 text-primary"></i>
<strong> {% trans "Assigned to :" %} </strong> {{ job.assigned_to|default:"" }}
{% else %}
<button type="button" class="btn btn-main-action btn-sm" data-bs-toggle="modal" data-bs-target="#staffAssignmentModal">
<i class="fas fa-user-plus me-1"></i> {% trans "Click To Assign" %}
</button>
{% endif %}
</div>
</div>
</h5>
@ -333,6 +364,9 @@
<a href="{% url 'applications_screening_view' job.slug %}" class="btn btn-main-action">
<i class="fas fa-layer-group me-1"></i> {% trans "Manage Applications" %}
</a>
<a href="{% url 'interview_calendar' job.slug %}" class="btn btn-main-action">
<i class="fas fa-calendar me-1"></i> {% trans "View Calendar" %}
</a>
{% if not job.form_template.is_active %}
{% if not jobzip_created %}
@ -412,31 +446,6 @@
</button>
{% endif %}
<!-- Modal for Staff Assignment -->
<div class="modal fade" id="staffAssignmentModal" tabindex="-1" aria-labelledby="staffAssignmentModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="staffAssignmentModalLabel">
<i class="fas fa-user-plus me-2"></i> {% trans "Assign Staff Member" %}
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form method="post" action="{% url 'staff_assignment_view' job.slug %}">
{% csrf_token %}
{{staff_form|crispy}}
<div class="d-flex justify-content-end mt-3">
<button type="submit" class="btn btn-main-action">
<i class="fas fa-save me-1"></i> {% trans "Save Assignment" %}
</button>
</div>
</form>
</div>
</div>
</div>
</div>
{% if not job.assigned_to %}
<div class="alert alert-info p-2 small mb-0">
<i class="fas fa-info-circle me-1"></i> {% trans "No staff members assigned to this job yet." %}

View File

@ -161,7 +161,7 @@
</a>
</div>
<div class="col-md-4 mb-4">
<a href="{% url "easy_logs" %}" class="text-decoration-none">
<a href="{% url 'easy_logs' %}" class="text-decoration-none">
<div class="kaauh-card shadow-sm p-4 h-100" style="border-left: 5px solid var(--kaauh-teal);">
<div class="d-flex align-items-center">
<i class="fas fa-file-alt fa-3x text-primary-theme me-4"></i>
@ -199,25 +199,44 @@
</div>
<div class="text-end mt-3">
{% if not request.session.linkedin_authenticated %}
<a class="text-decoration-none text-teal" href="{% url 'linkedin_login' %}">
<button class="btn btn-sm btn-outline-secondary">
{% trans "Sign to linkedin" %}<i class="fas fa-arrow-right ms-1"></i>
</button>
</a>
{% else %}
<p class="text-primary">
<i class="fab fa-linkedin me-2"></i>
{% trans "LinkedIn Connected" %}
</p>
{% endif %}
</div>
</div>
</a>
</div>
<div class="col-md-4 mb-4">
<a href="{% url 'job_bank' %}" class="text-decoration-none">
<div class="kaauh-card shadow-sm p-4 h-100" style="border-left: 5px solid var(--kaauh-teal);">
<div class="d-flex align-items-center">
<i class="fas fa-database fa-3x text-primary-theme me-4"></i>
<div>
<h5 class="fw-bold mb-1" style="color: var(--kaauh-teal-dark);">
{% trans "Job Bank" %}
</h5>
<p class="text-muted small mb-0">
{% trans "Store your job postings in our Job Bank to reuse them later." %}
</p>
</div>
</div>
<div class="text-end mt-3">
<button class="btn btn-sm btn-outline-secondary">
{% trans "Go to Job Bank" %}<i class="fas fa-arrow-right ms-1"></i>
</button>
</div>
</div>
</a>
</div>
</div>
{% endblock %}