[UPDT] ONBOARDING: Bulk stage and task stage update for candidates
This commit is contained in:
@@ -1,26 +1,26 @@
|
||||
<select name="task" class="w-100" data-task-id="{{task.id}}" style="
|
||||
border: 1px solid hsl(213deg,22%,84%);
|
||||
padding: 0.3rem 0.8rem 0.3rem 0.3rem;
|
||||
border-radius: 0rem;" hx-post="{% url 'candidate-task-update' task.id %}"
|
||||
hx-trigger="change" hx-target="#task{{task.id}}">
|
||||
{% load i18n %}
|
||||
<select name="task" class="w-100"
|
||||
data-task-id="{{task.id}}" data-candidate-id={{task.candidate_id.id}}
|
||||
data-onboarding-task-id={{task.onboarding_task_id.id}}
|
||||
style="border: 1px solid hsl(213deg,22%,84%);
|
||||
padding: 0.3rem 0.8rem 0.3rem 0.3rem;
|
||||
border-radius: 0rem;"
|
||||
hx-post="{% url 'candidate-task-update' task.id %}"
|
||||
hx-trigger="change" hx-target="#task{{task.id}}"
|
||||
>
|
||||
{% for choice in choices %}
|
||||
{% if choice.0 == task.status %}
|
||||
<option value="{{choice.0}}" selected>{{choice.1}}</option>
|
||||
{% else %}
|
||||
<option value="{{choice.0}}">{{choice.1}}</option>
|
||||
{% endif %}
|
||||
{% if choice.0 == task.status %}
|
||||
<option value="{{choice.0}}" selected>{{choice.1}}</option>
|
||||
{% else %}
|
||||
<option value="{{choice.0}}">{{choice.1}}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("select[name='task']").on("htmx:afterRequest", function(event, xhr, data) {
|
||||
var alertContainer = $('<div class="oh-alert-container">');
|
||||
var alertDiv = $('<div class="oh-alert oh-alert--animated oh-alert--info">').text("Candidate task updated successfully..");
|
||||
|
||||
var alertDiv = $('<div class="oh-alert oh-alert--animated oh-alert--info">').text("{% trans 'Candidate task updated successfully..' %}");
|
||||
alertContainer.append(alertDiv);
|
||||
$(".messages").html(alertContainer);
|
||||
});
|
||||
|
||||
@@ -1,51 +1,73 @@
|
||||
{% load onboardingfilters %} {% load i18n %}
|
||||
{% load onboardingfilters %} {% load i18n %} {% load static %}
|
||||
|
||||
<style>
|
||||
.oh-accordion-meta__body .oh-sticky-table--no-overflow {
|
||||
height:300px;
|
||||
}
|
||||
</style>
|
||||
<script src="{% static 'htmx/htmx.min.js' %}"></script>
|
||||
|
||||
{% for stage in recruitment.onboardingstage_set.all %}
|
||||
|
||||
|
||||
<div class="oh-accordion-meta" >
|
||||
<div class="oh-accordion-meta__item">
|
||||
<div class="oh-accordion-meta__item" id="onboarding_stage{{stage.id}}">
|
||||
<div class="oh-accordion-meta__header oh-accordion-meta__header--show">
|
||||
<div class="d-flex">
|
||||
<span class="oh-badge oh-badge--secondary oh-badge--small oh-badge--round ms-2 mr-2 stage_count" title="{{stage.candidate.count}} {% trans 'Candidate' %}">{{stage.candidate.count}}</span>
|
||||
<span class="oh-accordion-meta__title">{{stage}}</span>
|
||||
</div>
|
||||
|
||||
{% if request.user|stage_manages:stage or perms.onboarding.change_onboardingstage or perms.onboarding.delete_onboardingstage %}
|
||||
<div class="oh-accordion-meta__actions" onclick="event.stopPropagation()">
|
||||
<div class="oh-dropdown" x-data="{open: false}">
|
||||
<button class="oh-btn oh-stop-prop oh-accordion-meta__btn" @click="open = !open"
|
||||
@click.outside="open = false"
|
||||
title="{% trans "Action" %}">
|
||||
{% trans "Actions" %}
|
||||
<ion-icon class="ms-2 oh-accordion-meta__btn-icon" name="caret-down-outline"></ion-icon>
|
||||
</button>
|
||||
<div class="oh-dropdown__menu oh-dropdown__menu--right" x-show="open">
|
||||
<ul class="oh-dropdown__items">
|
||||
{% if request.user|stage_manages:stage or perms.onboarding.change_onboardingstage %}
|
||||
<li class="oh-dropdown__item">
|
||||
<a class="oh-dropdown__link" data-toggle="oh-modal-toggle" data-target="#editModal3"
|
||||
hx-get="{% url 'stage-update' stage.id recruitment.id %}"
|
||||
hx-target="#updateStage">{% trans "Edit" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if request.user|stage_manages:stage or perms.onboarding.delete_onboardingstage %}
|
||||
<li class="oh-dropdown__item">
|
||||
<a href="{% url 'stage-delete' stage.id %}"
|
||||
onclick="return confirm('{% trans "Do you want to delete this stage?" %}')"
|
||||
class="oh-dropdown__link oh-dropdown__link--danger">{% trans "Delete" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<div class="oh-accordion-meta__actions" onclick="event.stopPropagation()">
|
||||
<div class="oh-dropdown" x-data="{open: false}">
|
||||
<button class="oh-btn oh-stop-prop oh-accordion-meta__btn" @click="open = !open"
|
||||
@click.outside="open = false"
|
||||
title="{% trans "Action" %}">
|
||||
{% trans "Actions" %}
|
||||
<ion-icon class="ms-2 oh-accordion-meta__btn-icon" name="caret-down-outline"></ion-icon>
|
||||
</button>
|
||||
<div class="oh-dropdown__menu oh-dropdown__menu--right" x-show="open">
|
||||
<ul class="oh-dropdown__items">
|
||||
{% if request.user|stage_manages:stage or perms.onboarding.change_onboardingstage %}
|
||||
<li class="oh-dropdown__item">
|
||||
<a class="oh-dropdown__link" data-toggle="oh-modal-toggle" data-target="#editModal3"
|
||||
hx-get="{% url 'stage-update' stage.id recruitment.id %}"
|
||||
hx-target="#updateStage">{% trans "Edit" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if request.user|stage_manages:stage or perms.onboarding.change_onboardingstage %}
|
||||
<li class="oh-dropdown__item">
|
||||
<a class="oh-dropdown__link mb-2">{% trans "Bulk Change Stage" %}</a>
|
||||
<select id=""
|
||||
class="w-100 bulkStageChange"
|
||||
style="border: 1px solid hsl(213deg,22%,84%);
|
||||
padding: 0.3rem 0.8rem 0.3rem 0.3rem;
|
||||
border-radius: 0rem;" name="stage"
|
||||
data-stage = "#onboarding_stage{{stage.id}}"
|
||||
data-recruitment = {{recruitment.id}}
|
||||
onchange = "bulkStageChange(this)">
|
||||
{% for on_stage in recruitment.onboardingstage_set.all %}
|
||||
{% if on_stage == stage %}
|
||||
<option value="{{on_stage.id}}" selected>{{on_stage}}</option>
|
||||
{% else %}
|
||||
<option value="{{on_stage.id}}">{{on_stage}}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if request.user|stage_manages:stage or perms.onboarding.delete_onboardingstage %}
|
||||
<li class="oh-dropdown__item">
|
||||
<a href="{% url 'stage-delete' stage.id %}"
|
||||
onclick="return confirm('{% trans "Do you want to delete this stage?" %}')"
|
||||
class="oh-dropdown__link oh-dropdown__link--danger">{% trans "Delete" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="oh-accordion-meta__body onboarding_items">
|
||||
@@ -53,7 +75,18 @@
|
||||
<div class="oh-sticky-table__table">
|
||||
<div class="oh-sticky-table__thead">
|
||||
<div class="oh-sticky-table__tr">
|
||||
<div class="oh-sticky-table__th">{% trans "Candidate" %}</div>
|
||||
<div class="oh-sticky-table__th">
|
||||
<div>
|
||||
<input
|
||||
type="checkbox"
|
||||
class="oh-input payslip-checkbox oh-input__checkbox mt-2 mr-2 select-all"
|
||||
data-stage="#onboarding_stage{{stage.id}}"
|
||||
onclick="event.stopPropagation()"
|
||||
onchange="select_all(this)"
|
||||
/>
|
||||
<span>{% trans "Candidate" %}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Email" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Job Position" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Mobile" %}</div>
|
||||
@@ -62,146 +95,167 @@
|
||||
<div class="oh-sticky-table__th">{% trans "Stage" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Actions" %}</div>
|
||||
{% for task in recruitment.onboarding_task.all %}
|
||||
<div class="oh-sticky-table__th" style="width: 250px;">
|
||||
<div class="d-flex align-items-center justify-content-between">
|
||||
<span title="{{task}}">{{task|truncatechars:20}} </span>
|
||||
{% if request.user|stage_manages:stage or perms.onboarding.change_onboardingtask or perms.onboarding.delete_onboardingtask %}
|
||||
<div class="oh-dropdown" x-data="{open: false}">
|
||||
<button class="oh-btn oh-stop-prop oh-btn--transparent oh-accordion-meta__btn"
|
||||
@click="open = !open" @click.outside="open = false"
|
||||
title="{% trans "Actions" %}">
|
||||
<ion-icon name="ellipsis-vertical"></ion-icon>
|
||||
</button>
|
||||
<div class="oh-dropdown__menu oh-dropdown__menu--right" x-show="open">
|
||||
<ul class="oh-dropdown__items">
|
||||
{% if request.user|stage_manages:stage or perms.onboarding.change_onboardingtask %}
|
||||
<li class="oh-dropdown__item">
|
||||
<a class="oh-dropdown__link" data-toggle="oh-modal-toggle"
|
||||
data-target="#editModal4"
|
||||
hx-get="{% url 'task-update' task.id recruitment.id %}"
|
||||
hx-target="#updateTask">{% trans "Edit" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if request.user|stage_manages:stage or perms.onboarding.delete_onboardingtask %}
|
||||
<li class="oh-dropdown__item">
|
||||
<a class="oh-dropdown__link oh-dropdown__link--danger"
|
||||
href="{% url 'task-delete' task.id %}"
|
||||
onclick="return confirm('Do you want to delete this task?')">{% trans "Delete" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="oh-sticky-table__th" style="width: 250px;">
|
||||
<div class="d-flex align-items-center justify-content-between">
|
||||
<span title="{{task}}">{{task|truncatechars:20}}</span>
|
||||
{% if request.user|stage_manages:stage or perms.onboarding.change_onboardingtask or perms.onboarding.delete_onboardingtask %}
|
||||
<div class="oh-dropdown" x-data="{open: false}">
|
||||
<button class="oh-btn oh-stop-prop oh-btn--transparent oh-accordion-meta__btn"
|
||||
@click="open = !open" @click.outside="open = false"
|
||||
title="{% trans "Actions" %}">
|
||||
<ion-icon name="ellipsis-vertical"></ion-icon>
|
||||
</button>
|
||||
<div class="oh-dropdown__menu oh-dropdown__menu--right" x-show="open" style="text-align:left !important">
|
||||
<ul class="oh-dropdown__items">
|
||||
{% if request.user|stage_manages:stage or perms.onboarding.change_onboardingtask %}
|
||||
<li class="oh-dropdown__item">
|
||||
<a class="oh-dropdown__link" data-toggle="oh-modal-toggle"
|
||||
data-target="#editModal4"
|
||||
hx-get="{% url 'task-update' task.id recruitment.id %}"
|
||||
hx-target="#updateTask">{% trans "Edit" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if request.user|stage_manages:stage or perms.onboarding.change_onboardingstage %}
|
||||
<li class="oh-dropdown__item">
|
||||
<a class="oh-dropdown__link mb-2">{% trans "Bulk Change Task" %}</a>
|
||||
<select id="" class="w-100 bulkTaskChange" style="
|
||||
border: 1px solid hsl(213deg,22%,84%);
|
||||
padding: 0.3rem 0.8rem 0.3rem 0.3rem;
|
||||
border-radius: 0rem;" name="stage"
|
||||
data-task = "{{task.id}}" onchange = "bulkTaskChange(this)">
|
||||
{% for choice in choices %}
|
||||
<option value="{{choice.0}}">{{choice.1}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if request.user|stage_manages:stage or perms.onboarding.delete_onboardingtask %}
|
||||
<li class="oh-dropdown__item">
|
||||
<a class="oh-dropdown__link oh-dropdown__link--danger"
|
||||
href="{% url 'task-delete' task.id %}"
|
||||
onclick="return confirm('Do you want to delete this task?')">{% trans "Delete" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if request.user|stage_manages:stage or perms.onboarding.add_onboardingtask %}
|
||||
<div class="oh-sticky-table__th">
|
||||
<button class="oh-btn oh-btn--small oh-btn--secondary oh-tabs__action-new-table"
|
||||
data-toggle="oh-modal-toggle" data-target="#editModal2"
|
||||
hx-get="{% url 'task-creation' recruitment.id %}" hx-target="#taskForm">
|
||||
<ion-icon class="me-1 md hydrated" name="add-outline" role="img"
|
||||
aria-label="add outline"></ion-icon>{% trans "Task" %}
|
||||
</button>
|
||||
</div>
|
||||
<div class="oh-sticky-table__th">
|
||||
<button class="oh-btn oh-btn--small oh-btn--secondary oh-tabs__action-new-table"
|
||||
data-toggle="oh-modal-toggle" data-target="#editModal2"
|
||||
hx-get="{% url 'task-creation' recruitment.id %}" hx-target="#taskForm">
|
||||
<ion-icon class="me-1 md hydrated" name="add-outline" role="img"
|
||||
aria-label="add outline"></ion-icon>{% trans "Task" %}
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__tbody candidate-container">
|
||||
{% for candidate in stage.candidate.all %}
|
||||
{% if candidate.candidate_id.recruitment_id == recruitment%}
|
||||
<div class="oh-sticky-table__tr oh-multiple-table-sort__movable change-cand"
|
||||
data-candidate-id="{{candidate.candidate_id}}" data-drop="candidate"
|
||||
data-change-cand-id="{{candidate.candidate_id}}"
|
||||
data-candidate="{{candidate.candidate_id}}"
|
||||
data-job-position = "{{candidate.candidate_id.job_position_id}}"
|
||||
data-join-date="{{candidate.candidate_id.joining_date}}"
|
||||
data-portal-count="{{candidate.candidate_id.onboarding_portal.count}}"
|
||||
data-toggle="oh-modal-toggle" data-target="#tableTimeOff"
|
||||
hx-get="{% url 'candidate-single-view' candidate.candidate_id.id %}" hx-target="#singleView"
|
||||
>
|
||||
<div class="oh-sticky-table__sd">
|
||||
<div class="oh-profile oh-profile--md">
|
||||
<div class="oh-profile__avatar mr-1">
|
||||
{% if candidate.candidate_id.profile %}
|
||||
<img src="{{candidate.candidate_id.profile.url}}"
|
||||
class="oh-profile__image" alt="" />
|
||||
{% else %}
|
||||
<img src="https://ui-avatars.com/api/?name={{candidate.candidate_id}}&background=random"
|
||||
class="oh-profile__image" alt="" />
|
||||
{% endif %}
|
||||
</div>
|
||||
<span class="oh-profile__name oh-text--dark">{{candidate.candidate_id}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">{{candidate.candidate_id.email}}</div>
|
||||
<div class="oh-sticky-table__td" >{{candidate.candidate_id.job_position_id}}</div>
|
||||
<div class="oh-sticky-table__td">{{candidate.candidate_id.mobile}}</div>
|
||||
<div class="oh-sticky-table__td" >{{candidate.candidate_id.joining_date}}</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-checkpoint-badge oh-checkpoint-badge--secondary" >
|
||||
{{candidate.candidate_id.onboarding_portal.count}} / 4
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__td" onclick="event.stopPropagation()">
|
||||
{% if request.user|stage_manages:stage or perms.onboarding.change_candidatestage %}
|
||||
<select id="" class="w-100" style="
|
||||
border: 1px solid hsl(213deg,22%,84%);
|
||||
padding: 0.3rem 0.8rem 0.3rem 0.3rem;
|
||||
border-radius: 0rem;" name="stage"
|
||||
hx-post="{% url 'candidate-stage-update' candidate.candidate_id.id recruitment.id %}"
|
||||
hx-trigger="change" hx-target="#onboardingTable{{recruitment.id}}">
|
||||
{% for stage in recruitment.onboardingstage_set.all %}
|
||||
{% if candidate.onboarding_stage_id == stage %}
|
||||
<option value="{{stage.id}}" selected>{{stage}}</option>
|
||||
{% else %}
|
||||
<option value="{{stage.id}}">{{stage}}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% else %}
|
||||
{% for stage in recruitment.onboardingstage_set.all %}
|
||||
{% if candidate.onboarding_stage_id == stage %}
|
||||
{{stage}}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td" onclick="event.stopPropagation()">
|
||||
<div class="oh-kanban__card-actions oh-kanban__dropdown">
|
||||
<button class="oh-btn oh-btn--small oh-btn--transparent oh-kanban__btn oh-kanban__dropdown-toggle" title="{% trans "Actions" %}">
|
||||
<ion-icon name="ellipsis-vertical-sharp" role="img" class="md hydrated" aria-label="ellipsis vertical sharp"></ion-icon>
|
||||
</button>
|
||||
<div class="oh-dropdown oh-kanban__dropdown-menu d-none">
|
||||
<div class="oh-dropdown__menu oh-dropdown__menu--right">
|
||||
<ul class="oh-dropdown__items">
|
||||
<li class="oh-dropdown__item">
|
||||
<a href="#" data-toggle="oh-modal-toggle" data-target="#sendMailModal" hx-get="{% url 'onboarding-send-mail' candidate.candidate_id.id %}" hx-target="#sendMailModalBody" class="oh-dropdown__link">{% trans "Send Mail" %}</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% if candidate.candidate_id.recruitment_id == recruitment%}
|
||||
<div class="oh-sticky-table__tr oh-multiple-table-sort__movable change-cand"
|
||||
data-candidate-id="{{candidate.candidate_id}}" data-drop="candidate"
|
||||
data-change-cand-id="{{candidate.candidate_id}}"
|
||||
data-candidate="{{candidate.candidate_id}}"
|
||||
data-job-position = "{{candidate.candidate_id.job_position_id}}"
|
||||
data-join-date="{{candidate.candidate_id.joining_date}}"
|
||||
data-portal-count="{{candidate.candidate_id.onboarding_portal.count}}"
|
||||
data-toggle="oh-modal-toggle" data-target="#tableTimeOff"
|
||||
hx-get="{% url 'candidate-single-view' candidate.candidate_id.id %}" hx-target="#singleView"
|
||||
>
|
||||
<div class="oh-sticky-table__sd">
|
||||
<div class="oh-profile oh-profile--md">
|
||||
<div>
|
||||
<input
|
||||
type="checkbox"
|
||||
id="{{candidate.candidate_id.id}}"
|
||||
value="{{candidate.candidate_id.id}}"
|
||||
class="oh-input payslip-checkbox oh-input__checkbox mt-2 mr-2 checkbox-row"
|
||||
onclick="event.stopPropagation()"
|
||||
/>
|
||||
</div>
|
||||
<div class="oh-profile__avatar mr-1">
|
||||
{% if candidate.candidate_id.profile %}
|
||||
<img src="{{candidate.candidate_id.profile.url}}"
|
||||
class="oh-profile__image" alt="" />
|
||||
{% else %}
|
||||
<img src="https://ui-avatars.com/api/?name={{candidate.candidate_id}}&background=random"
|
||||
class="oh-profile__image" alt="" />
|
||||
{% endif %}
|
||||
</div>
|
||||
<span class="oh-profile__name oh-text--dark">{{candidate.candidate_id}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% for task in candidate.candidate_id.candidate_task.all %}
|
||||
<div class="oh-sticky-table__td" onclick="event.stopPropagation()" id="task{{task.id}}">
|
||||
{% if request.user|task_manager:task or perms.onboarding.change_candidatetask %}
|
||||
{% include 'onboarding/candidate_task.html' %}
|
||||
{% else %}
|
||||
{% for choice in choices %}
|
||||
{% if choice.0 == task.status %}
|
||||
{{choice.1}}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="oh-sticky-table__td">{{candidate.candidate_id.email}}</div>
|
||||
<div class="oh-sticky-table__td" >{{candidate.candidate_id.job_position_id}}</div>
|
||||
<div class="oh-sticky-table__td">{{candidate.candidate_id.mobile}}</div>
|
||||
<div class="oh-sticky-table__td" >{{candidate.candidate_id.joining_date}}</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-checkpoint-badge oh-checkpoint-badge--secondary" >
|
||||
{{candidate.candidate_id.onboarding_portal.count}} / 4
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__td" onclick="event.stopPropagation()">
|
||||
{% if request.user|stage_manages:stage or perms.onboarding.change_candidatestage %}
|
||||
<select id="" class="w-100" style="
|
||||
border: 1px solid hsl(213deg,22%,84%);
|
||||
padding: 0.3rem 0.8rem 0.3rem 0.3rem;
|
||||
border-radius: 0rem;" name="stage"
|
||||
hx-post="{% url 'candidate-stage-update' candidate.candidate_id.id recruitment.id %}"
|
||||
hx-trigger="change" hx-target="#onboardingTable{{recruitment.id}}">
|
||||
{% for stage in recruitment.onboardingstage_set.all %}
|
||||
{% if candidate.onboarding_stage_id == stage %}
|
||||
<option value="{{stage.id}}" selected>{{stage}}</option>
|
||||
{% else %}
|
||||
<option value="{{stage.id}}">{{stage}}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% else %}
|
||||
{% for stage in recruitment.onboardingstage_set.all %}
|
||||
{% if candidate.onboarding_stage_id == stage %}
|
||||
{{stage}}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td" onclick="event.stopPropagation()">
|
||||
<div class="oh-kanban__card-actions oh-kanban__dropdown">
|
||||
<button class="oh-btn oh-btn--small oh-btn--transparent oh-kanban__btn oh-kanban__dropdown-toggle" title="{% trans "Actions" %}">
|
||||
<ion-icon name="ellipsis-vertical-sharp" role="img" class="md hydrated" aria-label="ellipsis vertical sharp"></ion-icon>
|
||||
</button>
|
||||
<div class="oh-dropdown oh-kanban__dropdown-menu d-none">
|
||||
<div class="oh-dropdown__menu oh-dropdown__menu--right">
|
||||
<ul class="oh-dropdown__items">
|
||||
<li class="oh-dropdown__item">
|
||||
<a href="#" data-toggle="oh-modal-toggle" data-target="#sendMailModal" hx-get="{% url 'onboarding-send-mail' candidate.candidate_id.id %}" hx-target="#sendMailModalBody" class="oh-dropdown__link">{% trans "Send Mail" %}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% for task in candidate.candidate_id.candidate_task.all %}
|
||||
<div class="oh-sticky-table__td" onclick="event.stopPropagation()" id="task{{task.id}}">
|
||||
{% if request.user|task_manager:task or perms.onboarding.change_candidatetask %}
|
||||
{% include 'onboarding/candidate_task.html' %}
|
||||
{% else %}
|
||||
{% for choice in choices %}
|
||||
{% if choice.0 == task.status %}
|
||||
{{choice.1}}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -212,12 +266,50 @@
|
||||
{% endfor %}
|
||||
|
||||
<script>
|
||||
|
||||
function bulkTaskChange(element){
|
||||
let NewStatus = $(element).val();
|
||||
let Task = $(element).data("task");
|
||||
let checkbox = $("input[type='checkbox']:checked")
|
||||
let ids =[]
|
||||
checkbox.each(function(index){
|
||||
ids.push(parseInt($(this).val()))
|
||||
})
|
||||
|
||||
ids=ids.filter(value => !isNaN(value))
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/onboarding/candidate-task-bulk-update',
|
||||
data: {
|
||||
"ids": JSON.stringify(ids),
|
||||
"task": Task,
|
||||
"status": NewStatus,
|
||||
csrfmiddlewaretoken: getCookie("csrftoken"),
|
||||
|
||||
},
|
||||
success: function (response) {
|
||||
for (let i of ids) {
|
||||
var tasks = $(`[data-onboarding-task-id=${Task}][data-candidate-id=${i}]`);
|
||||
tasks.val(NewStatus);
|
||||
}
|
||||
var alertContainer = $('<div class="oh-alert-container">');
|
||||
var message = "{% trans 'Candidates stage updated successfully...' %}"
|
||||
var alertDiv = $('<div class="oh-alert oh-alert--animated oh-alert--info">').text(`${ids.length} ${message}`);
|
||||
alertContainer.append(alertDiv);
|
||||
$(".messages").html(alertContainer);
|
||||
},
|
||||
error: () => {
|
||||
console.log("error")
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
$("select[name='stage']").on("htmx:afterRequest", function(event, xhr, data) {
|
||||
var alertContainer = $('<div class="oh-alert-container">');
|
||||
var alertDiv = $('<div class="oh-alert oh-alert--animated oh-alert--info">').text("Candidate stage updated successfully..");
|
||||
var alertDiv = $('<div class="oh-alert oh-alert--animated oh-alert--info">').text("{% trans 'Candidate task stage updated successfully..' %}")
|
||||
|
||||
alertContainer.append(alertDiv);
|
||||
$(".messages").html(alertContainer);
|
||||
|
||||
@@ -311,6 +311,44 @@
|
||||
|
||||
|
||||
<script>
|
||||
function bulkStageChange(element){
|
||||
let NewStage = $(element).val();
|
||||
let currentStage =$(element).data("stage")
|
||||
let checkbox = $(currentStage).find("input[type='checkbox']:checked");
|
||||
let ids =[]
|
||||
let recruitment = $(element).data("recruitment")
|
||||
let target = "#onboardingTable"+recruitment
|
||||
checkbox.each(function(index){
|
||||
ids.push(parseInt($(this).val()))
|
||||
})
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/onboarding/candidate-stage-bulk-update',
|
||||
data: {
|
||||
"ids": JSON.stringify(ids),
|
||||
"stage": NewStage,
|
||||
"recruitment": recruitment,
|
||||
|
||||
csrfmiddlewaretoken: getCookie("csrftoken"),
|
||||
|
||||
},
|
||||
success: function (response) {
|
||||
$(target).html($(response))
|
||||
},
|
||||
error: () => {
|
||||
console.log("error")
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
function select_all(element) {
|
||||
let isChecked = $(element).prop("checked");
|
||||
let stage = $(element).data("stage");
|
||||
$(stage).find('.checkbox-row').prop("checked", isChecked);
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#search").on("htmx:afterRequest", function(event, xhr, data) {
|
||||
|
||||
|
||||
@@ -41,6 +41,9 @@ urlpatterns = [
|
||||
views.candidate_stage_update,
|
||||
name="candidate-stage-update",
|
||||
),
|
||||
path("candidate-stage-bulk-update", views.candidate_stage_bulk_update, name="candidate-stage-bulk-update"),
|
||||
path("candidate-task-bulk-update", views.candidate_task_bulk_update, name="candidate-task-bulk-update"),
|
||||
|
||||
path(
|
||||
"stage-name-update/<int:stage_id>/",
|
||||
views.stage_name_update,
|
||||
|
||||
@@ -1020,6 +1020,61 @@ def candidate_stage_update(request, candidate_id, recruitment_id):
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
@require_http_methods(["POST"])
|
||||
@stage_manager_can_enter("onboarding.change_candidatestage")
|
||||
def candidate_stage_bulk_update(request):
|
||||
candiate_ids = request.POST["ids"]
|
||||
recrutment_id = request.POST["recruitment"]
|
||||
candidate_id_list = json.loads(candiate_ids)
|
||||
stage = request.POST["stage"]
|
||||
onboarding_stages = OnboardingStage.objects.all()
|
||||
recruitment = Recruitment.objects.get(id=int(recrutment_id))
|
||||
choices = CandidateTask.choice
|
||||
|
||||
count = CandidateStage.objects.filter(candidate_id__id__in=candidate_id_list).update(onboarding_stage_id = stage)
|
||||
# messages.success(request,f"{count} candidate's stage updated successfully")
|
||||
# return render(
|
||||
# request,
|
||||
# "onboarding/onboarding_table.html",
|
||||
# {
|
||||
# "recruitment": recruitment,
|
||||
# "onboarding_stages": onboarding_stages,
|
||||
# "choices": choices,
|
||||
# },
|
||||
# )
|
||||
response = render(
|
||||
request,
|
||||
"onboarding/onboarding_table.html",
|
||||
{
|
||||
"recruitment": recruitment,
|
||||
"onboarding_stages": onboarding_stages,
|
||||
"choices": choices,
|
||||
},
|
||||
)
|
||||
|
||||
return HttpResponse(
|
||||
response.content.decode("utf-8") + '<div><div class="oh-alert-container"><div class="oh-alert oh-alert--animated oh-alert--info">candidate stage updated successfully</div> </div></div>'
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
@require_http_methods(["POST"])
|
||||
@all_manager_can_enter("onboarding.change_candidatetask")
|
||||
def candidate_task_bulk_update(request):
|
||||
candiate_ids = request.POST["ids"]
|
||||
candidate_id_list = json.loads(candiate_ids)
|
||||
task = request.POST["task"]
|
||||
status = request.POST["status"]
|
||||
|
||||
count = CandidateTask.objects.filter(candidate_id__id__in=candidate_id_list,onboarding_task_id = task).update(status=status)
|
||||
# messages.success(request,f"{count} candidate's task status updated successfully")
|
||||
|
||||
return JsonResponse(
|
||||
{"message": _("Candidate onboarding stage updated"), "type": "success"}
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
def hired_candidate_chart(_):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user