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