[UPDT] RECRUITMENT: Updated the candidate view by adding a new status field, a banner in card view and easy filter option for converted candidates

This commit is contained in:
Horilla
2024-12-07 15:13:37 +05:30
parent 6ab5607e7e
commit 991810f1ae
7 changed files with 60 additions and 1 deletions

View File

@@ -130,6 +130,7 @@ class CandidateFilter(FilterSet):
"gender",
"start_onboard",
"hired",
"converted",
"canceled",
"is_active",
"recruitment_id__company_id",

View File

@@ -425,6 +425,7 @@ class Candidate(HorillaModel):
start_onboard = models.BooleanField(default=False, verbose_name=_("Start Onboard"))
hired = models.BooleanField(default=False, verbose_name=_("Hired"))
canceled = models.BooleanField(default=False, verbose_name=_("Canceled"))
converted = models.BooleanField(default=False, verbose_name=_("Converted"))
joining_date = models.DateField(
blank=True, null=True, verbose_name=_("Joining Date")
)
@@ -591,6 +592,10 @@ class Candidate(HorillaModel):
):
raise ValidationError(_("Employee is uniques for candidate"))
if self.converted:
self.hired = False
self.canceled = False
super().save(*args, **kwargs)
class Meta:

View File

@@ -24,7 +24,25 @@ def recruitment_close():
rec.save()
def candidate_convert():
from django.contrib.auth.models import User
from recruitment.models import Candidate
candidates = Candidate.objects.filter(is_active=True)
mails = list(Candidate.objects.values_list("email", flat=True))
existing_emails = list(
User.objects.filter(username__in=mails).values_list("email", flat=True)
)
for cand in candidates:
if cand.email in existing_emails:
cand.converted = True
cand.save()
scheduler = BackgroundScheduler()
scheduler.add_job(candidate_convert, "interval", seconds=10)
scheduler.add_job(recruitment_close, "interval", hours=1)
scheduler.start()

View File

@@ -23,6 +23,8 @@
row-status--red
{% elif cand.hired == True %}
row-status--yellow
{% elif cand.converted == True %}
row-status--blue
{% elif cand.hired == False %}
row-status--purple
{% endif %}
@@ -38,6 +40,27 @@
href="{% url 'candidate-view-individual' cand.id %}"
style="color: inherit; text-decoration: none; display: flex"
>
{% if cand.email in emp_list %}
<!-- Angled Banner Styled to Fit the Card -->
<div
class="banner-container fw-bold"
style=" position: absolute;
top: 15px;
right: -8px;
transform: rotate(48deg);
background-color: #40ac40;
color: white;
padding: 13px 38px;
font-size: 12px;
z-index: 2;
clip-path: polygon(28% 0, 117% 0, 91% 101%, 0 100%);
text-align: center;"
>
<span style="font-weight: bold;">{% trans "Converted" %}</span>
</div>
{% endif %}
<div class="oh-kanban-card__avatar">
<div class="oh-kanban-card__profile-container">
<img

View File

@@ -72,6 +72,7 @@
<div class="oh-sticky-table__tr ui-sortable-handle">
<div class="oh-sticky-table__sd {% if cand.canceled %} row-status--red
{% elif cand.hired %} row-status--yellow
{% elif cand.converted %} row-status--blue
{% else %} row-status--purple
{% endif %}">
<div class="centered-div">
@@ -142,9 +143,12 @@
style="padding:0.8rem 1rem"
>
<ion-icon name="person-circle-outline"></ion-icon></a>
{% else %}
{% elif cand.email in emp_list %}
<button class="oh-btn oh-btn--light-bkg w-100" title='{% trans "Converted " %}' style="opacity: 30%; padding:0.8rem 1rem" disabled>
<ion-icon name="person-circle-outline"></ion-icon></button>
{% else %}
<button class="oh-btn oh-btn--light-bkg w-100" title='{% trans "Candidate in Onboarding " %}' style="opacity: 30%; padding:0.8rem 1rem" disabled>
<ion-icon name="person-circle-outline"></ion-icon></button>
{% endif %}
{% if cand.email in emp_list %}
<button class="oh-btn oh-btn--light-bkg w-100" title='{% trans "Candidate is Converted " %}' style="opacity: 30%; padding:0.8rem 1rem">

View File

@@ -49,6 +49,10 @@
<span class="oh-dot oh-dot--small me-1" style="background-color:yellowgreen"></span>
{% trans "Hired" %}
</span>
<span class="m-1" onclick="$('[name=converted]').val('true');$('[name=hired]').val('unknown'); $('[name=converted]').first().change(); $('.filterButton').click()" style="cursor: pointer;margin-left: 5px;">
<span class="oh-dot oh-dot--small me-1" style="background-color:blue"></span>
{% trans "Converted" %}
</span>
</div>
<div id="section" hx-target="#section" hx-swap="innerHTML">

View File

@@ -31,6 +31,10 @@
<label class="oh-label">{% trans "Reject Reason" %}</label>
{{f.form.rejected_candidate__reject_reason_id}}
</div>
<div class="oh-input-group">
<label class="oh-label">{% trans 'Is Converted' %}?</label>
{{ f.form.converted }}
</div>
</div>
</div>
<div class="col-sm-12 col-md-12 col-lg-6">