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