66 |
efrain |
1 |
<?php
|
|
|
2 |
use LeadersLinked\Model\JobDescription;
|
|
|
3 |
|
|
|
4 |
$acl = $this->viewModel()->getRoot()->getVariable('acl');
|
|
|
5 |
$currentUser = $this->currentUserHelper();
|
|
|
6 |
|
|
|
7 |
$roleName = $currentUser->getUserTypeId();
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
$routeAdd = $this->url('settings/jobs-description/add');
|
|
|
11 |
$routeDatatable = $this->url('settings/jobs-description');
|
846 |
geraldo |
12 |
$routeImport = $this->url('settings/jobs-description/import');
|
66 |
efrain |
13 |
$routeDashboard = $this->url('dashboard');
|
|
|
14 |
|
|
|
15 |
$allowAdd = $acl->isAllowed($roleName, 'settings/jobs-description/add') ? 1 : 0;
|
|
|
16 |
$allowEdit = $acl->isAllowed($roleName, 'settings/jobs-description/edit') ? 1 : 0;
|
|
|
17 |
$allowDelete = $acl->isAllowed($roleName, 'settings/jobs-description/delete') ? 1 : 0;
|
561 |
geraldo |
18 |
$allowReport = $acl->isAllowed($roleName, 'settings/jobs-description/report') ? 1 : 0;
|
846 |
geraldo |
19 |
$allowImport = $acl->isAllowed($roleName, 'settings/jobs-description/import') ? 1 : 0;
|
66 |
efrain |
20 |
|
|
|
21 |
|
|
|
22 |
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
|
|
|
23 |
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
|
|
|
24 |
|
|
|
25 |
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
|
|
|
29 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
|
|
|
30 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
|
|
|
31 |
|
|
|
32 |
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
|
|
|
33 |
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
|
|
|
34 |
|
|
|
35 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
|
|
|
36 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
|
|
|
37 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
|
|
|
38 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
|
|
|
42 |
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
|
|
|
43 |
|
|
|
44 |
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
|
|
|
45 |
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
$status_active = JobDescription::STATUS_ACTIVE;
|
|
|
49 |
|
|
|
50 |
$this->inlineScript()->captureStart();
|
|
|
51 |
echo <<<JS
|
1161 |
geraldo |
52 |
|
1166 |
geraldo |
53 |
let competencies = [];
|
|
|
54 |
let competencies_type = [];
|
|
|
55 |
let subordinates = [];
|
|
|
56 |
let competencies_selected = [];
|
|
|
57 |
let subordinates_selected = [];
|
938 |
geraldo |
58 |
jQuery(document).ready(function($) {
|
935 |
geraldo |
59 |
$.validator.setDefaults({
|
|
|
60 |
debug: true,
|
|
|
61 |
highlight: function(element) {
|
|
|
62 |
$(element).addClass('is-invalid');
|
|
|
63 |
},
|
|
|
64 |
unhighlight: function(element) {
|
|
|
65 |
$(element).removeClass('is-invalid');
|
|
|
66 |
},
|
|
|
67 |
errorElement: 'span',
|
|
|
68 |
errorClass: 'error invalid-feedback',
|
|
|
69 |
errorPlacement: function(error, element) {
|
|
|
70 |
if (element.parent('.form-group').length) {
|
|
|
71 |
error.insertAfter(element);
|
|
|
72 |
} else if (element.parent('.toggle').length) {
|
|
|
73 |
error.insertAfter(element.parent().parent());
|
|
|
74 |
} else {
|
|
|
75 |
error.insertAfter(element.parent());
|
|
|
76 |
}
|
|
|
77 |
}
|
|
|
78 |
});
|
|
|
79 |
$.fn.showFormErrorValidator = function(fieldname, errors) {
|
|
|
80 |
var field = $(fieldname);
|
|
|
81 |
if (field) {
|
|
|
82 |
$(field).addClass('is-invalid');
|
|
|
83 |
var error = $('<span id="' + fieldname + '-error" class="error invalid-feedback">' + errors + '</div>');
|
|
|
84 |
if (field.parent('.form-group').length) {
|
|
|
85 |
error.insertAfter(field);
|
|
|
86 |
} else if (field.parent('.toggle').length) {
|
|
|
87 |
error.insertAfter(field.parent().parent());
|
|
|
88 |
} else {
|
|
|
89 |
error.insertAfter(field.parent());
|
|
|
90 |
}
|
|
|
91 |
}
|
|
|
92 |
};
|
|
|
93 |
var allowEdit = $allowEdit;
|
|
|
94 |
var allowDelete = $allowDelete;
|
|
|
95 |
var allowReport = $allowReport;
|
|
|
96 |
var gridTable = $('#gridTable').dataTable({
|
|
|
97 |
'processing': true,
|
|
|
98 |
'serverSide': true,
|
|
|
99 |
'searching': true,
|
|
|
100 |
'order': [
|
|
|
101 |
[0, 'asc']
|
|
|
102 |
],
|
|
|
103 |
'ordering': true,
|
|
|
104 |
'ordenable': true,
|
|
|
105 |
'responsive': true,
|
|
|
106 |
'select': false,
|
|
|
107 |
'paging': true,
|
|
|
108 |
'pagingType': 'simple_numbers',
|
|
|
109 |
'ajax': {
|
|
|
110 |
'url': '$routeDatatable',
|
|
|
111 |
'type': 'get',
|
|
|
112 |
'beforeSend': function(request) {
|
|
|
113 |
NProgress.start();
|
66 |
efrain |
114 |
},
|
935 |
geraldo |
115 |
'dataFilter': function(response) {
|
|
|
116 |
var response = jQuery.parseJSON(response);
|
|
|
117 |
var json = {};
|
|
|
118 |
json.recordsTotal = 0;
|
|
|
119 |
json.recordsFiltered = 0;
|
|
|
120 |
json.data = [];
|
|
|
121 |
if (response.success) {
|
|
|
122 |
json.recordsTotal = response.data.total;
|
|
|
123 |
json.recordsFiltered = response.data.total;
|
|
|
124 |
json.data = response.data.items;
|
66 |
efrain |
125 |
} else {
|
935 |
geraldo |
126 |
$.fn.showError(response.data)
|
66 |
efrain |
127 |
}
|
935 |
geraldo |
128 |
return JSON.stringify(json);
|
66 |
efrain |
129 |
}
|
935 |
geraldo |
130 |
},
|
|
|
131 |
'language': {
|
|
|
132 |
'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
|
|
|
133 |
'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
|
|
|
134 |
'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
|
|
|
135 |
'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
|
|
|
136 |
'sInfo': 'LABEL_DATATABLE_SINFO',
|
|
|
137 |
'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
|
|
|
138 |
'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
|
|
|
139 |
'sInfoPostFix': '',
|
|
|
140 |
'sSearch': 'LABEL_DATATABLE_SSEARCH',
|
|
|
141 |
'sUrl': '',
|
|
|
142 |
'sInfoThousands': ',',
|
|
|
143 |
'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
|
|
|
144 |
'oPaginate': {
|
|
|
145 |
'sFirst': 'LABEL_DATATABLE_SFIRST',
|
|
|
146 |
'sLast': 'LABEL_DATATABLE_SLAST',
|
|
|
147 |
'sNext': 'LABEL_DATATABLE_SNEXT',
|
|
|
148 |
'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
|
|
|
149 |
},
|
|
|
150 |
'oAria': {
|
|
|
151 |
'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
|
|
|
152 |
'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
|
|
|
153 |
},
|
|
|
154 |
},
|
|
|
155 |
'drawCallback': function(settings) {
|
|
|
156 |
NProgress.done();
|
|
|
157 |
$('button.btn-delete').confirmation({
|
|
|
158 |
rootSelector: 'button.btn-delete',
|
|
|
159 |
title: 'LABEL_ARE_YOU_SURE',
|
|
|
160 |
singleton: true,
|
|
|
161 |
btnOkLabel: 'LABEL_YES',
|
|
|
162 |
btnCancelLabel: 'LABEL_NO',
|
|
|
163 |
onConfirm: function(value) {
|
|
|
164 |
action = $(this).data('href');
|
|
|
165 |
NProgress.start();
|
|
|
166 |
$.ajax({
|
|
|
167 |
'dataType': 'json',
|
|
|
168 |
'accept': 'application/json',
|
|
|
169 |
'method': 'post',
|
|
|
170 |
'url': action,
|
|
|
171 |
}).done(function(response) {
|
|
|
172 |
if (response['success']) {
|
|
|
173 |
$.fn.showSuccess(response['data']);
|
|
|
174 |
gridTable.api().ajax.reload(null, false);
|
|
|
175 |
} else {
|
|
|
176 |
$.fn.showError(response['data']);
|
|
|
177 |
}
|
|
|
178 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
179 |
$.fn.showError(textStatus);
|
|
|
180 |
}).always(function() {
|
|
|
181 |
NProgress.done();
|
|
|
182 |
});
|
66 |
efrain |
183 |
},
|
935 |
geraldo |
184 |
});
|
|
|
185 |
},
|
|
|
186 |
'aoColumns': [{
|
|
|
187 |
'mDataProp': 'name'
|
|
|
188 |
},
|
|
|
189 |
{
|
|
|
190 |
'mDataProp': 'status'
|
|
|
191 |
},
|
|
|
192 |
{
|
|
|
193 |
'mDataProp': 'actions'
|
|
|
194 |
},
|
|
|
195 |
],
|
|
|
196 |
'columnDefs': [{
|
|
|
197 |
'targets': 0,
|
|
|
198 |
'className': 'text-vertical-middle',
|
|
|
199 |
},
|
|
|
200 |
{
|
|
|
201 |
'targets': -2,
|
|
|
202 |
'orderable': false,
|
|
|
203 |
'className': 'text-center',
|
|
|
204 |
'render': function(data, type, row) {
|
|
|
205 |
checked = data == 'a' ? ' checked="checked" ' : '';
|
|
|
206 |
return '<div class="checkbox checkbox-success">' +
|
|
|
207 |
'<input class="styled" type="checkbox" ' + checked + ' disabled="disabled">' +
|
|
|
208 |
'<label ></label></div>';
|
66 |
efrain |
209 |
}
|
|
|
210 |
},
|
935 |
geraldo |
211 |
{
|
|
|
212 |
'targets': -1,
|
|
|
213 |
'orderable': false,
|
|
|
214 |
'render': function(data, type, row) {
|
|
|
215 |
s = '';
|
|
|
216 |
if (allowEdit) {
|
|
|
217 |
s = s + '<button class="btn btn-primary btn-edit" data-href="' + data['link_edit'] + '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button> ';
|
66 |
efrain |
218 |
}
|
935 |
geraldo |
219 |
if (allowDelete) {
|
|
|
220 |
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> ';
|
66 |
efrain |
221 |
}
|
935 |
geraldo |
222 |
if (allowReport) {
|
|
|
223 |
s = s + '<a class="btn btn-default btn-pdf" href="' + data['link_report'] + '" target="_blank" data-toggle="tooltip" title="LABEL_PDF"><i class="fa fa-file-o"></i> LABEL_PDF </button> ';
|
|
|
224 |
}
|
|
|
225 |
return s;
|
66 |
efrain |
226 |
}
|
935 |
geraldo |
227 |
}
|
|
|
228 |
],
|
|
|
229 |
});
|
|
|
230 |
var validator = $('#form').validate({
|
|
|
231 |
debug: true,
|
|
|
232 |
onclick: false,
|
|
|
233 |
onkeyup: false,
|
|
|
234 |
ignore: [],
|
|
|
235 |
rules: {
|
|
|
236 |
'name': {
|
|
|
237 |
required: true,
|
|
|
238 |
maxlength: 64,
|
|
|
239 |
},
|
|
|
240 |
'functions': {
|
|
|
241 |
updateCkeditor: function() {
|
|
|
242 |
CKEDITOR.instances.functions.updateElement();
|
66 |
efrain |
243 |
},
|
935 |
geraldo |
244 |
required: true,
|
|
|
245 |
},
|
|
|
246 |
'objectives': {
|
|
|
247 |
updateCkeditor: function() {
|
|
|
248 |
CKEDITOR.instances.objectives.updateElement();
|
66 |
efrain |
249 |
},
|
935 |
geraldo |
250 |
required: true,
|
66 |
efrain |
251 |
},
|
935 |
geraldo |
252 |
'status': {
|
|
|
253 |
required: false,
|
66 |
efrain |
254 |
},
|
935 |
geraldo |
255 |
},
|
|
|
256 |
submitHandler: function(form) {
|
66 |
efrain |
257 |
$.ajax({
|
935 |
geraldo |
258 |
'dataType': 'json',
|
|
|
259 |
'accept': 'application/json',
|
|
|
260 |
'method': 'post',
|
|
|
261 |
'url': $('#form').attr('action'),
|
|
|
262 |
'data': $('#form').serialize()
|
66 |
efrain |
263 |
}).done(function(response) {
|
935 |
geraldo |
264 |
NProgress.start();
|
|
|
265 |
if (response['success']) {
|
|
|
266 |
$.fn.showSuccess(response['data']);
|
|
|
267 |
$('#modal').modal('hide');
|
|
|
268 |
gridTable.api().ajax.reload(null, false);
|
|
|
269 |
} else {
|
|
|
270 |
validator.resetForm();
|
|
|
271 |
if (jQuery.type(response['data']) == 'string') {
|
|
|
272 |
$.fn.showError(response['data']);
|
|
|
273 |
} else {
|
|
|
274 |
$.each(response['data'], function(fieldname, errors) {
|
|
|
275 |
$.fn.showFormErrorValidator('#form #' + fieldname, errors);
|
66 |
efrain |
276 |
});
|
935 |
geraldo |
277 |
}
|
66 |
efrain |
278 |
}
|
935 |
geraldo |
279 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
66 |
efrain |
280 |
$.fn.showError(textStatus);
|
|
|
281 |
}).always(function() {
|
|
|
282 |
NProgress.done();
|
|
|
283 |
});
|
935 |
geraldo |
284 |
return false;
|
|
|
285 |
},
|
|
|
286 |
invalidHandler: function(form, validator) {}
|
|
|
287 |
});
|
|
|
288 |
$('body').on('click', 'button.btn-add', function(e) {
|
|
|
289 |
e.preventDefault();
|
|
|
290 |
NProgress.start();
|
|
|
291 |
$.ajax({
|
|
|
292 |
'dataType': 'json',
|
|
|
293 |
'accept': 'application/json',
|
|
|
294 |
'method': 'get',
|
|
|
295 |
'url': '$routeAdd',
|
|
|
296 |
}).done(function(response) {
|
|
|
297 |
if (response['success']) {
|
|
|
298 |
$('span[id="form-title"]').html('LABEL_ADD');
|
|
|
299 |
$('#form').attr('action', '$routeAdd');
|
|
|
300 |
$('#form #name').val('');
|
|
|
301 |
$('#form #status').bootstrapToggle('on');
|
|
|
302 |
CKEDITOR.instances.functions.setData('');
|
|
|
303 |
CKEDITOR.instances.objectives.setData('');
|
|
|
304 |
$('#tableCompetencies tbody').empty();
|
|
|
305 |
var s = '';
|
|
|
306 |
var first = true;
|
1164 |
geraldo |
307 |
competencies = response['data']['competencies'];
|
|
|
308 |
competencies_type = response['data']['competency_types'];
|
|
|
309 |
setCompetencySelect();
|
935 |
geraldo |
310 |
$('#tableSubordinates tbody').empty();
|
|
|
311 |
$('#job_description_id_boss option:not(:first)').remove();
|
|
|
312 |
$.each(response['data']['jobs_description'], function(index, rowJobDescription) {
|
|
|
313 |
$('#job_description_id_boss').append(new Option(rowJobDescription['name'], rowJobDescription['job_description_id']));
|
|
|
314 |
s = '<tr>' +
|
|
|
315 |
'<td>' +
|
|
|
316 |
'<div class="custom-control custom-checkbox">' +
|
|
|
317 |
'<input class="custom-control-input" type="checkbox" name="job_description_id_subordinate' + rowJobDescription['job_description_id'] + '" id="job_description_id_subordinate' + rowJobDescription['job_description_id'] + '" value="1">' +
|
|
|
318 |
'<label for="job_description_id_subordinate' + rowJobDescription['job_description_id'] + '" class="custom-control-label">' + rowJobDescription['name'] + '</label>' +
|
|
|
319 |
'</div>' +
|
|
|
320 |
'</td>' +
|
|
|
321 |
'</tr>';
|
|
|
322 |
$('#tableSubordinates tbody').append(s)
|
|
|
323 |
});
|
|
|
324 |
validator.resetForm();
|
|
|
325 |
$('#custom-tabs #custom-tabs-general-tab').tab('show');
|
|
|
326 |
$('#modal').modal('show');
|
|
|
327 |
} else {
|
|
|
328 |
$.fn.showError(response['data']);
|
|
|
329 |
}
|
|
|
330 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
331 |
$.fn.showError(textStatus);
|
|
|
332 |
}).always(function() {
|
|
|
333 |
NProgress.done();
|
66 |
efrain |
334 |
});
|
935 |
geraldo |
335 |
});
|
|
|
336 |
$('body').on('click', 'button.btn-edit', function(e) {
|
|
|
337 |
e.preventDefault();
|
|
|
338 |
NProgress.start();
|
|
|
339 |
var action = $(this).data('href');
|
|
|
340 |
$.ajax({
|
|
|
341 |
'dataType': 'json',
|
|
|
342 |
'accept': 'application/json',
|
|
|
343 |
'method': 'get',
|
|
|
344 |
'url': action,
|
|
|
345 |
}).done(function(response) {
|
|
|
346 |
if (response['success']) {
|
|
|
347 |
$('span[id="form-title"]').html('LABEL_EDIT');
|
|
|
348 |
$('#form').attr('action', action);
|
|
|
349 |
$('#form #name').val(response['data']['name']);
|
|
|
350 |
$('#form #status').bootstrapToggle(response['data']['status'] == '$status_active' ? 'on' : 'off')
|
|
|
351 |
CKEDITOR.instances.functions.setData(response['data']['functions']);
|
|
|
352 |
CKEDITOR.instances.objectives.setData(response['data']['objectives']);
|
|
|
353 |
$('#tableCompetencies tbody').empty();
|
|
|
354 |
var s = '';
|
|
|
355 |
var first = true;
|
|
|
356 |
$.each(response['data']['competency_types'], function(index, rowCompetencyType) {
|
|
|
357 |
first = true;
|
|
|
358 |
$.each(response['data']['competencies'], function(index, rowCompetency) {
|
|
|
359 |
if (rowCompetencyType['competency_type_id'] == rowCompetency['competency_type_id']) {
|
|
|
360 |
if (first) {
|
|
|
361 |
first = false;
|
|
|
362 |
s = '<tr>' +
|
|
|
363 |
'<td><big><b>' + rowCompetencyType['name'] + '</b></big></td>' +
|
|
|
364 |
'</tr>';
|
|
|
365 |
$('#tableCompetencies tbody').append(s)
|
66 |
efrain |
366 |
}
|
936 |
geraldo |
367 |
checked = '';
|
945 |
geraldo |
368 |
if (rowCompetency['level'] && rowCompetency['level'] != 0) {
|
938 |
geraldo |
369 |
checked = ' checked="checked" ';
|
|
|
370 |
}
|
935 |
geraldo |
371 |
s = '<tr>' +
|
|
|
372 |
'<td> ' +
|
66 |
efrain |
373 |
'<div class="custom-control custom-checkbox">' +
|
935 |
geraldo |
374 |
'<input class="custom-control-input" type="checkbox" ' + checked + ' name="competency_level' + rowCompetency['competency_id'] + '" id="competency_level' + rowCompetency['competency_id'] + '" value="1">' +
|
|
|
375 |
'<label for="competency_level' + rowCompetency['competency_id'] + '" class="custom-control-label">' + rowCompetency['name'] + '</label>' +
|
66 |
efrain |
376 |
'</div>' +
|
935 |
geraldo |
377 |
'<td>';
|
|
|
378 |
$('#tableCompetencies tbody').append(s)
|
|
|
379 |
}
|
66 |
efrain |
380 |
});
|
935 |
geraldo |
381 |
});
|
|
|
382 |
$('#tableSubordinates tbody').empty();
|
|
|
383 |
$('#job_description_id_boss option:not(:first)').remove();
|
|
|
384 |
$.each(response['data']['jobs_description'], function(index, rowJobDescription) {
|
|
|
385 |
$('#job_description_id_boss').append(new Option(rowJobDescription['name'], rowJobDescription['job_description_id']));
|
|
|
386 |
checked = '';
|
|
|
387 |
if ($.isArray(response['data']['subordinates'])) {
|
|
|
388 |
if ($.inArray(rowJobDescription['job_description_id'], response['data']['subordinates']) != -1) {
|
|
|
389 |
checked = ' checked="checked" ';
|
|
|
390 |
}
|
|
|
391 |
}
|
|
|
392 |
s = '<tr>' +
|
|
|
393 |
'<td>' +
|
|
|
394 |
'<div class="custom-control custom-checkbox">' +
|
|
|
395 |
'<input class="custom-control-input" type="checkbox" ' + checked + ' name="job_description_id_subordinate' + rowJobDescription['job_description_id'] + '" id="job_description_id_subordinate' + rowJobDescription['job_description_id'] + '" value="1">' +
|
|
|
396 |
'<label for="job_description_id_subordinate' + rowJobDescription['job_description_id'] + '" class="custom-control-label">' + rowJobDescription['name'] + '</label>' +
|
|
|
397 |
'</div>' +
|
|
|
398 |
'</td>' +
|
|
|
399 |
'</tr>';
|
|
|
400 |
$('#tableSubordinates tbody').append(s)
|
|
|
401 |
});
|
|
|
402 |
$('#job_description_id_boss').val(response['data']['job_description_id_boss']);
|
|
|
403 |
validator.resetForm();
|
|
|
404 |
$('#custom-tabs #custom-tabs-general-tab').tab('show');
|
|
|
405 |
$('#modal').modal('show');
|
|
|
406 |
} else {
|
|
|
407 |
$.fn.showError(response['data']);
|
|
|
408 |
}
|
|
|
409 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
410 |
$.fn.showError(textStatus);
|
|
|
411 |
}).always(function() {
|
|
|
412 |
NProgress.done();
|
66 |
efrain |
413 |
});
|
935 |
geraldo |
414 |
});
|
|
|
415 |
$('body').on('click', 'button.btn-refresh', function(e) {
|
|
|
416 |
e.preventDefault();
|
|
|
417 |
gridTable.api().ajax.reload(null, false);
|
|
|
418 |
});
|
|
|
419 |
$('body').on('click', 'button.btn-cancel', function(e) {
|
|
|
420 |
e.preventDefault();
|
|
|
421 |
$('#modal').modal('hide');
|
|
|
422 |
$('#div-listing').show();
|
|
|
423 |
});
|
|
|
424 |
$('body').on('click', 'button.btn-import', function(e) {
|
|
|
425 |
e.preventDefault();
|
|
|
426 |
NProgress.start();
|
|
|
427 |
$.ajax({
|
|
|
428 |
'dataType': 'json',
|
|
|
429 |
'method': 'post',
|
|
|
430 |
'url': '$routeImport',
|
|
|
431 |
}).done(function(response) {
|
|
|
432 |
if (response['success']) {
|
|
|
433 |
$.fn.showSuccess(response['data']);
|
|
|
434 |
gridTable.api().ajax.reload(null, false);
|
|
|
435 |
} else {
|
|
|
436 |
$.fn.showError(response['data']);
|
|
|
437 |
}
|
|
|
438 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
439 |
$.fn.showError(textStatus);
|
|
|
440 |
}).always(function() {
|
|
|
441 |
NProgress.done();
|
66 |
efrain |
442 |
});
|
935 |
geraldo |
443 |
return false;
|
66 |
efrain |
444 |
});
|
935 |
geraldo |
445 |
$('#form #status').bootstrapToggle({
|
|
|
446 |
'on': 'LABEL_ACTIVE',
|
|
|
447 |
'off': 'LABEL_INACTIVE',
|
|
|
448 |
'width': '160px',
|
|
|
449 |
'height': '40px'
|
|
|
450 |
});
|
|
|
451 |
CKEDITOR.replace('functions');
|
|
|
452 |
CKEDITOR.replace('objectives');
|
1166 |
geraldo |
453 |
const setCompetencySelect = () => {
|
1164 |
geraldo |
454 |
$.each(competencies, function(i, item) {
|
1166 |
geraldo |
455 |
if (filterItemById(item.competency_id).length <= 0) {
|
|
|
456 |
let type = filterTypeById(item.competency_type_id);
|
|
|
457 |
$('#select-competency').append($('<option>', {
|
|
|
458 |
value: item.competency_id,
|
|
|
459 |
text: `${type.name} ${item.name}`
|
|
|
460 |
}));
|
|
|
461 |
}
|
|
|
462 |
});
|
1160 |
geraldo |
463 |
}
|
1166 |
geraldo |
464 |
const filterItemById = (id) => competencies_selected.filter((item) => item.competency_id == id ? item : false)[0];
|
|
|
465 |
const filterTypeById = (id) => competencies_type.filter((item) => item.competency_type_id == id ? item : false)[0];
|
935 |
geraldo |
466 |
});
|
1160 |
geraldo |
467 |
|
|
|
468 |
|
66 |
efrain |
469 |
JS;
|
|
|
470 |
$this->inlineScript()->captureEnd();
|
|
|
471 |
?>
|
|
|
472 |
|
|
|
473 |
<!-- Content Header (Page header) -->
|
|
|
474 |
<section class="content-header">
|
1101 |
geraldo |
475 |
<div class="container-fluid">
|
|
|
476 |
<div class="row mb-2">
|
|
|
477 |
<div class="col-sm-12">
|
|
|
478 |
<h1>LABEL_JOBS_DESCRIPTION</h1>
|
|
|
479 |
</div>
|
|
|
480 |
</div>
|
|
|
481 |
</div>
|
|
|
482 |
<!-- /.container-fluid -->
|
66 |
efrain |
483 |
</section>
|
|
|
484 |
<section class="content">
|
1101 |
geraldo |
485 |
<div class="container-fluid">
|
|
|
486 |
<div class="row">
|
|
|
487 |
<div class="col-12">
|
|
|
488 |
<div class="card">
|
|
|
489 |
<div class="card-body">
|
|
|
490 |
<table id="gridTable" class="table table-hover">
|
|
|
491 |
<thead>
|
|
|
492 |
<tr>
|
|
|
493 |
<th>LABEL_NAME</th>
|
|
|
494 |
<th>LABEL_ACTIVE</th>
|
|
|
495 |
<th>LABEL_ACTIONS</th>
|
|
|
496 |
</tr>
|
|
|
497 |
</thead>
|
|
|
498 |
<tbody>
|
|
|
499 |
</tbody>
|
|
|
500 |
</table>
|
|
|
501 |
</div>
|
|
|
502 |
<div class="card-footer clearfix">
|
|
|
503 |
<div style="float:right;">
|
|
|
504 |
<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
|
|
|
505 |
<?php if($allowAdd) : ?>
|
|
|
506 |
<?php if($allowImport) : ?>
|
|
|
507 |
<button type="button" class="btn btn-primary btn-import"><i class="fa fa-upload"></i> LABEL_IMPORT </button>
|
|
|
508 |
<?php endif; ?>
|
|
|
509 |
<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
|
|
|
510 |
<?php endif; ?>
|
|
|
511 |
</div>
|
|
|
512 |
</div>
|
|
|
513 |
</div>
|
|
|
514 |
</div>
|
|
|
515 |
</div>
|
|
|
516 |
</div>
|
|
|
517 |
</section>
|
66 |
efrain |
518 |
<!-- The Modal -->
|
|
|
519 |
<div class="modal" id="modal">
|
1101 |
geraldo |
520 |
<div class="modal-dialog modal-xl">
|
|
|
521 |
<div class="modal-content">
|
|
|
522 |
<!-- Modal Header -->
|
|
|
523 |
<div class="modal-header">
|
|
|
524 |
<h4 class="modal-title">LABEL_JOB_DESCRIPTION - <span id="form-title"></span></h4>
|
|
|
525 |
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
|
526 |
</div>
|
|
|
527 |
<!-- Modal body -->
|
|
|
528 |
<div class="modal-body">
|
|
|
529 |
<div class="card card-primary card-outline card-tabs">
|
|
|
530 |
<div class="card-header p-0 pt-1 border-bottom-0">
|
|
|
531 |
<ul class="nav nav-tabs" id="custom-tabs" role="tablist">
|
|
|
532 |
<li class="nav-item">
|
|
|
533 |
<a class="nav-link active" id="custom-tabs-general-tab" data-toggle="pill" href="#custom-tabs-general" role="tab" aria-controls="custom-tabs-general" aria-selected="true">LABEL_GENERAL</a>
|
|
|
534 |
</li>
|
|
|
535 |
<li class="nav-item">
|
|
|
536 |
<a class="nav-link" id="custom-tabs-compentencies-tab" data-toggle="pill" href="#custom-tabs-compentencies" role="tab" aria-controls="custom-tabs-compentencies" aria-selected="false">LABEL_COMPETENCIES</a>
|
|
|
537 |
</li>
|
|
|
538 |
<li class="nav-item">
|
|
|
539 |
<a class="nav-link" id="custom-tabs-subordinates-tab" data-toggle="pill" href="#custom-tabs-subordinates" role="tab" aria-controls="custom-tabs-subordinates" aria-selected="false">LABEL_SUBORDINATES</a>
|
|
|
540 |
</li>
|
|
|
541 |
</ul>
|
|
|
542 |
</div>
|
|
|
543 |
<div class="card-body">
|
|
|
544 |
<?php
|
|
|
545 |
$form = $this->form;
|
|
|
546 |
$form->setAttributes([
|
|
|
547 |
'method' => 'post',
|
|
|
548 |
'name' => 'form',
|
|
|
549 |
'id' => 'form'
|
|
|
550 |
]);
|
73 |
steven |
551 |
|
1101 |
geraldo |
552 |
$form->prepare();
|
|
|
553 |
echo $this->form()->openTag($form);
|
|
|
554 |
?>
|
|
|
555 |
<div class="tab-content" id="custom-tabs-three-tabContent">
|
|
|
556 |
<div class="tab-pane fade show active" id="custom-tabs-general" role="tabpanel" aria-labelledby="custom-tabs-general-tab">
|
|
|
557 |
<div class="row">
|
|
|
558 |
<div class="col-md col-sm-12 col-12">
|
|
|
559 |
<div class="form-group m-0">
|
|
|
560 |
<?php
|
|
|
561 |
$element = $form->get('name');
|
|
|
562 |
$element->setOptions(['label' => 'LABEL_NAME']);
|
66 |
efrain |
563 |
$element->setAttributes(['class' => 'form-control']);
|
1101 |
geraldo |
564 |
|
66 |
efrain |
565 |
echo $this->formLabel($element);
|
1101 |
geraldo |
566 |
echo $this->formText($element);
|
66 |
efrain |
567 |
?>
|
1101 |
geraldo |
568 |
</div>
|
|
|
569 |
</div>
|
|
|
570 |
<div class="col-md col-sm-12 col-12">
|
|
|
571 |
<div class="form-group m-0">
|
|
|
572 |
<?php
|
|
|
573 |
$element = $form->get('job_description_id_boss');
|
|
|
574 |
$element->setOptions(['label' => 'LABEL_BOSS']);
|
66 |
efrain |
575 |
$element->setAttributes(['class' => 'form-control']);
|
1101 |
geraldo |
576 |
|
66 |
efrain |
577 |
echo $this->formLabel($element);
|
1101 |
geraldo |
578 |
echo $this->formSelect($element);
|
66 |
efrain |
579 |
?>
|
1101 |
geraldo |
580 |
</div>
|
|
|
581 |
</div>
|
|
|
582 |
<div
|
|
|
583 |
class="col-md col-sm-12 col-12 d-flex align-items-center justify-content-center"
|
|
|
584 |
>
|
|
|
585 |
<div class="form-group m-0">
|
|
|
586 |
<label>LABEL_STATUS</label>
|
|
|
587 |
<br />
|
|
|
588 |
<?php
|
|
|
589 |
$element = $form->get('status');
|
|
|
590 |
$element->setOptions(['label' => 'LABEL_STATUS']);
|
|
|
591 |
// echo $this->formLabel($element);
|
|
|
592 |
echo $this->formCheckbox($element);
|
|
|
593 |
?>
|
|
|
594 |
</div>
|
|
|
595 |
</div>
|
|
|
596 |
</div>
|
|
|
597 |
<div class="form-group">
|
|
|
598 |
<?php
|
|
|
599 |
$element = $form->get('objectives');
|
|
|
600 |
$element->setOptions(['label' => 'LABEL_OBJECTIVES']);
|
|
|
601 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
602 |
|
|
|
603 |
echo $this->formLabel($element);
|
|
|
604 |
echo $this->formTextArea($element);
|
|
|
605 |
?>
|
|
|
606 |
</div>
|
|
|
607 |
<div class="form-group">
|
|
|
608 |
<?php
|
|
|
609 |
$element = $form->get('functions');
|
|
|
610 |
$element->setOptions(['label' => 'LABEL_FUNCTIONS']);
|
|
|
611 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
612 |
|
|
|
613 |
echo $this->formLabel($element);
|
|
|
614 |
echo $this->formTextArea($element);
|
|
|
615 |
?>
|
|
|
616 |
</div>
|
|
|
617 |
</div>
|
1159 |
geraldo |
618 |
<div class="tab-pane fade" id="custom-tabs-compentencies" role="tabpanel" aria-labelledby="custom-tabs-compentencies-tab">
|
|
|
619 |
<div class="row">
|
1164 |
geraldo |
620 |
<div class="col-md-8 col-sm-8 col-xs-12">
|
1158 |
geraldo |
621 |
<select name="select-competency" id="select-competency" class="form-control">
|
|
|
622 |
</select>
|
|
|
623 |
</div>
|
|
|
624 |
<div class="col-md-4 col-sm-4 col-xs-12">
|
1160 |
geraldo |
625 |
<button type="button" class="btn btn-primary" id="btn-select-competency" data-toggle="tooltip" title="LABEL_ADD LABEL_COMPETENCY">LABEL_ADD LABEL_COMPETENCY</button>
|
1158 |
geraldo |
626 |
</div>
|
1164 |
geraldo |
627 |
|
1158 |
geraldo |
628 |
</div>
|
|
|
629 |
<div class="row">
|
|
|
630 |
<div class="col-md-12 col-sm-12 col-xs-12">
|
|
|
631 |
|
|
|
632 |
</div>
|
|
|
633 |
|
|
|
634 |
</div>
|
1101 |
geraldo |
635 |
</div>
|
|
|
636 |
<div class="tab-pane fade" id="custom-tabs-subordinates" role="tabpanel" aria-labelledby="custom-tabs-subordinates-tab">
|
|
|
637 |
<table class="table table-hover" id="tableSubordinates">
|
|
|
638 |
<thead>
|
|
|
639 |
<tr>
|
|
|
640 |
<th>LABEL_SUBORDINATE</th>
|
|
|
641 |
</tr>
|
|
|
642 |
</thead>
|
|
|
643 |
<tbody>
|
|
|
644 |
</tbody>
|
|
|
645 |
</table>
|
|
|
646 |
</div>
|
|
|
647 |
</div>
|
|
|
648 |
</div>
|
|
|
649 |
<?php echo $this->form()->closeTag($form); ?>
|
|
|
650 |
<!-- /.card -->
|
|
|
651 |
</div>
|
|
|
652 |
</div>
|
|
|
653 |
<!-- Modal footer -->
|
|
|
654 |
<div class="modal-footer">
|
|
|
655 |
<button type="submit" form="form" class="btn btn-primary">LABEL_SAVE</button>
|
|
|
656 |
<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
|
|
|
657 |
</div>
|
|
|
658 |
</div>
|
|
|
659 |
</div>
|
|
|
660 |
</div>
|
66 |
efrain |
661 |
|
|
|
662 |
|
|
|
663 |
|
|
|
664 |
|
|
|
665 |
|
|
|
666 |
|
|
|
667 |
|
|
|
668 |
|
|
|
669 |
|
|
|
670 |
|
|
|
671 |
|
|
|
672 |
|