| 1709 |
eleazar |
1 |
<?php
|
|
|
2 |
$acl = $this->viewModel()->getRoot()->getVariable('acl');
|
|
|
3 |
$currentUser = $this->currentUserHelper();
|
|
|
4 |
$roleName = $currentUser->getUserTypeId();
|
|
|
5 |
|
| 2029 |
eleazar |
6 |
$routeIndex = $this->url('recruitment-and-selection/interview/form');
|
| 2128 |
eleazar |
7 |
$routeAdd = $this->url('recruitment-and-selection/interview/form/add', ['candidate_uuid' => 'UUID_PLACEHOLDER']);
|
| 1877 |
eleazar |
8 |
|
| 1827 |
eleazar |
9 |
$allowAdd = $acl->isAllowed($roleName, 'recruitment-and-selection/interview/form/add') ? 1 : 0;
|
| 1709 |
eleazar |
10 |
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
|
|
|
11 |
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
$this->inlineScript()->appendFile($this->basePath('plugins/bootbox/bootbox.min.js'));
|
|
|
15 |
|
|
|
16 |
|
| 1885 |
eleazar |
17 |
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
|
| 1709 |
eleazar |
18 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
|
|
|
19 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
|
|
|
20 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
|
|
|
21 |
|
|
|
22 |
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
|
|
|
23 |
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
|
|
|
24 |
|
|
|
25 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
|
|
|
26 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
|
|
|
27 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
|
|
|
28 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
|
|
|
32 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
|
|
|
33 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
|
|
|
38 |
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
|
|
|
39 |
|
|
|
40 |
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
|
|
|
41 |
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
|
|
|
42 |
|
|
|
43 |
$this->inlineScript()->appendFile($this->basePath('plugins/moment/moment-with-locales.min.js'));
|
|
|
44 |
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css'));
|
|
|
45 |
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js'));
|
|
|
46 |
|
| 1887 |
eleazar |
47 |
|
|
|
48 |
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/select2.js'));
|
|
|
49 |
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/i18n/es.js'));
|
|
|
50 |
$this->headLink()->appendStylesheet($this->basePath('plugins/select2/css/select2.css'));
|
|
|
51 |
|
|
|
52 |
$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.css'));
|
| 1709 |
eleazar |
53 |
|
| 2052 |
eleazar |
54 |
// JsRender //
|
|
|
55 |
$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.min.js'));
|
| 1709 |
eleazar |
56 |
|
|
|
57 |
$this->headStyle()->captureStart();
|
|
|
58 |
echo <<<CSS
|
|
|
59 |
|
|
|
60 |
CSS;
|
|
|
61 |
$this->headStyle()->captureEnd();
|
|
|
62 |
|
|
|
63 |
$this->inlineScript()->captureStart();
|
|
|
64 |
echo <<<JS
|
|
|
65 |
|
| 2501 |
eleazar |
66 |
function htmlEntities(str) {
|
|
|
67 |
return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
|
68 |
}
|
| 2500 |
eleazar |
69 |
|
| 1709 |
eleazar |
70 |
jQuery( document ).ready(function( $ ) {
|
| 1877 |
eleazar |
71 |
$.validator.setDefaults({
|
| 2015 |
eleazar |
72 |
debug: true,
|
|
|
73 |
highlight: function(element) {
|
|
|
74 |
$(element).addClass('is-invalid');
|
|
|
75 |
},
|
|
|
76 |
unhighlight: function(element) {
|
|
|
77 |
$(element).removeClass('is-invalid');
|
|
|
78 |
},
|
|
|
79 |
errorElement: 'span',
|
|
|
80 |
errorClass: 'error invalid-feedback',
|
|
|
81 |
errorPlacement: function(error, element) {
|
|
|
82 |
if(element.parent('.btn-file').length) {
|
|
|
83 |
error.insertAfter(element.parent().parent());
|
|
|
84 |
} else if(element.parent('.toggle').length) {
|
|
|
85 |
error.insertAfter(element.parent().parent());
|
|
|
86 |
} else {
|
|
|
87 |
error.insertAfter(element.parent());
|
| 1709 |
eleazar |
88 |
}
|
| 2015 |
eleazar |
89 |
}
|
|
|
90 |
});
|
| 1709 |
eleazar |
91 |
|
|
|
92 |
|
| 2015 |
eleazar |
93 |
$.fn.showFormErrorValidator = function(fieldname, errors) {
|
|
|
94 |
var field = $(fieldname);
|
|
|
95 |
if(field) {
|
|
|
96 |
$(field).addClass('is-invalid');
|
| 1709 |
eleazar |
97 |
|
| 2015 |
eleazar |
98 |
var error = $('<span id="' + fieldname +'-error" class="error invalid-feedback">' + errors + '</div>');
|
|
|
99 |
|
|
|
100 |
if(element.parent('.btn-file').length) {
|
|
|
101 |
error.insertAfter(element.parent().parent());
|
|
|
102 |
} else if(element.parent('.toggle').length) {
|
|
|
103 |
error.insertAfter(element.parent().parent());
|
|
|
104 |
} else {
|
|
|
105 |
error.insertAfter(element.parent());
|
| 1709 |
eleazar |
106 |
}
|
| 2015 |
eleazar |
107 |
}
|
|
|
108 |
};
|
| 1827 |
eleazar |
109 |
|
| 2015 |
eleazar |
110 |
var validator = $('#form-interview').validate({
|
| 1877 |
eleazar |
111 |
debug: true,
|
|
|
112 |
onclick: false,
|
|
|
113 |
onkeyup: false,
|
|
|
114 |
ignore: [],
|
|
|
115 |
rules: {
|
|
|
116 |
'name': {
|
|
|
117 |
required: true,
|
|
|
118 |
maxlength: 64,
|
|
|
119 |
},
|
|
|
120 |
'status': {
|
|
|
121 |
required: false,
|
|
|
122 |
},
|
| 2276 |
eleazar |
123 |
|
| 1877 |
eleazar |
124 |
},
|
|
|
125 |
submitHandler: function(form) {
|
|
|
126 |
$.ajax({
|
|
|
127 |
'dataType': 'json',
|
|
|
128 |
'accept': 'application/json',
|
|
|
129 |
'method': 'post',
|
| 2245 |
eleazar |
130 |
'url': $('#form').attr('action'),
|
|
|
131 |
'data': $('#form').serialize()
|
| 1877 |
eleazar |
132 |
}).done(function(response) {
|
|
|
133 |
NProgress.start();
|
|
|
134 |
if (response['success']) {
|
|
|
135 |
$.fn.showSuccess(response['data']);
|
| 1900 |
eleazar |
136 |
$('#content').show();
|
|
|
137 |
$('#row-form').hide();
|
| 1877 |
eleazar |
138 |
gridTable.api().ajax.reload(null, false);
|
|
|
139 |
} else {
|
|
|
140 |
validator.resetForm();
|
|
|
141 |
if (jQuery.type(response['data']) == 'string') {
|
|
|
142 |
$.fn.showError(response['data']);
|
|
|
143 |
} else {
|
|
|
144 |
$.each(response['data'], function(fieldname, errors) {
|
| 2245 |
eleazar |
145 |
$.fn.showFormErrorValidator('#form #' + fieldname, errors);
|
| 1877 |
eleazar |
146 |
});
|
|
|
147 |
}
|
|
|
148 |
}
|
|
|
149 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
150 |
$.fn.showError(textStatus);
|
|
|
151 |
}).always(function() {
|
|
|
152 |
NProgress.done();
|
|
|
153 |
});
|
|
|
154 |
return false;
|
|
|
155 |
},
|
|
|
156 |
invalidHandler: function(form, validator) {}
|
|
|
157 |
});
|
| 1709 |
eleazar |
158 |
|
| 2015 |
eleazar |
159 |
$('body').on('click', 'button.btn-add', function(e) {
|
|
|
160 |
e.preventDefault();
|
|
|
161 |
NProgress.start();
|
|
|
162 |
$.ajax({
|
|
|
163 |
'dataType': 'json',
|
|
|
164 |
'accept': 'application/json',
|
|
|
165 |
'method': 'get',
|
| 2194 |
eleazar |
166 |
'url': '$routeAdd'.replaceAll('UUID_PLACEHOLDER', $('#candidate_uuid').val()),
|
| 2015 |
eleazar |
167 |
}).done(function(response) {
|
|
|
168 |
if (response['success']) {
|
| 2237 |
eleazar |
169 |
var data = response.data
|
| 2264 |
eleazar |
170 |
$("#competencies-job").html($("#competenciesTemplate").render(data))
|
| 2313 |
eleazar |
171 |
$("#interview").show()
|
| 1877 |
eleazar |
172 |
} else {
|
| 2015 |
eleazar |
173 |
$.fn.showError(response['data']);
|
| 1877 |
eleazar |
174 |
}
|
| 2015 |
eleazar |
175 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
176 |
$.fn.showError(textStatus);
|
|
|
177 |
}).always(function() {
|
|
|
178 |
NProgress.done();
|
| 1877 |
eleazar |
179 |
});
|
| 2015 |
eleazar |
180 |
});
|
| 1709 |
eleazar |
181 |
|
| 2015 |
eleazar |
182 |
$('#form-interview #status').bootstrapToggle({
|
|
|
183 |
'on': 'LABEL_ACTIVE',
|
|
|
184 |
'off': 'LABEL_INACTIVE',
|
|
|
185 |
'width': '160px',
|
|
|
186 |
'height': '40px'
|
|
|
187 |
});
|
| 1709 |
eleazar |
188 |
|
| 2015 |
eleazar |
189 |
|
| 2265 |
eleazar |
190 |
|
| 2015 |
eleazar |
191 |
$('body').on('click', 'button.btn-cancel', function(e) {
|
|
|
192 |
e.preventDefault();
|
|
|
193 |
$('#content').show();
|
|
|
194 |
$('#row-form').hide();
|
|
|
195 |
$('#div-listing').show();
|
|
|
196 |
});
|
|
|
197 |
|
|
|
198 |
$('#form-filter #vacancy_uuid').change(function(e) {
|
|
|
199 |
e.preventDefault();
|
|
|
200 |
$('#form-filter #candidates_uuid').empty();
|
|
|
201 |
})
|
| 2118 |
eleazar |
202 |
|
| 2015 |
eleazar |
203 |
$('#form-filter #candidates_uuid').change(function(e) {
|
|
|
204 |
e.preventDefault();
|
|
|
205 |
})
|
| 2029 |
eleazar |
206 |
|
|
|
207 |
$('#vacancy_uuid').on('change', function () {
|
| 2042 |
eleazar |
208 |
$('#candidate_uuid').html('');
|
|
|
209 |
|
| 2029 |
eleazar |
210 |
$.ajax({
|
|
|
211 |
'dataType': 'json',
|
|
|
212 |
'accept': 'application/json',
|
|
|
213 |
'method': 'get',
|
| 2031 |
eleazar |
214 |
'url': "$routeIndex" + "?vacancy_uuid=" + $('#vacancy_uuid').val(),
|
| 2038 |
eleazar |
215 |
}).done(function (response) {
|
|
|
216 |
var data = response.data
|
|
|
217 |
|
| 2036 |
eleazar |
218 |
data.candidates.forEach(function (candidate) {
|
| 2041 |
eleazar |
219 |
var option = $('<option />').val(candidate.uuid).text(candidate.first_name);
|
|
|
220 |
|
|
|
221 |
$('#candidate_uuid').append(option);
|
| 2036 |
eleazar |
222 |
});
|
| 2052 |
eleazar |
223 |
|
| 2244 |
eleazar |
224 |
$('#job-description').html($('#job-description-template').render(response.data));
|
| 2029 |
eleazar |
225 |
})
|
|
|
226 |
});
|
| 2032 |
eleazar |
227 |
|
|
|
228 |
$('#vacancy_uuid').change();
|
| 1709 |
eleazar |
229 |
});
|
|
|
230 |
JS;
|
|
|
231 |
$this->inlineScript()->captureEnd();
|
|
|
232 |
?>
|
|
|
233 |
|
|
|
234 |
|
|
|
235 |
<!-- Content Header (Page header) -->
|
|
|
236 |
<section class="content-header">
|
|
|
237 |
<div class="container-fluid">
|
|
|
238 |
<div class="row mb-2">
|
|
|
239 |
<div class="col-sm-12">
|
|
|
240 |
<h1>LABEL_INTERVIEW</h1>
|
|
|
241 |
</div>
|
|
|
242 |
</div>
|
|
|
243 |
</div><!-- /.container-fluid -->
|
|
|
244 |
</section>
|
|
|
245 |
|
|
|
246 |
<section class="content">
|
|
|
247 |
<div class="container-fluid">
|
|
|
248 |
<div class="row">
|
|
|
249 |
<div class="col-12">
|
|
|
250 |
<div class="card">
|
| 2021 |
eleazar |
251 |
<div class="card-header">
|
| 1709 |
eleazar |
252 |
<div class="row">
|
|
|
253 |
<div class="col-md-6 col-sm-12">
|
|
|
254 |
<div class="form-group">
|
| 2021 |
eleazar |
255 |
<label for="vacancy_uuid">LABEL_VACANCY</label>
|
| 2023 |
eleazar |
256 |
<select id="vacancy_uuid" name="vacancy_uuid" class="form-control">
|
| 2021 |
eleazar |
257 |
<?php foreach($this->vacancies as $vacancy): ?>
|
| 2023 |
eleazar |
258 |
<option value="<?= $vacancy->uuid ?>"><?= $vacancy->name ?></option>
|
| 2021 |
eleazar |
259 |
<?php endforeach; ?>
|
|
|
260 |
</select>
|
| 1709 |
eleazar |
261 |
</div>
|
|
|
262 |
</div>
|
|
|
263 |
<div class="col-md-6 col-sm-12">
|
|
|
264 |
<div class="form-group">
|
| 2040 |
eleazar |
265 |
<label for="candidate_uuid">LABEL_CANDIDATES</label>
|
| 2024 |
eleazar |
266 |
<select id="candidate_uuid" name="candidate_uuid" class="form-control">
|
|
|
267 |
</select>
|
| 1709 |
eleazar |
268 |
</div>
|
|
|
269 |
</div>
|
|
|
270 |
<div
|
|
|
271 |
class="col-md-12 col-sm-12"
|
|
|
272 |
>
|
|
|
273 |
</div>
|
|
|
274 |
</div>
|
|
|
275 |
</div>
|
|
|
276 |
<div class="card-body">
|
| 2052 |
eleazar |
277 |
<div id="job-description"></div>
|
| 1709 |
eleazar |
278 |
</div>
|
| 2015 |
eleazar |
279 |
|
|
|
280 |
<div class="card-footer clearfix">
|
|
|
281 |
<div style="float:right;">
|
|
|
282 |
<?php if($allowAdd) : ?>
|
|
|
283 |
<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
|
|
|
284 |
<?php endif; ?>
|
| 1876 |
eleazar |
285 |
</div>
|
| 2015 |
eleazar |
286 |
</div>
|
|
|
287 |
</div>
|
| 1876 |
eleazar |
288 |
</div>
|
| 2015 |
eleazar |
289 |
</div>
|
|
|
290 |
</div>
|
|
|
291 |
</section>
|
| 2052 |
eleazar |
292 |
|
|
|
293 |
<script id="job-description-template" type="text/x-jsrender">
|
|
|
294 |
<div class="card">
|
|
|
295 |
<div class="card-body">
|
|
|
296 |
<h5 class="card-title">{{:job_description.name}}</h5>
|
|
|
297 |
<p class="card-text">{{:vacancy.description}}</p>
|
| 2214 |
eleazar |
298 |
<p class="card-text">{{:job_description.objectives}}</p>
|
|
|
299 |
<p class="card-text">{{:job_description.functions}}</p>
|
| 2052 |
eleazar |
300 |
</div>
|
|
|
301 |
</div>
|
| 2061 |
eleazar |
302 |
</script>
|
|
|
303 |
|
| 2314 |
eleazar |
304 |
<section id="interview" style="display: none;">
|
| 2215 |
eleazar |
305 |
<div class="container-fluid">
|
|
|
306 |
<div class="row">
|
|
|
307 |
<div class="col-12">
|
|
|
308 |
<div class="card">
|
|
|
309 |
<div class="card-header">
|
|
|
310 |
<label>interview</label>
|
|
|
311 |
</div>
|
|
|
312 |
<div class="card-body">
|
| 2217 |
eleazar |
313 |
<div id="competencies-job"></div>
|
| 2313 |
eleazar |
314 |
|
|
|
315 |
<div class="form-group">
|
|
|
316 |
<label for="text-option">LABEL_FINAL_COMMENT</label>
|
|
|
317 |
<!-- ckeditor -->
|
| 2277 |
eleazar |
318 |
<textarea name="text-option" id="text-option" rows="5" class="form-control"></textarea>
|
|
|
319 |
</div>
|
| 2313 |
eleazar |
320 |
</div>
|
| 2280 |
eleazar |
321 |
<div class="card-footer clearfix">
|
| 2284 |
eleazar |
322 |
<button type="button" class="btn btn-primary btn-behavior-submit">LABEL_SAVE</button>
|
|
|
323 |
<button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
|
| 2280 |
eleazar |
324 |
</div>
|
| 2278 |
eleazar |
325 |
</div>
|
| 2215 |
eleazar |
326 |
</div>
|
|
|
327 |
</div>
|
|
|
328 |
</div>
|
|
|
329 |
</section>
|
|
|
330 |
|
| 2264 |
eleazar |
331 |
<script id="competenciesTemplate" type="text/x-jsrender">
|
| 2293 |
eleazar |
332 |
<table class="table table-bordered">
|
|
|
333 |
<thead>
|
|
|
334 |
<tr>
|
| 2306 |
eleazar |
335 |
<th style="width: 50%;">LABEL_ELEMENT</th>
|
| 2293 |
eleazar |
336 |
<th style="width: 50%;">LABEL_TITLE</th>
|
|
|
337 |
</tr>
|
|
|
338 |
</thead>
|
| 2300 |
eleazar |
339 |
<tbody>
|
|
|
340 |
{{for job_description.competencies}}
|
|
|
341 |
<tr>
|
|
|
342 |
<td class="text-left">LABEL_COMPETENCY</td>
|
| 2302 |
eleazar |
343 |
<td class="text-left">{{:competency_name}}</td>
|
| 2300 |
eleazar |
344 |
</tr>
|
| 2302 |
eleazar |
345 |
|
|
|
346 |
{{for behaviors}}
|
| 2308 |
eleazar |
347 |
<tr>
|
| 2302 |
eleazar |
348 |
<td class="text-left">--LABEL_CONDUCT</td>
|
|
|
349 |
<td class="text-left">
|
| 2303 |
eleazar |
350 |
{{:description}}
|
| 2302 |
eleazar |
351 |
</td>
|
|
|
352 |
</tr>
|
|
|
353 |
{{/for}}
|
| 2307 |
eleazar |
354 |
|
| 2302 |
eleazar |
355 |
<tr>
|
| 2310 |
eleazar |
356 |
<td colspan="2">
|
| 2312 |
eleazar |
357 |
<label for="textarea-{{:competency_uuid}}">LABEL_COMMENT</label>
|
|
|
358 |
<textarea
|
|
|
359 |
id="textarea-{{:competency_uuid}}"
|
|
|
360 |
class="form-control"
|
|
|
361 |
></textarea>
|
| 2310 |
eleazar |
362 |
</td>
|
| 2300 |
eleazar |
363 |
</tr>
|
|
|
364 |
{{/for}}
|
|
|
365 |
</tbody>
|
| 2293 |
eleazar |
366 |
</table>
|
| 2241 |
eleazar |
367 |
</script>
|