977 |
geraldo |
1 |
<?php
|
|
|
2 |
$acl = $this->viewModel()->getRoot()->getVariable('acl');
|
|
|
3 |
$currentUser = $this->currentUserHelper();
|
|
|
4 |
|
|
|
5 |
$roleName = $currentUser->getUserTypeId();
|
|
|
6 |
|
985 |
geraldo |
7 |
$routeAdd = $this->url('performance-evaluation/forms/add');
|
|
|
8 |
$routeDatatable = $this->url('performance-evaluation/forms');
|
977 |
geraldo |
9 |
$routeDashboard = $this->url('dashboard');
|
|
|
10 |
|
985 |
geraldo |
11 |
$allowAdd = $acl->isAllowed($roleName, 'performance-evaluation/forms/add') ? 1 : 0;
|
|
|
12 |
$allowEdit = $acl->isAllowed($roleName, 'performance-evaluation/forms/edit') ? 1 : 0;
|
|
|
13 |
$allowDelete = $acl->isAllowed($roleName, 'performance-evaluation/forms/delete') ? 1 : 0;
|
1263 |
geraldo |
14 |
$allowReport = $acl->isAllowed($roleName, 'performance-evaluation/forms/report') ? 1 : 0;
|
15443 |
efrain |
15 |
$allowActive = $acl->isAllowed($roleName, 'performance-evaluation/forms/active') ? 1 : 0;
|
|
|
16 |
$allowInactive = $acl->isAllowed($roleName, 'performance-evaluation/forms/inactive') ? 1 : 0;
|
977 |
geraldo |
17 |
|
1088 |
geraldo |
18 |
|
16842 |
efrain |
19 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-maxlength/bootstrap-maxlength.min.js'));
|
12137 |
stevensc |
20 |
|
15443 |
efrain |
21 |
|
16822 |
efrain |
22 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));
|
|
|
23 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.js'));
|
15443 |
efrain |
24 |
|
|
|
25 |
|
16822 |
efrain |
26 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/jquery.validate.js'));
|
|
|
27 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/additional-methods.js'));
|
|
|
28 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/localization/messages_es.js'));
|
15443 |
efrain |
29 |
|
16822 |
efrain |
30 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.css'));
|
|
|
31 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.css'));
|
15443 |
efrain |
32 |
|
16822 |
efrain |
33 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net/jquery.dataTables.js'));
|
|
|
34 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.js'));
|
|
|
35 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/dataTables.responsive.min.js'));
|
|
|
36 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.min.js'));
|
15443 |
efrain |
37 |
|
|
|
38 |
|
16822 |
efrain |
39 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/select2/css/select2.min.css'));
|
|
|
40 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/select2-bootstrap4-theme/select2-bootstrap4.min.css'));
|
15443 |
efrain |
41 |
|
16822 |
efrain |
42 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/select2/js/select2.full.min.js'));
|
15443 |
efrain |
43 |
|
16822 |
efrain |
44 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/moment/moment-with-locales.min.js'));
|
|
|
45 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css'));
|
|
|
46 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js'));
|
15443 |
efrain |
47 |
|
|
|
48 |
|
16822 |
efrain |
49 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
|
|
|
50 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
|
15443 |
efrain |
51 |
|
|
|
52 |
|
|
|
53 |
|
16822 |
efrain |
54 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-input-number/input-number-format.jquery.js'));
|
15443 |
efrain |
55 |
|
|
|
56 |
|
|
|
57 |
|
16822 |
efrain |
58 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jsrender/jsrender.min.js'));
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
|
15443 |
efrain |
62 |
$status_active = \LeadersLinked\Model\PerformanceEvaluationForm::STATUS_ACTIVE;
|
|
|
63 |
$status_inactive = \LeadersLinked\Model\PerformanceEvaluationForm::STATUS_INACTIVE;
|
|
|
64 |
|
|
|
65 |
$vars = "var jobs_description = new Array(); \r\n";
|
|
|
66 |
|
16320 |
stevensc |
67 |
foreach ($jobsDescription as $uuid => $link) {
|
15443 |
efrain |
68 |
$vars .= "jobs_description.push({uuid: '$uuid', link: '$link'}); \r\n";
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
$this->inlineScript()->captureStart();
|
|
|
75 |
echo <<<JS
|
|
|
76 |
jQuery(document).ready(function($) {
|
|
|
77 |
$vars
|
|
|
78 |
var allowEdit = $allowEdit;
|
|
|
79 |
var allowDelete = $allowDelete;
|
|
|
80 |
var allowReport = $allowReport;
|
|
|
81 |
var allowActive = $allowActive;
|
|
|
82 |
var allowInactive = $allowInactive;
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
var competencies_selected = new Array();
|
|
|
86 |
var subordinates_selected = new Array();
|
|
|
87 |
|
|
|
88 |
var competency_types = new Array();
|
|
|
89 |
var competencies = new Array();
|
|
|
90 |
var behaviors = new Array();
|
|
|
91 |
var subordinates = new Array();
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
|
96 |
$.fn.renderCompetencies = function() {
|
|
|
97 |
|
|
|
98 |
if(competencies_selected.length > 0) {
|
|
|
99 |
$('#competencies-to-job').show();
|
|
|
100 |
$('#rows-job-competencies').html($('#competencyTemplate').render(competencies_selected, {
|
|
|
101 |
getCompetencyType: (uuid) => competency_types.filter((item) => item.uuid == uuid ? item : false)[0],
|
|
|
102 |
getCompetency: (uuid) => competencies.filter((item) => item.uuid == uuid ? item : false)[0],
|
|
|
103 |
getBehavior: (uuid) => behaviors.filter((item) => item.uuid == uuid ? item : false)[0]
|
|
|
104 |
}));
|
|
|
105 |
} else {
|
|
|
106 |
|
|
|
107 |
$('#competencies-to-job').hide();
|
|
|
108 |
$('#rows-job-competencies').empty();
|
11960 |
stevensc |
109 |
}
|
15443 |
efrain |
110 |
}
|
|
|
111 |
|
|
|
112 |
$.fn.renderSubordinates = function() {
|
|
|
113 |
|
|
|
114 |
|
|
|
115 |
if(subordinates_selected.length > 0) {
|
|
|
116 |
$('#renderSubordinates').html($('#subordinateTemplate').render(subordinates_selected, {
|
|
|
117 |
getSubordinate: (uuid) => subordinates.filter((item) => item.uuid == uuid ? item : false)[0],
|
|
|
118 |
|
|
|
119 |
}));
|
|
|
120 |
} else {
|
|
|
121 |
$('#renderSubordinates').html('');
|
|
|
122 |
}
|
|
|
123 |
}
|
|
|
124 |
|
|
|
125 |
|
|
|
126 |
$.validator.setDefaults({
|
|
|
127 |
debug: true,
|
|
|
128 |
highlight: function(element) {
|
|
|
129 |
$(element).addClass('is-invalid');
|
|
|
130 |
},
|
|
|
131 |
unhighlight: function(element) {
|
|
|
132 |
$(element).removeClass('is-invalid');
|
|
|
133 |
},
|
|
|
134 |
errorElement: 'span',
|
|
|
135 |
errorClass: 'error invalid-feedback',
|
|
|
136 |
errorPlacement: function(error, element) {
|
|
|
137 |
if (element.parent('.form-group').length) {
|
|
|
138 |
error.insertAfter(element);
|
|
|
139 |
} else if (element.parent('.toggle').length) {
|
|
|
140 |
error.insertAfter(element.parent().parent());
|
|
|
141 |
} else {
|
|
|
142 |
error.insertAfter(element.parent());
|
|
|
143 |
}
|
|
|
144 |
}
|
|
|
145 |
});
|
|
|
146 |
|
|
|
147 |
$.fn.showFormErrorValidator = function(fieldname, errors) {
|
|
|
148 |
var field = $(fieldname);
|
|
|
149 |
if (field) {
|
|
|
150 |
$(field).addClass('is-invalid');
|
|
|
151 |
var error = $('<span id="' + fieldname + '-error" class="error invalid-feedback">' + errors + '</div>');
|
|
|
152 |
if (field.parent('.form-group').length) {
|
|
|
153 |
error.insertAfter(field);
|
|
|
154 |
} else if (field.parent('.toggle').length) {
|
|
|
155 |
error.insertAfter(field.parent().parent());
|
|
|
156 |
} else {
|
|
|
157 |
error.insertAfter(field.parent());
|
|
|
158 |
}
|
|
|
159 |
}
|
|
|
160 |
};
|
|
|
161 |
|
|
|
162 |
var gridTable = $('#gridTable').dataTable({
|
|
|
163 |
'processing': true,
|
|
|
164 |
'serverSide': true,
|
|
|
165 |
'searching': true,
|
|
|
166 |
'order': [
|
|
|
167 |
[0, 'asc']
|
|
|
168 |
],
|
|
|
169 |
'ordering': false,
|
|
|
170 |
'ordenable': false,
|
|
|
171 |
'responsive': true,
|
|
|
172 |
'select': false,
|
|
|
173 |
'paging': true,
|
|
|
174 |
'pagingType': 'simple_numbers',
|
|
|
175 |
'ajax': {
|
|
|
176 |
'url': '$routeDatatable',
|
|
|
177 |
'type': 'get',
|
|
|
178 |
'beforeSend': function(request) {
|
|
|
179 |
NProgress.start();
|
|
|
180 |
},
|
|
|
181 |
'dataFilter': function(response) {
|
|
|
182 |
var response = jQuery.parseJSON(response);
|
|
|
183 |
var json = {};
|
|
|
184 |
json.recordsTotal = 0;
|
|
|
185 |
json.recordsFiltered = 0;
|
|
|
186 |
json.data = [];
|
|
|
187 |
if (response.success) {
|
|
|
188 |
json.recordsTotal = response.data.total;
|
|
|
189 |
json.recordsFiltered = response.data.total;
|
|
|
190 |
json.data = response.data.items;
|
|
|
191 |
} else {
|
|
|
192 |
$.fn.showError(response.data)
|
|
|
193 |
}
|
|
|
194 |
return JSON.stringify(json);
|
|
|
195 |
}
|
|
|
196 |
},
|
|
|
197 |
'language': {
|
|
|
198 |
'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
|
|
|
199 |
'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
|
|
|
200 |
'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
|
|
|
201 |
'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
|
|
|
202 |
'sInfo': 'LABEL_DATATABLE_SINFO',
|
|
|
203 |
'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
|
|
|
204 |
'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
|
|
|
205 |
'sInfoPostFix': '',
|
|
|
206 |
'sSearch': 'LABEL_DATATABLE_SSEARCH',
|
|
|
207 |
'sUrl': '',
|
|
|
208 |
'sInfoThousands': ',',
|
|
|
209 |
'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
|
|
|
210 |
'oPaginate': {
|
|
|
211 |
'sFirst': 'LABEL_DATATABLE_SFIRST',
|
|
|
212 |
'sLast': 'LABEL_DATATABLE_SLAST',
|
|
|
213 |
'sNext': 'LABEL_DATATABLE_SNEXT',
|
|
|
214 |
'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
|
|
|
215 |
},
|
|
|
216 |
'oAria': {
|
|
|
217 |
'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
|
|
|
218 |
'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
|
|
|
219 |
},
|
|
|
220 |
},
|
|
|
221 |
'drawCallback': function(settings) {
|
|
|
222 |
NProgress.done();
|
16822 |
efrain |
223 |
|
15443 |
efrain |
224 |
},
|
|
|
225 |
'aoColumns': [{
|
|
|
226 |
'mDataProp': 'name'
|
|
|
227 |
},
|
|
|
228 |
{
|
|
|
229 |
'mDataProp': 'tests'
|
|
|
230 |
},
|
|
|
231 |
{
|
|
|
232 |
'mDataProp': 'date'
|
|
|
233 |
},
|
|
|
234 |
{
|
|
|
235 |
'mDataProp': 'status'
|
|
|
236 |
},
|
|
|
237 |
{
|
|
|
238 |
'mDataProp': 'actions'
|
|
|
239 |
},
|
|
|
240 |
],
|
|
|
241 |
'columnDefs': [
|
|
|
242 |
{
|
|
|
243 |
'targets': 0,
|
|
|
244 |
'orderable': false,
|
|
|
245 |
'render': function(data, type, row) {
|
|
|
246 |
return row['name'] + '<br>' + row['job_description'];
|
|
|
247 |
}
|
|
|
248 |
},
|
|
|
249 |
{
|
|
|
250 |
'targets': 1,
|
|
|
251 |
'orderable': false,
|
|
|
252 |
'className': 'text-right',
|
|
|
253 |
},
|
|
|
254 |
{
|
|
|
255 |
'targets': 2,
|
|
|
256 |
'orderable': false,
|
|
|
257 |
|
|
|
258 |
},
|
|
|
259 |
{
|
|
|
260 |
'targets': -2,
|
|
|
261 |
'orderable': false,
|
|
|
262 |
'className': 'text-center',
|
|
|
263 |
'render': function(data, type, row) {
|
16822 |
efrain |
264 |
checked = data == 'a' ? 'checked' : '';
|
|
|
265 |
return '<div class="form-check">' +
|
|
|
266 |
'<input type="checkbox" class="form-check-input" disabled="" checked="' + checked + '">' +
|
|
|
267 |
'<label class="form-check-label" for="checkCheckedDisabled"></label></div>' ;
|
15443 |
efrain |
268 |
}
|
|
|
269 |
},
|
|
|
270 |
{
|
|
|
271 |
'targets': -1,
|
|
|
272 |
'orderable': false,
|
|
|
273 |
'render': function(data, type, row) {
|
|
|
274 |
s = '';
|
|
|
275 |
if (allowEdit && data['link_edit']) {
|
16906 |
efrain |
276 |
s = s + '<button class="btn btn-primary btn-edit" data-href="' + data['link_edit'] + '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pen"></i> LABEL_EDIT </button> ';
|
15443 |
efrain |
277 |
}
|
|
|
278 |
if (allowDelete && data['link_delete']) {
|
|
|
279 |
s = s + '<button class="btn btn-danger btn-delete" data-href="' + data['link_delete'] + '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button> ';
|
|
|
280 |
}
|
|
|
281 |
if (allowActive && data['link_active']) {
|
|
|
282 |
s = s + '<button class="btn btn-default btn-active" data-href="' + data['link_active'] + '" data-toggle="tooltip" title="LABEL_ACTIVE"><i class="fa fa-check"></i> LABEL_ACTIVE </button> ';
|
|
|
283 |
}
|
|
|
284 |
if (allowInactive && data['link_inactive']) {
|
|
|
285 |
s = s + '<button class="btn btn-default btn-inactive" data-href="' + data['link_inactive'] + '" data-toggle="tooltip" title="LABEL_INACTIVE"><i class="fa fa-times"></i> LABEL_INACTIVE </button> ';
|
|
|
286 |
}
|
|
|
287 |
if (allowReport && data['link_report'] ) {
|
|
|
288 |
s = s + '<button class="btn btn-primary btn-pdf" data-href="' + data['link_report'] + '" data-toggle="tooltip" title="LABEL_PDF"><i class="fa fa-file-o"></i> LABEL_PDF </button> ';
|
|
|
289 |
}
|
|
|
290 |
return s;
|
|
|
291 |
}
|
|
|
292 |
}
|
|
|
293 |
],
|
|
|
294 |
});
|
|
|
295 |
|
|
|
296 |
|
|
|
297 |
var validator = $('#form').validate({
|
|
|
298 |
debug: true,
|
|
|
299 |
onclick: false,
|
|
|
300 |
onkeyup: false,
|
|
|
301 |
ignore: [],
|
|
|
302 |
rules: {
|
|
|
303 |
'name': {
|
|
|
304 |
required: true,
|
|
|
305 |
maxlength: 128,
|
|
|
306 |
},
|
|
|
307 |
'description': {
|
|
|
308 |
required: true,
|
|
|
309 |
maxlength: 1024,
|
|
|
310 |
},
|
|
|
311 |
|
|
|
312 |
'job_description_id' : {
|
|
|
313 |
required: true,
|
|
|
314 |
},
|
|
|
315 |
'status': {
|
|
|
316 |
required: false,
|
|
|
317 |
},
|
|
|
318 |
},
|
|
|
319 |
submitHandler: function(form) {
|
|
|
320 |
|
|
|
321 |
|
|
|
322 |
NProgress.start();
|
|
|
323 |
$.ajax({
|
|
|
324 |
'dataType': 'json',
|
|
|
325 |
'accept': 'application/json',
|
|
|
326 |
'method': 'post',
|
|
|
327 |
'url': $('#form').attr('action'),
|
|
|
328 |
'data': $('#form').serialize(),
|
|
|
329 |
}).done(function(response) {
|
|
|
330 |
if (response['success']) {
|
|
|
331 |
$.fn.showSuccess(response['data']);
|
|
|
332 |
$('#row-form').hide();
|
|
|
333 |
$('#row-list').show();
|
|
|
334 |
$('#row-header').show();
|
|
|
335 |
|
|
|
336 |
gridTable.api().ajax.reload(null, false);
|
|
|
337 |
} else {
|
|
|
338 |
validator.resetForm();
|
|
|
339 |
if (jQuery.type(response['data']) == 'string') {
|
|
|
340 |
$.fn.showError(response['data']);
|
|
|
341 |
} else {
|
|
|
342 |
$.each(response['data'], function(fieldname, errors) {
|
|
|
343 |
$.fn.showFormErrorValidator('#form #' + fieldname, errors);
|
|
|
344 |
});
|
|
|
345 |
}
|
|
|
346 |
}
|
|
|
347 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
348 |
$.fn.showError(textStatus);
|
|
|
349 |
}).always(function() {
|
|
|
350 |
NProgress.done();
|
|
|
351 |
});
|
|
|
352 |
return false;
|
|
|
353 |
},
|
|
|
354 |
invalidHandler: function(form, validator) {}
|
|
|
355 |
});
|
|
|
356 |
|
|
|
357 |
$('body').on('click', 'button.btn-active', function(e) {
|
|
|
358 |
e.preventDefault();
|
|
|
359 |
|
|
|
360 |
var action = $(this).data('href');
|
|
|
361 |
$.ajax({
|
|
|
362 |
'dataType': 'json',
|
|
|
363 |
'accept': 'application/json',
|
|
|
364 |
'method': 'post',
|
|
|
365 |
'url': action,
|
|
|
366 |
}).done(function(response) {
|
|
|
367 |
if (response['success']) {
|
|
|
368 |
gridTable.api().ajax.reload(null, false);
|
|
|
369 |
} else {
|
|
|
370 |
$.fn.showError(response['message']);
|
|
|
371 |
}
|
|
|
372 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
373 |
$.fn.showError(textStatus);
|
|
|
374 |
});
|
|
|
375 |
});
|
|
|
376 |
|
|
|
377 |
$('body').on('click', 'button.btn-inactive', function(e) {
|
|
|
378 |
e.preventDefault();
|
|
|
379 |
|
|
|
380 |
var action = $(this).data('href');
|
|
|
381 |
$.ajax({
|
|
|
382 |
'dataType': 'json',
|
|
|
383 |
'accept': 'application/json',
|
|
|
384 |
'method': 'post',
|
|
|
385 |
'url': action,
|
|
|
386 |
}).done(function(response) {
|
|
|
387 |
if (response['success']) {
|
|
|
388 |
gridTable.api().ajax.reload(null, false);
|
|
|
389 |
} else {
|
|
|
390 |
$.fn.showError(response['message']);
|
|
|
391 |
}
|
|
|
392 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
393 |
$.fn.showError(textStatus);
|
|
|
394 |
});
|
|
|
395 |
});
|
|
|
396 |
|
|
|
397 |
|
|
|
398 |
$('body').on('click', 'button.btn-edit', function(e) {
|
|
|
399 |
e.preventDefault();
|
|
|
400 |
|
|
|
401 |
var action = $(this).data('href');
|
|
|
402 |
$.ajax({
|
|
|
403 |
'dataType': 'json',
|
|
|
404 |
'accept': 'application/json',
|
|
|
405 |
'method': 'get',
|
|
|
406 |
'url': action,
|
|
|
407 |
}).done(function(response) {
|
|
|
408 |
if (response['success']) {
|
|
|
409 |
$('#form').attr('action', action);
|
|
|
410 |
$('#form #name').val(response['data']['name']);
|
|
|
411 |
$('#form #description').val(response['data']['description']);
|
|
|
412 |
$('#form #job_description_id').val(response['data']['job_description_id']).trigger('change');
|
|
|
413 |
$('#form #status').bootstrapToggle(response['data']['status'] == '$status_active' ? 'on' : 'off')
|
|
|
414 |
|
|
|
415 |
$('#row-list').hide();
|
|
|
416 |
$('#row-header').hide();
|
|
|
417 |
$('#row-form').show();
|
|
|
418 |
} else {
|
|
|
419 |
$.fn.showError(response['message']);
|
|
|
420 |
}
|
|
|
421 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
422 |
$.fn.showError(textStatus);
|
|
|
423 |
});
|
|
|
424 |
});
|
|
|
425 |
|
|
|
426 |
$('button.btn-add').click(function(e) {
|
|
|
427 |
e.preventDefault();
|
|
|
428 |
|
16840 |
efrain |
429 |
|
15443 |
efrain |
430 |
$('#form').attr('action', '$routeAdd');
|
|
|
431 |
$('#form #name').val('');
|
|
|
432 |
$('#form #job_description_id').val('').trigger('change');
|
|
|
433 |
$('#form #job_description_id').prop('disabled', false);
|
|
|
434 |
$('#form #status').bootstrapToggle('on');
|
|
|
435 |
$('#form #description').val('');
|
|
|
436 |
|
|
|
437 |
|
|
|
438 |
$.fn.renderCompetencies();
|
|
|
439 |
|
|
|
440 |
|
|
|
441 |
$('#row-header').hide();
|
|
|
442 |
$('#row-list').hide();
|
|
|
443 |
$('#row-form').show();
|
|
|
444 |
|
|
|
445 |
});
|
|
|
446 |
|
|
|
447 |
|
|
|
448 |
|
|
|
449 |
$('button.btn-cancel').click(function(e) {
|
|
|
450 |
e.preventDefault();
|
|
|
451 |
|
|
|
452 |
$('#row-form').hide();
|
|
|
453 |
$('#row-list').show();
|
|
|
454 |
$('#row-header').show();
|
|
|
455 |
});
|
|
|
456 |
|
|
|
457 |
$('#form #description').maxlength({
|
|
|
458 |
alwaysShow: true,
|
|
|
459 |
validate: true
|
|
|
460 |
});
|
|
|
461 |
|
16822 |
efrain |
462 |
$('body').on('click', 'button.btn-delete', function(e) {
|
|
|
463 |
e.preventDefault();
|
|
|
464 |
var action = $(this).data('href');
|
15443 |
efrain |
465 |
|
|
|
466 |
|
16822 |
efrain |
467 |
swal.fire({
|
|
|
468 |
title: 'LABEL_ARE_YOU_SURE',
|
|
|
469 |
icon: 'question',
|
|
|
470 |
cancelButtonText: 'LABEL_NO',
|
|
|
471 |
showCancelButton: true,
|
|
|
472 |
confirmButtonText: 'LABEL_YES'
|
|
|
473 |
}).then((result) => {
|
|
|
474 |
if (result.isConfirmed) {
|
15443 |
efrain |
475 |
|
16822 |
efrain |
476 |
NProgress.start();
|
|
|
477 |
$.ajax({
|
|
|
478 |
'dataType' : 'json',
|
|
|
479 |
'accept' : 'application/json',
|
|
|
480 |
'method' : 'post',
|
|
|
481 |
'url' : action,
|
|
|
482 |
}).done(function(response) {
|
|
|
483 |
if(response['success']) {
|
|
|
484 |
$.fn.showSuccess(response['data']);
|
|
|
485 |
gridTable.api().ajax.reload(null, false);
|
|
|
486 |
} else {
|
|
|
487 |
$.fn.showError(response['data']);
|
|
|
488 |
}
|
|
|
489 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
490 |
$.fn.showError(textStatus);
|
|
|
491 |
}).always(function() {
|
|
|
492 |
NProgress.done();
|
|
|
493 |
});
|
|
|
494 |
}
|
|
|
495 |
});
|
|
|
496 |
});
|
15443 |
efrain |
497 |
|
16822 |
efrain |
498 |
|
15443 |
efrain |
499 |
|
|
|
500 |
$('#form #status').bootstrapToggle({
|
|
|
501 |
'on': 'LABEL_ACTIVE',
|
|
|
502 |
'off': 'LABEL_INACTIVE',
|
|
|
503 |
'width': '160px',
|
|
|
504 |
'height': '40px'
|
|
|
505 |
});
|
|
|
506 |
|
|
|
507 |
$('body').on('click', 'button.btn-refresh', function(e) {
|
|
|
508 |
e.preventDefault();
|
|
|
509 |
gridTable.api().ajax.reload(null, false);
|
|
|
510 |
});
|
|
|
511 |
|
|
|
512 |
|
|
|
513 |
|
|
|
514 |
$('#job_description_id').select2({
|
|
|
515 |
theme: 'bootstrap4',
|
|
|
516 |
width: '100%',
|
|
|
517 |
});
|
|
|
518 |
|
|
|
519 |
$('#job_description_id').on('change', function(e) {
|
|
|
520 |
e.preventDefault();
|
|
|
521 |
|
|
|
522 |
var uuid = $('#job_description_id').val();
|
|
|
523 |
var job_description = jobs_description.filter((item) => item.uuid == uuid ? item : false)[0];
|
|
|
524 |
|
|
|
525 |
if (job_description) {
|
|
|
526 |
NProgress.start();
|
|
|
527 |
$.getJSON(job_description.link, function(response) {
|
|
|
528 |
if (response['success']) {
|
|
|
529 |
behaviors = response['data']['behaviors'];
|
|
|
530 |
competency_types = response['data']['competency_types'];
|
|
|
531 |
competencies = response['data']['competencies'];
|
|
|
532 |
|
|
|
533 |
|
|
|
534 |
competencies_selected = response['data']['competencies_selected'];
|
|
|
535 |
subordinates_selected = response['data']['subordinates_selected'];
|
|
|
536 |
|
|
|
537 |
$.fn.renderCompetencies();
|
|
|
538 |
|
|
|
539 |
} else {
|
|
|
540 |
|
|
|
541 |
$.fn.showError(response['data'])
|
|
|
542 |
}
|
|
|
543 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
544 |
$.fn.showError(textStatus);
|
|
|
545 |
}).always(function() {
|
|
|
546 |
NProgress.done();
|
|
|
547 |
});
|
|
|
548 |
}
|
|
|
549 |
|
|
|
550 |
});
|
|
|
551 |
|
|
|
552 |
$('body').on('click', 'button.btn-pdf', function(e) {
|
|
|
553 |
e.preventDefault();
|
|
|
554 |
var action = $(this).data('href');
|
|
|
555 |
|
|
|
556 |
|
|
|
557 |
NProgress.start();
|
|
|
558 |
$.ajax({
|
|
|
559 |
'dataType' : 'json',
|
|
|
560 |
'method' : 'get',
|
|
|
561 |
'url' : action,
|
|
|
562 |
}).done(function(response) {
|
|
|
563 |
if(response['success']) {
|
|
|
564 |
var anchor = window.document.createElement("a");
|
|
|
565 |
anchor.href = 'data:application/octet-stream;charset=utf-8;base64,' + response['data']['content'] ;
|
|
|
566 |
anchor.download = response['data']['basename'];
|
|
|
567 |
document.body.appendChild(anchor);
|
|
|
568 |
anchor.click(); // IE: "Access is denied"; see: https://connect.microsoft.com/IE/feedback/details/797361/ie-10-treats-blob-url-as-cross-origin-and-denies-access
|
|
|
569 |
document.body.removeChild(anchor);
|
|
|
570 |
} else {
|
|
|
571 |
$.fn.showError(response['data']);
|
|
|
572 |
}
|
|
|
573 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
574 |
$.fn.showError(textStatus);
|
|
|
575 |
}).always(function() {
|
|
|
576 |
NProgress.done();
|
|
|
577 |
});
|
|
|
578 |
|
|
|
579 |
|
|
|
580 |
|
|
|
581 |
});
|
|
|
582 |
|
|
|
583 |
|
|
|
584 |
$('#form #description').maxlength({
|
|
|
585 |
alwaysShow: true,
|
|
|
586 |
validate: true
|
|
|
587 |
});
|
|
|
588 |
|
|
|
589 |
});
|
11960 |
stevensc |
590 |
JS;
|
|
|
591 |
|
15443 |
efrain |
592 |
$this->inlineScript()->captureEnd();
|
977 |
geraldo |
593 |
?>
|
16846 |
efrain |
594 |
|
|
|
595 |
<div class="container">
|
|
|
596 |
<div class="card" id="row-header">
|
|
|
597 |
<div class="card-header">
|
|
|
598 |
<h6 class="card-title">LABEL_FORMS</h6>
|
|
|
599 |
</div>
|
|
|
600 |
<div class="card-body">
|
|
|
601 |
<table id="gridTable" class="table table-bordered">
|
|
|
602 |
<thead>
|
16320 |
stevensc |
603 |
<tr>
|
|
|
604 |
<th style="width:30%">LABEL_NAME</th>
|
|
|
605 |
<th style="width:15%">LABEL_EVALUATIONS</th>
|
|
|
606 |
<th style="width:15%">LABEL_DATE</th>
|
|
|
607 |
<th style="width:10%">LABEL_ACTIVE</th>
|
|
|
608 |
<th style="width:30%">LABEL_ACTIONS</th>
|
|
|
609 |
</tr>
|
16846 |
efrain |
610 |
</thead>
|
|
|
611 |
<tbody></tbody>
|
|
|
612 |
</table>
|
|
|
613 |
</div>
|
|
|
614 |
<div class="card-footer text-right">
|
|
|
615 |
<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
|
|
|
616 |
<?php if ($allowAdd) : ?>
|
|
|
617 |
<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
|
|
|
618 |
<?php endif; ?>
|
|
|
619 |
</div>
|
|
|
620 |
</div>
|
|
|
621 |
|
|
|
622 |
<div class="card" id="row-form" style="display: none">
|
|
|
623 |
<?php
|
|
|
624 |
$form = $this->form;
|
|
|
625 |
$form->setAttributes([
|
|
|
626 |
'method' => 'post',
|
|
|
627 |
'name' => 'form',
|
|
|
628 |
'id' => 'form'
|
|
|
629 |
]);
|
11960 |
stevensc |
630 |
|
16846 |
efrain |
631 |
$form->prepare();
|
|
|
632 |
echo $this->form()->openTag($form);
|
|
|
633 |
?>
|
|
|
634 |
<div class="card-header">
|
|
|
635 |
<h6 class="modal-title">LABEL_PERFORMANCE_EVALUATION</h6>
|
|
|
636 |
</div>
|
|
|
637 |
<div class="card-body">
|
|
|
638 |
<div class="row">
|
|
|
639 |
<div class="col-12 mt-3">
|
16320 |
stevensc |
640 |
<?php
|
15443 |
efrain |
641 |
$element = $form->get('job_description_id');
|
|
|
642 |
$element->setOptions(['label' => 'LABEL_JOB_DESCRIPTION']);
|
|
|
643 |
$element->setAttributes(['class' => 'form-control']);
|
16320 |
stevensc |
644 |
|
15443 |
efrain |
645 |
echo $this->formLabel($element);
|
|
|
646 |
echo $this->formSelect($element);
|
|
|
647 |
?>
|
16846 |
efrain |
648 |
</div>
|
|
|
649 |
</div>
|
|
|
650 |
<div class="row">
|
|
|
651 |
<div class="col-12 mt-3">
|
16320 |
stevensc |
652 |
<?php
|
15443 |
efrain |
653 |
$element = $form->get('name');
|
|
|
654 |
$element->setOptions(['label' => 'LABEL_NAME']);
|
|
|
655 |
$element->setAttributes(['class' => 'form-control']);
|
16320 |
stevensc |
656 |
|
15443 |
efrain |
657 |
echo $this->formLabel($element);
|
|
|
658 |
echo $this->formText($element);
|
|
|
659 |
?>
|
16846 |
efrain |
660 |
</div>
|
|
|
661 |
</div>
|
|
|
662 |
<div class="row">
|
|
|
663 |
<div class="col-12 mt-3">
|
16320 |
stevensc |
664 |
<?php
|
15443 |
efrain |
665 |
$element = $form->get('description');
|
|
|
666 |
$element->setOptions(['label' => 'LABEL_DESCRIPTION']);
|
|
|
667 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
668 |
|
|
|
669 |
echo $this->formLabel($element);
|
|
|
670 |
echo $this->formTextArea($element);
|
16320 |
stevensc |
671 |
?>
|
16846 |
efrain |
672 |
</div>
|
|
|
673 |
</div>
|
|
|
674 |
<div class="row">
|
|
|
675 |
<div class="col-12 mt-3">
|
16320 |
stevensc |
676 |
<?php
|
15443 |
efrain |
677 |
$element = $form->get('status');
|
|
|
678 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
679 |
echo $this->formCheckbox($element);
|
16320 |
stevensc |
680 |
?>
|
16846 |
efrain |
681 |
</div>
|
|
|
682 |
</div>
|
|
|
683 |
|
|
|
684 |
<div class="row">
|
|
|
685 |
<div class="col-12 mt-3" id="competencies-to-job" style="display:none">
|
|
|
686 |
<h6 style="font-size: 18px;font-weight: bold;">LABEL_COMPETENCIES_TO_JOB:</h6>
|
|
|
687 |
<div class="panel-group" id="rows-job-competencies"></div>
|
|
|
688 |
</div>
|
|
|
689 |
</div>
|
|
|
690 |
</div>
|
16320 |
stevensc |
691 |
|
16846 |
efrain |
692 |
<div class="card-footer text-right">
|
|
|
693 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
|
|
694 |
<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
|
|
|
695 |
</div>
|
15443 |
efrain |
696 |
|
16846 |
efrain |
697 |
<?php echo $this->form()->closeTag($form); ?>
|
|
|
698 |
</div>
|
|
|
699 |
</div>
|
15443 |
efrain |
700 |
|
|
|
701 |
|
16846 |
efrain |
702 |
|
|
|
703 |
|
15443 |
efrain |
704 |
<script id="competencyTemplate" type="text/x-jsrender">
|
16320 |
stevensc |
705 |
<div class="panel panel-default panel-competency" id="panel-{{:uuid}}" data-competency="{{:uuid}}">
|
15443 |
efrain |
706 |
<div class="panel-heading">
|
16845 |
efrain |
707 |
<h6 class="panel-title" style=" font-size: 18px;">
|
15443 |
efrain |
708 |
<a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:uuid}}" href="#collapse-{{:uuid}}">
|
|
|
709 |
<span class="section-name{{:uuid}}">
|
|
|
710 |
{{:~getCompetencyType(competency_type_uuid).name}} - {{:~getCompetency(uuid).name}}
|
|
|
711 |
</span>
|
|
|
712 |
</a>
|
16845 |
efrain |
713 |
</h6>
|
15443 |
efrain |
714 |
</div>
|
|
|
715 |
<div id="collapse-{{:uuid}}" class="panel-collapse in collapse show">
|
|
|
716 |
<div class="panel-body">
|
|
|
717 |
<div class="table-responsive">
|
|
|
718 |
<table class="table table-bordered">
|
|
|
719 |
<thead>
|
|
|
720 |
<tr>
|
|
|
721 |
<th style="width: 30%;">LABEL_ELEMENT</th>
|
|
|
722 |
<th style="width: 60%;">LABEL_TITLE</th>
|
|
|
723 |
<th style="width: 10%;">LABEL_LEVEL</th>
|
|
|
724 |
|
|
|
725 |
</tr>
|
|
|
726 |
</thead>
|
|
|
727 |
<tbody>
|
|
|
728 |
<tr>
|
|
|
729 |
<td class="text-left">LABEL_COMPETENCY</td>
|
|
|
730 |
<td class="text-left">{{:name}}</td>
|
|
|
731 |
<td> </td>
|
|
|
732 |
|
|
|
733 |
</tr>
|
|
|
734 |
{{for behaviors}}
|
|
|
735 |
<tr >
|
|
|
736 |
<td class="text-left">--LABEL_BEHAVIOR</td>
|
|
|
737 |
<td class="text-left">
|
|
|
738 |
{{:~getBehavior(uuid).description}}
|
|
|
739 |
</td>
|
|
|
740 |
<td class="text-right">
|
|
|
741 |
{{:level}}
|
|
|
742 |
</td>
|
|
|
743 |
|
|
|
744 |
</tr>
|
|
|
745 |
{{/for}}
|
|
|
746 |
</tbody>
|
|
|
747 |
</table>
|
|
|
748 |
</div>
|
|
|
749 |
</div>
|
|
|
750 |
</div>
|
12154 |
stevensc |
751 |
</div>
|
15443 |
efrain |
752 |
</script>
|
|
|
753 |
|
|
|
754 |
|
|
|
755 |
<script id="competencyTemplateWithNivel" type="text/x-jsrender">
|
16320 |
stevensc |
756 |
<div class="panel panel-default panel-competency" id="panel-{{:uuid}}" data-competency="{{:uuid}}">
|
15443 |
efrain |
757 |
<div class="panel-heading">
|
16845 |
efrain |
758 |
<h6 class="panel-title" style=" font-size: 18px;">
|
15443 |
efrain |
759 |
<a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:uuid}}" href="#collapse-{{:uuid}}">
|
|
|
760 |
<span class="section-name{{:uuid}}">
|
|
|
761 |
{{:~getCompetencyType(competency_type_uuid).name}} - {{:~getCompetency(uuid).name}}
|
|
|
762 |
</span>
|
|
|
763 |
</a>
|
16845 |
efrain |
764 |
</h6>
|
15443 |
efrain |
765 |
</div>
|
|
|
766 |
<div id="collapse-{{:uuid}}" class="panel-collapse in collapse show">
|
|
|
767 |
<div class="panel-body">
|
|
|
768 |
<div class="table-responsive">
|
|
|
769 |
<table class="table table-bordered">
|
|
|
770 |
<thead>
|
|
|
771 |
<tr>
|
|
|
772 |
<th style="width: 30%;">LABEL_ELEMENT</th>
|
|
|
773 |
<th style="width: 60%;">LABEL_TITLE</th>
|
|
|
774 |
<th style="width: 10%;">LABEL_LEVEL</th>
|
|
|
775 |
|
|
|
776 |
</tr>
|
|
|
777 |
</thead>
|
|
|
778 |
<tbody>
|
|
|
779 |
<tr>
|
|
|
780 |
<td class="text-left">LABEL_COMPETENCY</td>
|
|
|
781 |
<td class="text-left">{{:name}}</td>
|
|
|
782 |
<td> </td>
|
|
|
783 |
|
|
|
784 |
</tr>
|
|
|
785 |
{{for behaviors}}
|
|
|
786 |
<tr >
|
|
|
787 |
<td class="text-left">--LABEL_BEHAVIOR</td>
|
|
|
788 |
<td class="text-left">
|
|
|
789 |
{{:~getBehavior(uuid).description}}
|
|
|
790 |
</td>
|
|
|
791 |
<td>
|
|
|
792 |
{{if level == '0'}} LABEL_NA {{/if}}
|
|
|
793 |
{{if level == '1' }} LABEL_LEVEL_ONE {{/if}}
|
|
|
794 |
{{if level == '2' }} LABEL_LEVEL_TWO {{/if}}
|
|
|
795 |
{{if level == '3' }} LABEL_LEVEL_THREE {{/if}}
|
|
|
796 |
{{if level == '4' }} LABEL_LEVEL_FOUR {{/if}}
|
|
|
797 |
</td>
|
|
|
798 |
|
|
|
799 |
</tr>
|
|
|
800 |
{{/for}}
|
|
|
801 |
</tbody>
|
|
|
802 |
</table>
|
|
|
803 |
</div>
|
|
|
804 |
</div>
|
|
|
805 |
</div>
|
|
|
806 |
</div>
|
|
|
807 |
</script>
|