Files
ihrm/recruitment/templates/pipeline/pipeline_components/schedule_interview_update.html

47 lines
1.3 KiB
HTML

{% load i18n %}
<form
hx-post='{% url "edit-interview" interview_id %}'
hx-target="#createTarget"
hx-encoding="multipart/form-data"
id="skillform"
>
{{form.as_p}}
</form>
<script>
$("#skillform .col-md-6").toggleClass("col-md-6");
$(document).ready(function(){
var candidate_id = $('[name=candidate_id]').val();
var selectedmanagers = $('[name=employee_id]').val();
// Make AJAX request to fetch available job positions for the selected department
$.ajax({
url: '{% url "get_managers" %}',
method: 'GET',
data: {
'cand_id': candidate_id
},
success: function(data) {
// Clear existing options in the Job Position dropdown
$('[name=employee_id]').empty();
// Append new options based on the response
$.each(data.employees, function(key, value) {
$('[name=employee_id]').append($('<option>', {
value: key,
text: value
}));
});
// Set the selected job position back to the dropdown
if (selectedmanagers) {
$('[name=employee_id]').val(selectedmanagers);
}
}
});
})
</script>