[UPDT] RECRUITMENT: Selection on the group by candidates updated
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{% load attendancefilters %} {% load basefilters %} {% load static %}
|
||||
{% load attendancefilters recruitmentfilters %} {% load basefilters %} {% load static %}
|
||||
{% load i18n %} {% include 'filter_tags.html' %}
|
||||
|
||||
<div class="oh-checkpoint-badge text-success mb-2" id="selectAllInstances" style="cursor: pointer;">
|
||||
@@ -38,8 +38,8 @@
|
||||
<div class="oh-sticky-table__th" style="width:10px;">
|
||||
<div class="centered-div" align="center">
|
||||
<input type="checkbox" class="oh-input oh-input__checkbox group-select"
|
||||
onchange="$(this).closest('.oh-sticky-table').find('.candidate-checkbox').prop('checked',$(this).is(':checked')).change();"
|
||||
title="Select All" />
|
||||
onchange="$(this).closest('.oh-sticky-table').find('.candidate-checkbox').prop('checked',$(this).is(':checked')).change();"
|
||||
title="Select All" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__th" hx-target='#section' hx-get="{% url 'search-candidate' %}?{{pd}}&orderby=name&view=list">{% trans "Candidates" %}</div>
|
||||
@@ -48,7 +48,7 @@
|
||||
<div class="oh-sticky-table__th">{% trans "Recruitment" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Job Position" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Resume" %}</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Options" %}</div>
|
||||
<div class="oh-sticky-table__th" style="width: 230px;">{% trans "Options" %}</div>
|
||||
<div class="oh-sticky-table__th oh-sticky-table__right" style="width: 190px;">{% trans "Actions" %}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -64,10 +64,7 @@
|
||||
<input
|
||||
type="checkbox"
|
||||
id="{{cand.id}}"
|
||||
onchange="highlightRow($(this));
|
||||
if (!$(this).is(':checked')) {
|
||||
$(this).closest('.oh-sticky-table').find('.group-select').prop('checked',false)
|
||||
}"
|
||||
onchange="highlightRow($(this));"
|
||||
class="oh-input candidate-checkbox oh-input__checkbox all-candidate-row"
|
||||
/>
|
||||
</div>
|
||||
@@ -96,40 +93,7 @@
|
||||
<a style="color: inherit;text-decoration: none;" class="oh-sticky-table__td" href="/media/{{cand.resume}}"
|
||||
target="_blank" rel="noopener noreferrer"><span class="oh-btn oh-btn--info"> {% trans "Resume" %}</span>
|
||||
</a>
|
||||
{% comment %} <div href="#" style="color: inherit;text-decoration: none;" class="oh-sticky-table__td">
|
||||
<div class="oh-btn-group">
|
||||
{% if perms.recruitment.change_candidate %}
|
||||
<a href="{% url 'rec-candidate-update' cand.id %}" hx-target='#updateFormContainer' hx-swap='innerHTML'
|
||||
class="oh-btn oh-btn--light-bkg w-50" title="Edit"><ion-icon name="create-outline"></ion-icon>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if perms.recruitment.delete_candidate %}
|
||||
{% if cand.is_active %}
|
||||
<form action="{% url 'rec-candidate-archive' cand.id %}"title="Archive" onsubmit="return confirm('{% trans "Do you want to archive this candidate" %}')" method='post'
|
||||
class="w-50">
|
||||
{% csrf_token %}
|
||||
<button type='submit' class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100"
|
||||
><ion-icon name="archive" title="Archive"></ion-icon></button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form action="{% url 'rec-candidate-archive' cand.id %}" title="Un Archive" onsubmit="return confirm('{% trans "Do you want to un-archive this candidate" %}')" method='post'
|
||||
class="w-50">
|
||||
{% csrf_token %}
|
||||
<button type='submit' class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100"
|
||||
><ion-icon name="archive"></ion-icon></button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if perms.recruitment.delete_candidate %}
|
||||
<form action="{% url 'rec-candidate-delete' cand.id %}" onsubmit="return confirm('{% trans "Do you want to delete this candidate" %}')" method='post'
|
||||
onsubmit="Are you sure want to delete this candidate?" class="w-50">
|
||||
{% csrf_token %}
|
||||
<button type='submit' class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100"
|
||||
title="Remove"><ion-icon name="trash-outline"></ion-icon></button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div> {% endcomment %}
|
||||
|
||||
<div class="oh-sticky-table__td">
|
||||
{% if perms.recruitment.change_candidate %}
|
||||
<div class="oh-btn-group">
|
||||
@@ -138,7 +102,7 @@
|
||||
<ion-icon name="person-circle-outline"></ion-icon> </button>
|
||||
{% else %}
|
||||
<a href="{% url 'candidate-conversion' cand.id %}"
|
||||
onsubmit="return confirm('{% trans "Are you sure you want to convert this candidate into an employee?" %}')"
|
||||
onclick="return confirm('{% trans "Are you sure you want to convert this candidate into an employee?" %}')"
|
||||
class="oh-btn oh-btn--light-bkg w-100"
|
||||
title='{% trans "To employee " %}'
|
||||
style="padding:0.8rem 1rem"
|
||||
@@ -154,6 +118,23 @@
|
||||
>
|
||||
<ion-icon name="heart-circle-outline"></ion-icon>
|
||||
</button>
|
||||
{% if perms.recruitment.add_rejectedcandidate or request.user|is_stagemanager %}
|
||||
<button
|
||||
type="button"
|
||||
class="oh-btn oh-btn--light-bkg w-100"
|
||||
hx-get="{% url 'add-to-rejected-candidates' %}?candidate_id={{cand.id}}"
|
||||
hx-target="#createTarget"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#createModal"
|
||||
{% if cand.is_offer_rejected %}
|
||||
style="background: #ff4500a3 !important; color: white;"
|
||||
title="{% trans "Added In Rejected Candidates" %}"
|
||||
{% else %}
|
||||
title="{% trans "Add To Rejected Candidates" %}"
|
||||
{% endif %}>
|
||||
<ion-icon name="thumbs-down-outline"></ion-icon>
|
||||
</button>
|
||||
{% endif %}
|
||||
<button
|
||||
type="button"
|
||||
hx-get='{% url "send-mail" cand.id %}'
|
||||
@@ -260,21 +241,137 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
$("#allCandidate").click(function (e) {
|
||||
var is_checked = $(this).is(":checked");
|
||||
if (is_checked) {
|
||||
$(".all-candidate-row").prop("checked", true);
|
||||
} else {
|
||||
$(".all-candidate-row").prop("checked", false);
|
||||
var archive_CanMessages = {
|
||||
ar: "هل ترغب حقًا في أرشفة جميع المرشحين المحددين؟",
|
||||
de: "Möchten Sie wirklich alle ausgewählten Kandidaten archivieren?",
|
||||
es: "¿Realmente deseas archivar a todos los candidatos seleccionados?",
|
||||
en: "Do you really want to archive all the selected candidates?",
|
||||
fr: "Voulez-vous vraiment archiver tous les candidats sélectionnés?",
|
||||
};
|
||||
|
||||
var unarchive_CanMessages = {
|
||||
ar: "هل ترغب حقًا في إلغاء أرشفة جميع المرشحين المحددين؟",
|
||||
de: "Möchten Sie wirklich alle ausgewählten Kandidaten aus der Archivierung nehmen?",
|
||||
es: "¿Realmente deseas desarchivar a todos los candidatos seleccionados?",
|
||||
en: "Do you really want to unarchive all the selected candidates?",
|
||||
fr: "Voulez-vous vraiment désarchiver tous les candidats sélectionnés?",
|
||||
};
|
||||
|
||||
var delete_CanMessages = {
|
||||
ar: "هل ترغب حقًا في حذف جميع المرشحين المحددين؟",
|
||||
de: "Möchten Sie wirklich alle ausgewählten Kandidaten löschen?",
|
||||
es: "¿Realmente deseas eliminar a todos los candidatos seleccionados?",
|
||||
en: "Do you really want to delete all the selected candidates?",
|
||||
fr: "Voulez-vous vraiment supprimer tous les candidats sélectionnés?",
|
||||
};
|
||||
|
||||
var noRowMessages = {
|
||||
ar: "لم يتم تحديد أي صفوف.",
|
||||
de: "Es wurden keine Zeilen ausgewählt.",
|
||||
es: "No se han seleccionado filas.",
|
||||
en: "No rows have been selected.",
|
||||
fr: "Aucune ligne n'a été sélectionnée.",
|
||||
};
|
||||
|
||||
var rowMessages = {
|
||||
ar: " تم الاختيار",
|
||||
de: " Ausgewählt",
|
||||
es: " Seleccionado",
|
||||
en: " Selected",
|
||||
fr: " Sélectionné",
|
||||
};
|
||||
function makeListUnique1(list) {
|
||||
return Array.from(new Set(list));
|
||||
}
|
||||
function arrayDifference(arr1, arr2) {
|
||||
return arr1.filter(element => !arr2.includes(element));
|
||||
}
|
||||
|
||||
function removeElementFromArray(array, elementToRemove) {
|
||||
const indexToRemove = array.indexOf(elementToRemove);
|
||||
|
||||
if (indexToRemove !== -1) {
|
||||
array.splice(indexToRemove, 1);
|
||||
}
|
||||
addingCandidateIds();
|
||||
return array
|
||||
}
|
||||
function addingCandidateIds() {
|
||||
var ids = JSON.parse($("#selectedInstances").attr("data-ids") || "[]");
|
||||
var domNotCheckedIds = []
|
||||
|
||||
var selectedCount = 0;
|
||||
|
||||
$(".all-candidate-row:checked").each(function () {
|
||||
ids.push(this.id);
|
||||
});
|
||||
|
||||
$.each($(".candidate-checkbox:checked").not(), function (indexInArray, valueOfElement) {
|
||||
domNotCheckedIds.push($(valueOfElement).attr("id"))
|
||||
});
|
||||
|
||||
ids = makeListUnique1(ids);
|
||||
ids = arrayDifference(ids, domNotCheckedIds)
|
||||
var selectedCount = ids.length;
|
||||
}
|
||||
|
||||
function tickCandidateCheckboxes() {
|
||||
var ids = JSON.parse($("#selectedInstances").attr("data-ids") || "[]");
|
||||
var uniqueIds = makeListUnique1(ids);
|
||||
$.each(uniqueIds, function (indexInArray, valueOfElement) {
|
||||
checkbox = $("#" + valueOfElement)
|
||||
checkbox.prop("checked", true).change()
|
||||
});
|
||||
|
||||
addingCandidateIds()
|
||||
}
|
||||
|
||||
function updateCount() {
|
||||
var ids = makeListUnique1(JSON.parse($("#selectedInstances").attr("data-ids") || "[]"));
|
||||
$("#unselectAllInstances, #selectedCandidate, #exportCandidates").hide();
|
||||
if (ids.length) {
|
||||
$("#unselectAllInstances, #selectedCandidate, #exportCandidates").show();
|
||||
$("#selectedCandidate").text("{% trans "Selected" %}" + " -" + ids.length);
|
||||
}
|
||||
}
|
||||
|
||||
$(".all-candidate-row").change(function (e) {
|
||||
var ids = JSON.parse($("#selectedInstances").attr("data-ids") || "[]");
|
||||
if ($(this).is(":checked")) {
|
||||
ids.push($(this).attr("id"))
|
||||
$("#selectedInstances").attr("data-ids", JSON.stringify(makeListUnique1(ids)));
|
||||
} else {
|
||||
$(".group-select").prop("checked",false)
|
||||
$("#selectedInstances").attr("data-ids", JSON.stringify(makeListUnique1(removeElementFromArray(ids, this.id))));
|
||||
}
|
||||
updateCount()
|
||||
});
|
||||
|
||||
$(".all-candidate-row").change(function () {
|
||||
addingCandidateIds();
|
||||
});
|
||||
|
||||
function getCurrentLanguageCode(callback) {
|
||||
var languageCode = $("#main-section-data").attr("data-lang");
|
||||
var allowedLanguageCodes = ["ar", "de", "es", "en", "fr"];
|
||||
if (allowedLanguageCodes.includes(languageCode)) {
|
||||
callback(languageCode);
|
||||
} else {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/employee/get-language-code/",
|
||||
success: function (response) {
|
||||
var ajaxLanguageCode = response.language_code;
|
||||
$("#main-section-data").attr("data-lang", ajaxLanguageCode);
|
||||
callback(
|
||||
allowedLanguageCodes.includes(ajaxLanguageCode)
|
||||
? ajaxLanguageCode
|
||||
: "en"
|
||||
);
|
||||
},
|
||||
error: function () {
|
||||
callback("en");
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
var excelMessages = {
|
||||
@@ -288,17 +385,6 @@
|
||||
var uniqueIds = makeListUnique1(ids);
|
||||
var selectedCount = uniqueIds.length;
|
||||
var message1 = rowMessages[languageCode];
|
||||
if (selectedCount > 0) {
|
||||
$("#exportCandidates").css("display", "inline-flex");
|
||||
$("#selectedCandidate").text(selectedCount + " -" + message1);
|
||||
$("#unselectAllInstances").css("display", "inline-flex");
|
||||
$("#selectedCandidate").css("display", "inline-flex");
|
||||
} else {
|
||||
$("#exportCandidates").css("display", "none");
|
||||
$("#selectedCandidate").css("display", "none");
|
||||
$("#unselectAllInstances").css("display", "none");
|
||||
|
||||
}
|
||||
$("#selectAllInstances").click(function () {
|
||||
$("#selectedInstances").attr("data-clicked", 1);
|
||||
var savedFilters = JSON.parse(localStorage.getItem("savedFilters"));
|
||||
@@ -311,19 +397,18 @@
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
var employeeIds = response.employee_ids;
|
||||
var selectedCount = employeeIds.length;
|
||||
var selectedCount = employeeIds.length;
|
||||
|
||||
var selectedCount = employeeIds.length;
|
||||
|
||||
var selectedCount = employeeIds.length;
|
||||
|
||||
var selectedCount = employeeIds.length;
|
||||
|
||||
for (var i = 0; i < employeeIds.length; i++) {
|
||||
var empId = employeeIds[i];
|
||||
$("#" + empId).prop("checked", true);
|
||||
$("#" + empId).prop("checked", true).change();
|
||||
}
|
||||
var previousIds = $("#selectedInstances").attr("data-ids")
|
||||
$("#selectedInstances").attr("data-ids", JSON.stringify(Array.from(new Set([...employeeIds,...JSON.parse(previousIds)]))));
|
||||
count = makeListUnique1(employeeIds);
|
||||
tickCandidateCheckboxes(count);
|
||||
$("#selectedInstances").attr("data-ids", JSON.stringify(Array.from(new Set([...employeeIds, ...JSON.parse(previousIds)]))));
|
||||
tickCandidateCheckboxes();
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error("Error:", error);
|
||||
@@ -346,8 +431,6 @@
|
||||
"data-ids",
|
||||
JSON.stringify(employeeIds)
|
||||
);
|
||||
count = makeListUnique1(employeeIds);
|
||||
tickCandidateCheckboxes(count);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error("Error:", error);
|
||||
@@ -356,30 +439,9 @@
|
||||
}
|
||||
});
|
||||
$("#unselectAllInstances").click(function () {
|
||||
$("#selectedInstances").attr("data-clicked", 0);
|
||||
$.ajax({
|
||||
url: '{% url "candidate-select" %}',
|
||||
data: { page: "unselect", filter: "{}" },
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
var employeeIds = response.employee_ids;
|
||||
for (var i = 0; i < employeeIds.length; i++) {
|
||||
var empId = employeeIds[i];
|
||||
$("#" + empId).prop("checked", false);
|
||||
$("#allCandidate").prop("checked", false);
|
||||
}
|
||||
var ids = JSON.parse($("#selectedInstances").attr("data-ids") || "[]");
|
||||
var uniqueIds = makeListUnique(ids);
|
||||
toggleHighlight(uniqueIds);
|
||||
$("#selectedInstances").attr("data-ids", JSON.stringify([]));
|
||||
count = [];
|
||||
tickCandidateCheckboxes(count);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error("Error:", error);
|
||||
},
|
||||
});
|
||||
$("#selectedInstances").attr("data-ids", "[]");
|
||||
tickCandidateCheckboxes()
|
||||
$(".all-candidate-row").prop("checked", false).change()
|
||||
});
|
||||
$("#exportCandidates").click(function (e) {
|
||||
var currentDate = new Date().toISOString().slice(0, 10);
|
||||
@@ -430,12 +492,12 @@
|
||||
});
|
||||
});
|
||||
// toggle columns //
|
||||
toggleColumns("candidate-toggle-table","CandidateCells")
|
||||
toggleColumns("candidate-toggle-table", "CandidateCells")
|
||||
localStorageCandidateCells = localStorage.getItem("candidate_toggle_tab")
|
||||
if (!localStorageCandidateCells) {
|
||||
$("#CandidateCells").find("[type=checkbox]").prop("checked",true)
|
||||
$("#CandidateCells").find("[type=checkbox]").prop("checked", true)
|
||||
}
|
||||
$("[type=checkbox]").change()
|
||||
</script>
|
||||
|
||||
|
||||
updateCount()
|
||||
tickCandidateCheckboxes()
|
||||
</script>
|
||||
Reference in New Issue
Block a user