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