| 3468 |
eleazar |
1 |
<?php
|
| 1709 |
eleazar |
2 |
$acl = $this->viewModel()->getRoot()->getVariable('acl');
|
|
|
3 |
$currentUser = $this->currentUserHelper();
|
|
|
4 |
$roleName = $currentUser->getUserTypeId();
|
|
|
5 |
|
| 7957 |
eleazar |
6 |
$routeIndex = $this->url('recruitment-and-selection/interview/form');
|
| 7961 |
eleazar |
7 |
$routeAdd = $this->url('recruitment-and-selection/interview/form/add', ['vacancy_uuid' => 'UUID_PLACEHOLDER']);
|
| 3573 |
eleazar |
8 |
$routeVacancy = $this->url('recruitment-and-selection/interview/vacancy', ['vacancy_uuid' => 'UUID_PLACEHOLDER']);
|
| 4367 |
eleazar |
9 |
$routeType = $this->url('recruitment-and-selection/interview/type', ['candidate_uuid' => 'UUID_PLACEHOLDER']);
|
| 1877 |
eleazar |
10 |
|
| 1827 |
eleazar |
11 |
$allowAdd = $acl->isAllowed($roleName, 'recruitment-and-selection/interview/form/add') ? 1 : 0;
|
| 3533 |
eleazar |
12 |
$allowEdit = $acl->isAllowed($roleName, 'recruitment-and-selection/interview/form/edit') ? 1 : 0;
|
|
|
13 |
$allowDelete = $acl->isAllowed($roleName, 'recruitment-and-selection/interview/form/delete') ? 1 : 0;
|
| 3534 |
eleazar |
14 |
$allowReport = $acl->isAllowed($roleName, 'recruitment-and-selection/interview/report') ? 1 : 0;
|
| 8781 |
eleazar |
15 |
$allowFile = $acl->isAllowed($roleName, 'recruitment-and-selection/interview/file') ? 1 : 0;
|
| 16822 |
efrain |
16 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));
|
|
|
17 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.js'));
|
| 1709 |
eleazar |
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
|
| 16822 |
efrain |
23 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/ckeditor/ckeditor.js'));
|
| 1709 |
eleazar |
24 |
|
| 16929 |
efrain |
25 |
|
|
|
26 |
|
|
|
27 |
|
| 16822 |
efrain |
28 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.css'));
|
|
|
29 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.css'));
|
| 1709 |
eleazar |
30 |
|
| 16822 |
efrain |
31 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net/jquery.dataTables.js'));
|
|
|
32 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.js'));
|
|
|
33 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/dataTables.responsive.min.js'));
|
|
|
34 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.min.js'));
|
| 1709 |
eleazar |
35 |
|
|
|
36 |
|
| 16929 |
efrain |
37 |
|
|
|
38 |
|
|
|
39 |
|
| 16822 |
efrain |
40 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
|
|
|
41 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
|
| 1709 |
eleazar |
42 |
|
|
|
43 |
|
| 1887 |
eleazar |
44 |
|
| 2746 |
eleazar |
45 |
|
| 16822 |
efrain |
46 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/moment/moment-with-locales.min.js'));
|
|
|
47 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css'));
|
|
|
48 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js'));
|
| 1709 |
eleazar |
49 |
|
| 16822 |
efrain |
50 |
|
|
|
51 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/select2/js/select2.js'));
|
|
|
52 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/select2/js/i18n/es.js'));
|
|
|
53 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/select2/css/select2.css'));
|
|
|
54 |
|
| 16927 |
efrain |
55 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/select2-bootstrap5-theme/select2-bootstrap-5-theme.css'));
|
| 16822 |
efrain |
56 |
|
| 2052 |
eleazar |
57 |
// JsRender //
|
| 16822 |
efrain |
58 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jsrender/jsrender.min.js'));
|
| 1709 |
eleazar |
59 |
|
| 4158 |
eleazar |
60 |
$status_acepted = \LeadersLinked\Model\RecruitmentSelectionInterview::STATUS_ACCEPTED;
|
| 4157 |
eleazar |
61 |
$status_rejected = \LeadersLinked\Model\RecruitmentSelectionInterview::STATUS_REJECTED;
|
| 2510 |
eleazar |
62 |
|
|
|
63 |
$points_0 = \LeadersLinked\Model\RecruitmentSelectionInterview::POINTS_0;
|
|
|
64 |
$points_1 = \LeadersLinked\Model\RecruitmentSelectionInterview::POINTS_1;
|
|
|
65 |
$points_2 = \LeadersLinked\Model\RecruitmentSelectionInterview::POINTS_2;
|
|
|
66 |
$points_3 = \LeadersLinked\Model\RecruitmentSelectionInterview::POINTS_3;
|
|
|
67 |
$points_4 = \LeadersLinked\Model\RecruitmentSelectionInterview::POINTS_4;
|
|
|
68 |
|
|
|
69 |
|
|
|
70 |
|
| 1709 |
eleazar |
71 |
$this->headStyle()->captureStart();
|
|
|
72 |
echo <<<CSS
|
|
|
73 |
|
|
|
74 |
CSS;
|
|
|
75 |
$this->headStyle()->captureEnd();
|
|
|
76 |
|
|
|
77 |
$this->inlineScript()->captureStart();
|
|
|
78 |
echo <<<JS
|
|
|
79 |
|
|
|
80 |
jQuery( document ).ready(function( $ ) {
|
| 3535 |
eleazar |
81 |
var allowDelete = $allowDelete;
|
|
|
82 |
var allowEdit = $allowEdit;
|
|
|
83 |
var allowReport = $allowReport;
|
| 8784 |
eleazar |
84 |
var allowFile = $allowFile;
|
| 1877 |
eleazar |
85 |
$.validator.setDefaults({
|
| 2015 |
eleazar |
86 |
debug: true,
|
|
|
87 |
highlight: function(element) {
|
|
|
88 |
$(element).addClass('is-invalid');
|
|
|
89 |
},
|
|
|
90 |
unhighlight: function(element) {
|
|
|
91 |
$(element).removeClass('is-invalid');
|
|
|
92 |
},
|
|
|
93 |
errorElement: 'span',
|
|
|
94 |
errorClass: 'error invalid-feedback',
|
|
|
95 |
errorPlacement: function(error, element) {
|
|
|
96 |
if(element.parent('.btn-file').length) {
|
|
|
97 |
error.insertAfter(element.parent().parent());
|
|
|
98 |
} else if(element.parent('.toggle').length) {
|
|
|
99 |
error.insertAfter(element.parent().parent());
|
|
|
100 |
} else {
|
|
|
101 |
error.insertAfter(element.parent());
|
| 1709 |
eleazar |
102 |
}
|
| 2015 |
eleazar |
103 |
}
|
|
|
104 |
});
|
| 3468 |
eleazar |
105 |
|
| 1709 |
eleazar |
106 |
|
| 3468 |
eleazar |
107 |
var gridTable = $('#gridTable').dataTable({
|
|
|
108 |
'processing': true,
|
|
|
109 |
'serverSide': true,
|
|
|
110 |
'searching': true,
|
|
|
111 |
'order': [
|
|
|
112 |
[0, 'asc']
|
|
|
113 |
],
|
|
|
114 |
'ordering': true,
|
|
|
115 |
'ordenable': true,
|
|
|
116 |
'responsive': true,
|
|
|
117 |
'select': false,
|
|
|
118 |
'paging': true,
|
|
|
119 |
'pagingType': 'simple_numbers',
|
|
|
120 |
'ajax': {
|
|
|
121 |
'url': '$routeIndex',
|
|
|
122 |
'type': 'get',
|
|
|
123 |
'beforeSend': function(request) {
|
|
|
124 |
NProgress.start();
|
|
|
125 |
},
|
|
|
126 |
'dataFilter': function(response) {
|
|
|
127 |
var response = jQuery.parseJSON(response);
|
|
|
128 |
var json = {};
|
|
|
129 |
json.recordsTotal = 0;
|
|
|
130 |
json.recordsFiltered = 0;
|
|
|
131 |
json.data = [];
|
|
|
132 |
if (response.success) {
|
|
|
133 |
json.recordsTotal = response.data.total;
|
|
|
134 |
json.recordsFiltered = response.data.total;
|
|
|
135 |
json.data = response.data.items;
|
|
|
136 |
} else {
|
|
|
137 |
$.fn.showError(response.data)
|
|
|
138 |
}
|
|
|
139 |
return JSON.stringify(json);
|
|
|
140 |
gridTable.api().ajax.reload(null, false);
|
|
|
141 |
}
|
|
|
142 |
},
|
|
|
143 |
'language': {
|
|
|
144 |
'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
|
|
|
145 |
'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
|
|
|
146 |
'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
|
|
|
147 |
'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
|
|
|
148 |
'sInfo': 'LABEL_DATATABLE_SINFO',
|
|
|
149 |
'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
|
|
|
150 |
'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
|
|
|
151 |
'sInfoPostFix': '',
|
|
|
152 |
'sSearch': 'LABEL_DATATABLE_SSEARCH',
|
|
|
153 |
'sUrl': '',
|
|
|
154 |
'sInfoThousands': ',',
|
|
|
155 |
'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
|
|
|
156 |
'oPaginate': {
|
|
|
157 |
'sFirst': 'LABEL_DATATABLE_SFIRST',
|
|
|
158 |
'sLast': 'LABEL_DATATABLE_SLAST',
|
|
|
159 |
'sNext': 'LABEL_DATATABLE_SNEXT',
|
|
|
160 |
'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
|
|
|
161 |
},
|
|
|
162 |
'oAria': {
|
|
|
163 |
'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
|
|
|
164 |
'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
|
|
|
165 |
},
|
|
|
166 |
},
|
|
|
167 |
'drawCallback': function(settings) {
|
|
|
168 |
NProgress.done();
|
| 16822 |
efrain |
169 |
|
| 3468 |
eleazar |
170 |
},
|
| 3551 |
eleazar |
171 |
'aoColumns': [
|
|
|
172 |
{
|
| 3544 |
eleazar |
173 |
'mDataProp': function(data, type, row) {
|
|
|
174 |
return data.first_name + ' ' + data.last_name
|
|
|
175 |
}
|
| 3468 |
eleazar |
176 |
},
|
| 3552 |
eleazar |
177 |
{
|
|
|
178 |
'mDataProp': 'email'
|
|
|
179 |
},
|
| 3468 |
eleazar |
180 |
{
|
| 4032 |
eleazar |
181 |
'mDataProp': function(data, type, row){
|
|
|
182 |
switch(data.type) {
|
| 4033 |
eleazar |
183 |
case 'r':
|
| 9405 |
eleazar |
184 |
return 'LABEL_HUMAN_RESOURCE'
|
| 4032 |
eleazar |
185 |
case 'b':
|
| 4034 |
eleazar |
186 |
return 'LABEL_BOSS_INTERVIEW'
|
| 4032 |
eleazar |
187 |
default:
|
|
|
188 |
return data.type
|
|
|
189 |
}
|
|
|
190 |
}
|
| 3561 |
eleazar |
191 |
},
|
|
|
192 |
{
|
| 3888 |
eleazar |
193 |
'mDataProp': 'vacancy'
|
| 3882 |
eleazar |
194 |
},
|
|
|
195 |
{
|
| 8886 |
eleazar |
196 |
'mDataProp': function(data, type, row){
|
|
|
197 |
switch(data.points) {
|
|
|
198 |
case '0':
|
| 8887 |
eleazar |
199 |
return 'LABEL_ANOTHER'
|
|
|
200 |
case '':
|
|
|
201 |
return 'LABEL_ANOTHER'
|
| 8886 |
eleazar |
202 |
case '1':
|
| 8887 |
eleazar |
203 |
return '25%'
|
| 8886 |
eleazar |
204 |
case '2':
|
| 8887 |
eleazar |
205 |
return '50%'
|
| 8886 |
eleazar |
206 |
case '3':
|
| 8887 |
eleazar |
207 |
return '75%'
|
| 8886 |
eleazar |
208 |
case '4':
|
| 8887 |
eleazar |
209 |
return '100%'
|
| 8886 |
eleazar |
210 |
default:
|
|
|
211 |
return data.points
|
|
|
212 |
}
|
| 3956 |
eleazar |
213 |
}
|
| 3953 |
eleazar |
214 |
},
|
|
|
215 |
{
|
| 3468 |
eleazar |
216 |
'mDataProp': 'actions'
|
|
|
217 |
},
|
|
|
218 |
],
|
| 3558 |
eleazar |
219 |
'columnDefs': [
|
|
|
220 |
{
|
| 3468 |
eleazar |
221 |
'targets': 0,
|
|
|
222 |
'className': 'text-vertical-middle',
|
|
|
223 |
},
|
| 3957 |
eleazar |
224 |
|
| 3468 |
eleazar |
225 |
{
|
|
|
226 |
'targets': -1,
|
|
|
227 |
'orderable': false,
|
|
|
228 |
'render': function(data, type, row) {
|
| 9413 |
eleazar |
229 |
|
| 9411 |
eleazar |
230 |
|
| 3468 |
eleazar |
231 |
s = '';
|
| 9411 |
eleazar |
232 |
|
| 3468 |
eleazar |
233 |
if (allowEdit) {
|
| 16906 |
efrain |
234 |
s = s + '<button class="btn btn-info btn-sm btn-edit" data-href="' + data['link_edit'] + '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pen"></i> LABEL_EDIT </button> ';
|
| 3468 |
eleazar |
235 |
}
|
| 9413 |
eleazar |
236 |
if (allowFile && data['link_file']) {
|
| 16932 |
efrain |
237 |
s = s + '<button class="btn btn-info btn-sm btn-evaluation" id="btn-file" data-href="' + data['link_file']+ '" data-toggle="tooltip" title="LABEL_EVALUATION"><i class="fa fa-external-link-alt"></i> LABEL_EVALUATION </button> ';
|
| 9413 |
eleazar |
238 |
}
|
| 3468 |
eleazar |
239 |
if (allowDelete) {
|
| 8794 |
eleazar |
240 |
s = s + '<button class="btn btn-danger btn-sm btn-delete" data-href="' + data['link_delete'] + '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button> ';
|
| 3468 |
eleazar |
241 |
}
|
|
|
242 |
if (allowReport) {
|
| 8788 |
eleazar |
243 |
s = s + '<a class="btn btn-info btn-sm btn-pdf" href="' + data['link_report'] + '" target="_blank" data-toggle="tooltip" title="LABEL_PDF"><i class="fa fa-file-o"></i> LABEL_PDF </button> ';
|
| 3468 |
eleazar |
244 |
}
|
|
|
245 |
return s;
|
|
|
246 |
}
|
|
|
247 |
}
|
|
|
248 |
],
|
|
|
249 |
});
|
| 9403 |
eleazar |
250 |
|
| 2523 |
eleazar |
251 |
function getContent() {
|
| 2897 |
eleazar |
252 |
return $('[data-competency-behavior]').map(
|
| 2523 |
eleazar |
253 |
function (idx, td) {
|
| 2895 |
eleazar |
254 |
const competencyUuid = $(td).data('competency-uuid');
|
|
|
255 |
const behaviorUuid = $(td).data('behavior-uuid');
|
| 2523 |
eleazar |
256 |
const textarea = $(td).find('textarea');
|
|
|
257 |
const select = $(td).find('select');
|
| 2521 |
eleazar |
258 |
|
| 2523 |
eleazar |
259 |
return {
|
| 2895 |
eleazar |
260 |
competencyUuid: competencyUuid,
|
| 3468 |
eleazar |
261 |
behaviorUuid : behaviorUuid,
|
| 2523 |
eleazar |
262 |
comment: textarea.val(),
|
|
|
263 |
evaluation: select.val(),
|
|
|
264 |
}
|
|
|
265 |
}
|
|
|
266 |
).get()
|
|
|
267 |
}
|
|
|
268 |
|
| 8796 |
eleazar |
269 |
|
|
|
270 |
$('body').on('click', 'button.btn-evaluation', function(e) {
|
|
|
271 |
e.preventDefault();
|
|
|
272 |
NProgress.start();
|
|
|
273 |
var action = $(this).data('href');
|
|
|
274 |
window.location.href = action;
|
|
|
275 |
});
|
|
|
276 |
|
|
|
277 |
|
| 2537 |
eleazar |
278 |
var validator = $('#form-interview').validate({
|
| 1877 |
eleazar |
279 |
debug: true,
|
|
|
280 |
onclick: false,
|
|
|
281 |
onkeyup: false,
|
|
|
282 |
ignore: [],
|
| 2534 |
eleazar |
283 |
rules: {},
|
| 1877 |
eleazar |
284 |
submitHandler: function(form) {
|
|
|
285 |
$.ajax({
|
|
|
286 |
'dataType': 'json',
|
|
|
287 |
'accept': 'application/json',
|
|
|
288 |
'method': 'post',
|
| 7962 |
eleazar |
289 |
'url': $('#form-interview').attr('action').replaceAll('UUID_PLACEHOLDER', $('#vacancy_uuid').val()),
|
| 2523 |
eleazar |
290 |
'data': {
|
| 2571 |
eleazar |
291 |
content: JSON.stringify(getContent()),
|
| 2523 |
eleazar |
292 |
candidate_uuid: $('#candidate_uuid').val(),
|
| 2686 |
eleazar |
293 |
points: $('#points').val(),
|
| 2744 |
eleazar |
294 |
comment: $('#comment').val(),
|
| 2749 |
eleazar |
295 |
status: $('#status').val(),
|
| 2523 |
eleazar |
296 |
}
|
| 1877 |
eleazar |
297 |
}).done(function(response) {
|
|
|
298 |
NProgress.start();
|
|
|
299 |
if (response['success']) {
|
|
|
300 |
$.fn.showSuccess(response['data']);
|
| 3468 |
eleazar |
301 |
$('#main').hide();
|
| 3454 |
eleazar |
302 |
$('#interview').hide();
|
| 8778 |
eleazar |
303 |
gridTable.api().ajax.reload(null, false);
|
| 1877 |
eleazar |
304 |
} else {
|
|
|
305 |
validator.resetForm();
|
|
|
306 |
if (jQuery.type(response['data']) == 'string') {
|
|
|
307 |
$.fn.showError(response['data']);
|
|
|
308 |
} else {
|
|
|
309 |
$.each(response['data'], function(fieldname, errors) {
|
| 2531 |
eleazar |
310 |
$.fn.showFormErrorValidator('#interview #' + fieldname, errors);
|
| 1877 |
eleazar |
311 |
});
|
|
|
312 |
}
|
|
|
313 |
}
|
|
|
314 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
315 |
$.fn.showError(textStatus);
|
|
|
316 |
}).always(function() {
|
|
|
317 |
NProgress.done();
|
|
|
318 |
});
|
|
|
319 |
return false;
|
|
|
320 |
},
|
|
|
321 |
invalidHandler: function(form, validator) {}
|
|
|
322 |
});
|
| 1709 |
eleazar |
323 |
|
| 2015 |
eleazar |
324 |
$('body').on('click', 'button.btn-add', function(e) {
|
| 3631 |
eleazar |
325 |
$('#form-interview').attr('action', "$routeAdd")
|
| 3644 |
eleazar |
326 |
$('#candidate_uuid').prop('disabled', false);
|
|
|
327 |
$('#vacancy_uuid').prop('disabled', false);
|
|
|
328 |
$('#vacancy_uuid').change();
|
| 8768 |
eleazar |
329 |
$('#filter_vacancy_uuid').change();
|
| 3631 |
eleazar |
330 |
|
| 2015 |
eleazar |
331 |
e.preventDefault();
|
| 3631 |
eleazar |
332 |
|
| 2015 |
eleazar |
333 |
NProgress.start();
|
|
|
334 |
$.ajax({
|
|
|
335 |
'dataType': 'json',
|
|
|
336 |
'accept': 'application/json',
|
|
|
337 |
'method': 'get',
|
| 3631 |
eleazar |
338 |
'url': $(this).data('url'),
|
| 2015 |
eleazar |
339 |
}).done(function(response) {
|
|
|
340 |
if (response['success']) {
|
| 2237 |
eleazar |
341 |
var data = response.data
|
| 4159 |
eleazar |
342 |
$("#form-interview #comment").val('');
|
|
|
343 |
$('#form-interview #status').val('$status_acepted');
|
|
|
344 |
$("#form-interview #points").val('$points_0');
|
| 3466 |
eleazar |
345 |
$("#content").hide();
|
| 8677 |
eleazar |
346 |
$("#main").show();
|
|
|
347 |
validator.resetForm();
|
| 8676 |
eleazar |
348 |
$('#custom-tabs #custom-tabs-general-tab').tab('show');
|
| 8771 |
eleazar |
349 |
$('#candidate_uuid').change();
|
| 8768 |
eleazar |
350 |
$('#interview').show();
|
| 1877 |
eleazar |
351 |
} else {
|
| 2015 |
eleazar |
352 |
$.fn.showError(response['data']);
|
| 1877 |
eleazar |
353 |
}
|
| 2015 |
eleazar |
354 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
355 |
$.fn.showError(textStatus);
|
|
|
356 |
}).always(function() {
|
|
|
357 |
NProgress.done();
|
| 1877 |
eleazar |
358 |
});
|
| 2015 |
eleazar |
359 |
});
|
| 2785 |
eleazar |
360 |
|
|
|
361 |
$('body').on('click', 'button.btn-edit', function(e) {
|
| 3604 |
eleazar |
362 |
var url = $(this).data('href');
|
| 2785 |
eleazar |
363 |
e.preventDefault();
|
|
|
364 |
NProgress.start();
|
|
|
365 |
$.ajax({
|
|
|
366 |
'dataType': 'json',
|
|
|
367 |
'accept': 'application/json',
|
|
|
368 |
'method': 'get',
|
| 2807 |
eleazar |
369 |
'url': url,
|
| 2785 |
eleazar |
370 |
}).done(function(response) {
|
|
|
371 |
if (response['success']) {
|
|
|
372 |
var data = response.data
|
| 3635 |
eleazar |
373 |
$('#vacancy_uuid').val(data['vacancy']['uuid']);
|
| 3642 |
eleazar |
374 |
$('#vacancy_uuid').prop('disabled', true);
|
| 3640 |
eleazar |
375 |
$('#candidate_uuid').html('');
|
|
|
376 |
var option = $('<option />')
|
|
|
377 |
.val(data['candidate']['uuid'])
|
|
|
378 |
.text(data['candidate']['first_name'] + ' ' + data['candidate']['last_name']);
|
|
|
379 |
$('#candidate_uuid').append(option).prop('disabled', true);
|
| 3633 |
eleazar |
380 |
$("#form-interview #comment").val(data['interview']['comment']);
|
|
|
381 |
$('#form-interview #status').val(data['interview']['status']);
|
|
|
382 |
$("#form-interview #points").val(data['interview']['points']);
|
| 2785 |
eleazar |
383 |
$("#competencies-job").html($("#competenciesTemplate").render(data))
|
| 2887 |
eleazar |
384 |
data.interview.content.forEach(obj => {
|
| 2896 |
eleazar |
385 |
$('#textarea-' + obj.competencyUuid + '-' + obj.behaviorUuid).val(obj.comment);
|
|
|
386 |
$('#select-' + obj.competencyUuid + '-' + obj.behaviorUuid).val(obj.evaluation);
|
| 2887 |
eleazar |
387 |
})
|
| 2808 |
eleazar |
388 |
$("#form-interview").attr('action', url)
|
| 3468 |
eleazar |
389 |
$("#content").hide();
|
|
|
390 |
$("#main").show()
|
| 2785 |
eleazar |
391 |
} else {
|
|
|
392 |
$.fn.showError(response['data']);
|
|
|
393 |
}
|
|
|
394 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
395 |
$.fn.showError(textStatus);
|
|
|
396 |
}).always(function() {
|
|
|
397 |
NProgress.done();
|
|
|
398 |
});
|
|
|
399 |
});
|
| 2788 |
eleazar |
400 |
|
| 16822 |
efrain |
401 |
$('body').on('click', 'button.btn-delete', function(e) {
|
|
|
402 |
e.preventDefault();
|
|
|
403 |
var action = $(this).data('href');
|
|
|
404 |
|
|
|
405 |
|
|
|
406 |
swal.fire({
|
|
|
407 |
title: 'LABEL_ARE_YOU_SURE',
|
|
|
408 |
icon: 'question',
|
|
|
409 |
cancelButtonText: 'LABEL_NO',
|
|
|
410 |
showCancelButton: true,
|
|
|
411 |
confirmButtonText: 'LABEL_YES'
|
|
|
412 |
}).then((result) => {
|
|
|
413 |
if (result.isConfirmed) {
|
|
|
414 |
|
|
|
415 |
NProgress.start();
|
|
|
416 |
$.ajax({
|
|
|
417 |
'dataType' : 'json',
|
|
|
418 |
'accept' : 'application/json',
|
|
|
419 |
'method' : 'post',
|
|
|
420 |
'url' : action,
|
|
|
421 |
}).done(function(response) {
|
|
|
422 |
if(response['success']) {
|
|
|
423 |
$.fn.showSuccess(response['data']);
|
|
|
424 |
gridTable.api().ajax.reload(null, false);
|
|
|
425 |
} else {
|
|
|
426 |
$.fn.showError(response['data']);
|
|
|
427 |
}
|
|
|
428 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
429 |
$.fn.showError(textStatus);
|
|
|
430 |
}).always(function() {
|
|
|
431 |
NProgress.done();
|
|
|
432 |
});
|
|
|
433 |
}
|
|
|
434 |
});
|
| 2887 |
eleazar |
435 |
});
|
| 3468 |
eleazar |
436 |
|
| 4363 |
eleazar |
437 |
|
| 7968 |
eleazar |
438 |
$('#filter_vacancy_uuid').change(function (e) {
|
| 4363 |
eleazar |
439 |
e.preventDefault();
|
|
|
440 |
|
|
|
441 |
var uuid = e.target.value;
|
|
|
442 |
|
|
|
443 |
gridTable.api().ajax.url("$routeIndex" + "/" + uuid);
|
|
|
444 |
gridTable.api().ajax.reload(null, false);
|
|
|
445 |
})
|
|
|
446 |
|
| 2015 |
eleazar |
447 |
$('body').on('click', 'button.btn-cancel', function(e) {
|
|
|
448 |
e.preventDefault();
|
| 2521 |
eleazar |
449 |
$('#main').show();
|
| 2015 |
eleazar |
450 |
$('#row-form').hide();
|
|
|
451 |
$('#div-listing').show();
|
|
|
452 |
});
|
| 3468 |
eleazar |
453 |
|
| 7967 |
eleazar |
454 |
$('#form-filter #filter_vacancy_uuid').change(function(e) {
|
| 2015 |
eleazar |
455 |
e.preventDefault();
|
| 3468 |
eleazar |
456 |
gridTable.api().ajax.reload(null, false);
|
| 2015 |
eleazar |
457 |
})
|
| 3468 |
eleazar |
458 |
|
| 2525 |
eleazar |
459 |
/**
|
|
|
460 |
* Clicked cancel new/edit Form
|
|
|
461 |
*/
|
|
|
462 |
$('button.btn-edit-cancel').click(function(e) {
|
|
|
463 |
e.preventDefault();
|
| 3468 |
eleazar |
464 |
$("#content").show();
|
|
|
465 |
$("#main").hide();
|
| 2525 |
eleazar |
466 |
});
|
|
|
467 |
/**
|
|
|
468 |
* Clicked save and continue new Form
|
|
|
469 |
*/
|
|
|
470 |
$('button.btn-form-save-continue').click(function(e) {
|
|
|
471 |
e.preventDefault();
|
| 4162 |
eleazar |
472 |
$('#form-interview #form-continue').val('1')
|
| 2540 |
eleazar |
473 |
$('#form-interview').submit();
|
| 2525 |
eleazar |
474 |
});
|
|
|
475 |
/**
|
|
|
476 |
* Clicked save and close new/edit Form
|
|
|
477 |
*/
|
|
|
478 |
$('button.btn-form-save-close').click(function(e) {
|
|
|
479 |
e.preventDefault();
|
| 4162 |
eleazar |
480 |
$('#form-interview #form-continue').val('0')
|
| 3468 |
eleazar |
481 |
$("#content").show();
|
|
|
482 |
$("#main").hide();
|
| 2540 |
eleazar |
483 |
$('#form-interview').submit();
|
| 4157 |
eleazar |
484 |
gridTable.api().ajax.reload(null, false);
|
| 2525 |
eleazar |
485 |
});
|
| 3120 |
eleazar |
486 |
|
| 3571 |
eleazar |
487 |
$('#vacancy_uuid').on('change', function (event) {
|
| 8777 |
eleazar |
488 |
|
| 6227 |
eleazar |
489 |
$('#candidate_uuid').html('');
|
| 3571 |
eleazar |
490 |
var uuid = event.target.value;
|
| 3463 |
eleazar |
491 |
|
| 3571 |
eleazar |
492 |
$.ajax({
|
|
|
493 |
'dataType': 'json',
|
|
|
494 |
'accept': 'application/json',
|
|
|
495 |
'method': 'get',
|
|
|
496 |
'url': String('$routeVacancy').replaceAll('UUID_PLACEHOLDER', uuid),
|
|
|
497 |
}).done(function (response) {
|
|
|
498 |
var data = response.data
|
| 8777 |
eleazar |
499 |
$('#candidate_uuid').change();
|
| 3590 |
eleazar |
500 |
$('#job-description').html($('#job-description-template').render(data));
|
| 3589 |
eleazar |
501 |
$("#competencies-job").html($("#competenciesTemplate").render(data))
|
| 3571 |
eleazar |
502 |
data.candidates.forEach(function (candidate) {
|
|
|
503 |
var option = $('<option />')
|
|
|
504 |
.val(candidate.uuid)
|
|
|
505 |
.text(candidate.first_name)
|
|
|
506 |
.data('addUrl', candidate.add_url)
|
|
|
507 |
.data('editUrl', candidate.edit_url)
|
|
|
508 |
.data('deleteUrl', candidate.delete_url)
|
|
|
509 |
.data('reportUrl', candidate.report_url)
|
| 2038 |
eleazar |
510 |
|
| 3571 |
eleazar |
511 |
$('#candidate_uuid').append(option);
|
|
|
512 |
});
|
|
|
513 |
})
|
| 7954 |
eleazar |
514 |
|
| 3571 |
eleazar |
515 |
});
|
| 2052 |
eleazar |
516 |
|
| 4365 |
eleazar |
517 |
$('#candidate_uuid').on('change', function(event){
|
|
|
518 |
|
|
|
519 |
var uuid = event.target.value;
|
|
|
520 |
|
|
|
521 |
$.ajax({
|
|
|
522 |
'dataType' : 'json',
|
|
|
523 |
'accept' : 'aplication/json',
|
|
|
524 |
'method' : 'get',
|
| 4367 |
eleazar |
525 |
'url': String('$routeType').replaceAll('UUID_PLACEHOLDER', uuid),
|
| 4371 |
eleazar |
526 |
}).done(function (response) {
|
| 4369 |
eleazar |
527 |
$('#interview').html(response.data);
|
| 4365 |
eleazar |
528 |
})
|
|
|
529 |
})
|
|
|
530 |
|
| 3571 |
eleazar |
531 |
$('#vacancy_uuid').change();
|
| 7954 |
eleazar |
532 |
$('#candidate_uuid').change();
|
| 4364 |
eleazar |
533 |
$('#filter_vacancy_uuid').change();
|
| 2785 |
eleazar |
534 |
|
| 3341 |
eleazar |
535 |
});
|
| 1709 |
eleazar |
536 |
JS;
|
|
|
537 |
$this->inlineScript()->captureEnd();
|
| 10425 |
stevensc |
538 |
|
| 10428 |
stevensc |
539 |
$jsonVacancies = json_encode($vacancies);
|
|
|
540 |
|
| 10425 |
stevensc |
541 |
$js = <<<JS
|
|
|
542 |
const backendVariables= {
|
|
|
543 |
add_link: "$routeAdd",
|
|
|
544 |
table_link: "$routeIndex",
|
| 10843 |
stevensc |
545 |
type_link: "$routeType",
|
|
|
546 |
vacancy_link: "$routeVacancy",
|
| 10432 |
stevensc |
547 |
vacancies: $jsonVacancies,
|
| 10425 |
stevensc |
548 |
permisions: {
|
|
|
549 |
allowAdd: $allowAdd,
|
|
|
550 |
allowEdit: $allowEdit,
|
|
|
551 |
allowDelete: $allowDelete,
|
|
|
552 |
allowReport: $allowReport,
|
|
|
553 |
allowFile: $allowFile
|
|
|
554 |
}
|
|
|
555 |
}
|
|
|
556 |
JS;
|
|
|
557 |
|
|
|
558 |
$this->inlineScript()->appendScript($js);
|
|
|
559 |
$this->inlineScript()->appendFile('/react-bundles/recruitment_and_selection/interviews/interviewsBundle.js');
|
| 1709 |
eleazar |
560 |
?>
|
|
|
561 |
|
| 3468 |
eleazar |
562 |
|
| 3460 |
eleazar |
563 |
<!-- Content Header (Page header) -->
|
| 10425 |
stevensc |
564 |
<div id="recruitment_and_selection-interview">
|
| 11076 |
stevensc |
565 |
</div>
|