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