Rev 15405 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
<?php
use LeadersLinked\Model\JobDescription;
$acl = $this->viewModel()->getRoot()->getVariable('acl');
$currentUser = $this->currentUserHelper();
$roleName = $currentUser->getUserTypeId();
$routeAdd = $this->url('settings/jobs-description/add');
$routeDatatable = $this->url('settings/jobs-description');
$routeImport = $this->url('settings/jobs-description/import');
$routeDashboard = $this->url('dashboard');
$allowAdd = $acl->isAllowed($roleName, 'settings/jobs-description/add') ? 1 : 0;
$allowEdit = $acl->isAllowed($roleName, 'settings/jobs-description/edit') ? 1 : 0;
$allowDelete = $acl->isAllowed($roleName, 'settings/jobs-description/delete') ? 1 : 0;
$allowReport = $acl->isAllowed($roleName, 'settings/jobs-description/report') ? 1 : 0;
$allowImport = $acl->isAllowed($roleName, 'settings/jobs-description/import') ? 1 : 0;
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/select2.js'));
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/i18n/es.js'));
$this->headLink()->appendStylesheet($this->basePath('plugins/select2/css/select2.css'));
$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.css'));
// bootbox Alert //
$this->inlineScript()->appendFile($this->basePath('plugins/bootbox/bootbox.min.js'));
// JsRender //
$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.min.js'));
// Page Styles
$this->headLink()->appendStylesheet($this->basePath('css/pages/self-evaluation.css'));
$status_active = JobDescription::STATUS_ACTIVE;
$this->inlineScript()->captureStart();
echo <<<JS
var competencies = [];
var competencies_type = [];
var subordinates = [];
var competencies_selected = [];
var subordinates_selected = [];
jQuery(document).ready(function($) {
$.validator.setDefaults({
debug: true,
highlight: function(element) {
$(element).addClass('is-invalid');
},
unhighlight: function(element) {
$(element).removeClass('is-invalid');
},
errorElement: 'span',
errorClass: 'error invalid-feedback',
errorPlacement: function(error, element) {
if (element.parent('.form-group').length) {
error.insertAfter(element);
} else if (element.parent('.toggle').length) {
error.insertAfter(element.parent().parent());
} else {
error.insertAfter(element.parent());
}
}
});
$.fn.showFormErrorValidator = function(fieldname, errors) {
var field = $(fieldname);
if (field) {
$(field).addClass('is-invalid');
var error = $('<span id="' + fieldname + '-error" class="error invalid-feedback">' + errors + '</div>');
if (field.parent('.form-group').length) {
error.insertAfter(field);
} else if (field.parent('.toggle').length) {
error.insertAfter(field.parent().parent());
} else {
error.insertAfter(field.parent());
}
}
};
var allowEdit = $allowEdit;
var allowDelete = $allowDelete;
var allowReport = $allowReport;
var gridTable = $('#gridTable').dataTable({
'processing': true,
'serverSide': true,
'searching': true,
'order': [
[0, 'asc']
],
'ordering': true,
'ordenable': true,
'responsive': true,
'select': false,
'paging': true,
'pagingType': 'simple_numbers',
'ajax': {
'url': '$routeDatatable',
'type': 'get',
'beforeSend': function(request) {
NProgress.start();
},
'dataFilter': function(response) {
var response = jQuery.parseJSON(response);
var json = {};
json.recordsTotal = 0;
json.recordsFiltered = 0;
json.data = [];
if (response.success) {
json.recordsTotal = response.data.total;
json.recordsFiltered = response.data.total;
json.data = response.data.items;
} else {
$.fn.showError(response.data)
}
return JSON.stringify(json);
}
},
'language': {
'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
'sInfo': 'LABEL_DATATABLE_SINFO',
'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
'sInfoPostFix': '',
'sSearch': 'LABEL_DATATABLE_SSEARCH',
'sUrl': '',
'sInfoThousands': ',',
'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
'oPaginate': {
'sFirst': 'LABEL_DATATABLE_SFIRST',
'sLast': 'LABEL_DATATABLE_SLAST',
'sNext': 'LABEL_DATATABLE_SNEXT',
'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
},
'oAria': {
'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
},
},
'drawCallback': function(settings) {
NProgress.done();
$('button.btn-delete').confirmation({
rootSelector: 'button.btn-delete',
title: 'LABEL_ARE_YOU_SURE',
singleton: true,
btnOkLabel: 'LABEL_YES',
btnCancelLabel: 'LABEL_NO',
onConfirm: function(value) {
action = $(this).data('href');
NProgress.start();
$.ajax({
'dataType': 'json',
'accept': 'application/json',
'method': 'post',
'url': action,
}).done(function(response) {
if (response['success']) {
$.fn.showSuccess(response['data']);
gridTable.api().ajax.reload(null, false);
} else {
$.fn.showError(response['data']);
}
}).fail(function(jqXHR, textStatus, errorThrown) {
$.fn.showError(textStatus);
}).always(function() {
NProgress.done();
});
},
});
},
'aoColumns': [{
'mDataProp': 'name'
},
{
'mDataProp': 'status'
},
{
'mDataProp': 'actions'
},
],
'columnDefs': [{
'targets': 0,
'className': 'text-vertical-middle',
},
{
'targets': -2,
'orderable': false,
'className': 'text-center',
'render': function(data, type, row) {
checked = data == 'a' ? ' checked="checked" ' : '';
return '<div class="checkbox checkbox-success">' +
'<input class="styled" type="checkbox" ' + checked + ' disabled="disabled">' +
'<label ></label></div>';
}
},
{
'targets': -1,
'orderable': false,
'render': function(data, type, row) {
s = '';
if (allowEdit) {
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> ';
}
if (allowDelete) {
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> ';
}
if (allowReport) {
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> ';
}
return s;
}
}
],
});
var validator = $('#form').validate({
debug: true,
onclick: false,
onkeyup: false,
ignore: [],
rules: {
'name': {
required: true,
maxlength: 64,
},
'functions': {
updateCkeditor: function() {
CKEDITOR.instances.functions.updateElement();
},
required: true,
},
'objectives': {
updateCkeditor: function() {
CKEDITOR.instances.objectives.updateElement();
},
required: true,
},
'status': {
required: false,
},
},
submitHandler: function(form) {
$("#competencies_selected").val(JSON.stringify(competencies_selected));
$("#subordinates_selected").val(JSON.stringify(subordinates_selected));
$.ajax({
'dataType': 'json',
'accept': 'application/json',
'method': 'post',
'url': $('#form').attr('action'),
'data': $('#form').serialize()
}).done(function(response) {
NProgress.start();
if (response['success']) {
$.fn.showSuccess(response['data']);
$('#row-lists').show();
$('#row-form').hide();
gridTable.api().ajax.reload(null, false);
} else {
validator.resetForm();
if (jQuery.type(response['data']) == 'string') {
$.fn.showError(response['data']);
} else {
$.each(response['data'], function(fieldname, errors) {
$.fn.showFormErrorValidator('#form #' + fieldname, errors);
});
}
}
}).fail(function(jqXHR, textStatus, errorThrown) {
$.fn.showError(textStatus);
}).always(function() {
NProgress.done();
});
return false;
},
invalidHandler: function(form, validator) {}
});
$('body').on('click', 'button.btn-add', function(e) {
e.preventDefault();
NProgress.start();
$.ajax({
'dataType': 'json',
'accept': 'application/json',
'method': 'get',
'url': '$routeAdd',
}).done(function(response) {
if (response['success']) {
$('span[id="form-title"]').html('LABEL_ADD');
$('#form').attr('action', '$routeAdd');
$('#form #name').val('');
$('#form #status').bootstrapToggle('on');
CKEDITOR.instances.functions.setData('');
CKEDITOR.instances.objectives.setData('');
subordinates_selected = [];
competencies_selected = [];
competencies = response['data']['competencies'];
competencies_type = response['data']['competency_types'];
subordinates = response['data']['jobs_description'];
renderData([]);
renderSubordinateData([]);
setCompetencySelect();
setSubordinateSelect();
validator.resetForm();
$('#custom-tabs #custom-tabs-general-tab').tab('show');
$('#row-lists').hide();
$('#row-form').show();
} else {
$.fn.showError(response['data']);
}
}).fail(function(jqXHR, textStatus, errorThrown) {
$.fn.showError(textStatus);
}).always(function() {
NProgress.done();
});
});
$('body').on('click', 'button.btn-edit', function(e) {
e.preventDefault();
NProgress.start();
var action = $(this).data('href');
$.ajax({
'dataType': 'json',
'accept': 'application/json',
'method': 'get',
'url': action,
}).done(function(response) {
if (response['success']) {
$('span[id="form-title"]').html('LABEL_EDIT');
$('#form').attr('action', action);
$('#form #name').val(response['data']['name']);
$('#form #status').bootstrapToggle(response['data']['status'] == '$status_active' ? 'on' : 'off')
CKEDITOR.instances.functions.setData(response['data']['functions']);
CKEDITOR.instances.objectives.setData(response['data']['objectives']);
$('#tableCompetencies tbody').empty();
competencies = response['data']['competencies'];
competencies_type = response['data']['competency_types'];
competencies_selected = response['data']['competencies_selected'];
subordinates_selected = response['data']['subordinates_selected'];
subordinates = response['data']['jobs_description'];
renderData(competencies_selected);
renderSubordinateData(subordinates_selected);
setCompetencySelect();
setSubordinateSelect();
$('#job_description_id_boss').val(response['data']['job_description_id_boss']);
validator.resetForm();
$('#custom-tabs #custom-tabs-general-tab').tab('show');
$('#row-lists').hide();
$('#row-form').show();
} else {
$.fn.showError(response['data']);
}
}).fail(function(jqXHR, textStatus, errorThrown) {
$.fn.showError(textStatus);
}).always(function() {
NProgress.done();
});
});
$('body').on('click', 'button.btn-refresh', function(e) {
e.preventDefault();
gridTable.api().ajax.reload(null, false);
});
$('body').on('click', 'button.btn-cancel', function(e) {
e.preventDefault();
$('#row-lists').show();
$('#row-form').hide();
$('#div-listing').show();
});
$('body').on('click', 'button.btn-import', function(e) {
e.preventDefault();
NProgress.start();
$.ajax({
'dataType': 'json',
'method': 'post',
'url': '$routeImport',
}).done(function(response) {
if (response['success']) {
$.fn.showSuccess(response['data']);
gridTable.api().ajax.reload(null, false);
} else {
$.fn.showError(response['data']);
}
}).fail(function(jqXHR, textStatus, errorThrown) {
$.fn.showError(textStatus);
}).always(function() {
NProgress.done();
});
return false;
});
$('#form #status').bootstrapToggle({
'on': 'LABEL_ACTIVE',
'off': 'LABEL_INACTIVE',
'width': '160px',
'height': '40px'
});
CKEDITOR.replace('functions');
CKEDITOR.replace('objectives');
/**
* Clicked select competency
*/
$('body').on('click', 'button[id="btn-select-competency"]', function(e) {
if ($("#select-competency").val() == "") {
$.fn.showError('LABEL_ERROR_SELECT_COMPETENCY');
} else {
competencies_selected.push(competencies.filter((item) => item.competency_id == $("#select-competency").val() ? item : false)[0]);
$("#select-subordinate").val('');
renderData(competencies_selected);
setCompetencySelect();
}
});
/**
* Clicked select subordinate
*/
$('body').on('click', 'button[id="btn-select-subordinate"]', function(e) {
if ($("#select-subordinate").val() == "") {
$.fn.showError('LABEL_ERROR_SELECT_DEPENDENT');
} else {
subordinates_selected.push(subordinates.filter((item) => item.job_description_id == $("#select-subordinate").val() ? item : false)[0]);
renderSubordinateData(subordinates_selected);
setSubordinateSelect();
}
});
/**
* Clicked remove subordinate
*/
$('body').on('click', 'button.btn-delete-subordinate', function(e) {
var job_description_id = $(this).data('subordinate');
bootbox.confirm({
title: "LABEL_DELETE LABEL_DEPENDENT",
message: "LABEL_QUESTION_DELETE",
buttons: {
cancel: {
label: '<i class="fa fa-times"></i> LABEL_CANCEL'
},
confirm: {
label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
}
},
callback: function(result) {
if (result) {
subordinates_selected = subordinates_selected.filter((item) => item.job_description_id != job_description_id);
renderSubordinateData(subordinates_selected);
return setSubordinateSelect();
}
}
});
});
const setCompetencySelect = () => {
$('#select-competency').children().remove();
$('#select-competency').append($('<option>', {
value: '',
text: 'LABEL_SELECT'
}));
$.each(competencies, function(i, item) {
if (!filterItemById(item.competency_id)) {
var type = filterTypeById(item.competency_type_id);
$('#select-competency').append($('<option>', {
value: item.competency_id,
text: type.name + ' - ' + item.name
}));
}
});
}
const setSubordinateSelect = () => {
$('#select-subordinate').children().remove();
$('#select-subordinate').append($('<option>', {
value: '',
text: 'LABEL_SELECT'
}));
$.each(subordinates, function(i, item) {
if (!filterDependedItemById(item.job_description_id)) {
$('#select-subordinate').append($('<option>', {
value: item.job_description_id,
text: item.name
}));
}
});
}
/**
* Render Competencies data
*/
const renderData = (data) => {
data.length > 0 ?
$("#competencies-job").html($("#sectionTemplate").render(data, {
getType: filterTypeById
})) :
$("#competencies-job").html('');
}
/**
* Render Subordinate data
*/
const renderSubordinateData = (data) => {
data.length > 0 ?
$("#subordinate").html($("#sectionJob").render(data)) :
$("#subordinate").html('');
}
/**
* Filter competencies selected
*/
const filterItemById = (id) => competencies_selected.filter((item) => item.competency_id == id ? item : false)[0];
/**
* Filter depended selected
*/
const filterDependedItemById = (id) => subordinates_selected.filter((item) => item.job_description_id == id ? item : false)[0];
/**
* Filter competencie type
*/
const filterTypeById = (id) => competencies_type.filter((item) => item.competency_type_id == id ? item : false)[0];
/**
* Clicked remove competency
*/
$('body').on('click', 'button.btn-delete-competency', function(e) {
var id_competency = $(this).data('competency');
bootbox.confirm({
title: "LABEL_DELETE LABEL_COMPETENCY",
message: "LABEL_QUESTION_DELETE",
buttons: {
cancel: {
label: '<i class="fa fa-times"></i> LABEL_CANCEL'
},
confirm: {
label: '<i class="fa fa-check"></i> LABEL_ACCEPT'
}
},
callback: function(result) {
if (result) {
removeCompetency(id_competency);
}
}
});
});
/**
* Clicked on edit behavior
*/
$('body').on('click', 'button.btn-edit-behavior', function(e) {
e.preventDefault();
var competency_id = $(this).data('competency');
var behavior_id = $(this).data('behavior');
competencies_selected.map((item) => {
if (item.competency_id == competency_id) {
item.behaviors.map((b) => {
if (b.behavior_id == behavior_id) {
$('#form-behavior #behavior-id').val(b.behavior_id);
$('#form-behavior #behavior-competency').val(b.competency_id);
$('#form-behavior #behavior-level').val(b.level);
$('#modal-behavior h4[class="modal-title"]').html('LABEL_EDIT LABEL_CONDUCT');
$('#modal-behavior').modal('show');
return;
}
});
}
});
});
/**
* Remove Competency
*/
const removeCompetency = (competency_id) => {
competencies_selected = competencies_selected.filter((item) => item.competency_id != competency_id);
return renderData(competencies_selected);
}
/**
* Edit item Behavior
*/
const editBehavior = (competency_id, behavior_id, level) => {
competencies_selected.map((item) => {
if (item.competency_id == competency_id) {
item.behaviors.map((opt) => {
if (opt.behavior_id == behavior_id) {
opt.level = level
}
});
}
});
return renderData(competencies_selected);
}
/**
* Clicked cancel new/edit Form
*/
$('button.btn-behavior-submit').click(function(e) {
if ($("#behavior-description").val() == "") {
$.fn.showError('ERROR_ENTER_DESCRIPTION');
return;
} else {
editBehavior($("#behavior-competency").val(), $("#behavior-id").val(), $("#behavior-level").val())
$('#modal-behavior').modal('hide');
return;
}
});
$('#select-subordinate').select2({
theme: 'bootstrap4',
width: '100%',
});
$('#select-competency').select2({
theme: 'bootstrap4',
width: '100%',
});
/**
* Clicked cancel new/edit Form
*/
$('body').on('click', 'button.btn-edit-cancel', function(e) {
$('#row-lists').show();
$('#row-form').hide();
});
});
JS;
$this->inlineScript()->captureEnd();
?>
<section class="content" id="row-lists">
<!-- Content Header (Page header) -->
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-12">
<h1>LABEL_JOBS_DESCRIPTION</h1>
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<table id="gridTable" class="table table-hover">
<thead>
<tr>
<th>LABEL_NAME</th>
<th>LABEL_ACTIVE</th>
<th>LABEL_ACTIONS</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="card-footer clearfix">
<div style="float:right;">
<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
<?php if($allowAdd) : ?>
<?php if($allowImport) : ?>
<button type="button" class="btn btn-primary btn-import"><i class="fa fa-upload"></i> LABEL_IMPORT </button>
<?php endif; ?>
<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="row-form" style="display:none">
<div class="container">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">LABEL_JOB_DESCRIPTION - <span id="form-title"></span></h4>
</div>
<!-- Modal body -->
<div class="modal-body">
<div class="card card-primary card-outline card-tabs">
<div class="card-header p-0 pt-1 border-bottom-0">
<ul class="nav nav-tabs" id="custom-tabs" role="tablist">
<li class="nav-item">
<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>
</li>
<li class="nav-item">
<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>
</li>
<li class="nav-item">
<a class="nav-link" id="custom-tabs-subordinate-tab" data-toggle="pill" href="#custom-tabs-subordinate" role="tab" aria-controls="custom-tabs-subordinate" aria-selected="false">LABEL_SUBORDINATES</a>
</li>
</ul>
</div>
<div class="card-body">
<?php
$form = $this->form;
$form->setAttributes([
'method' => 'post',
'name' => 'form',
'id' => 'form'
]);
$form->prepare();
echo $this->form()->openTag($form);
?>
<input type="hidden" id="subordinates_selected" name="subordinates_selected" value="">
<input type="hidden" id="competencies_selected" name="competencies_selected" value="">
<div class="tab-content" id="custom-tabs-three-tabContent">
<div class="tab-pane fade show active" id="custom-tabs-general" role="tabpanel" aria-labelledby="custom-tabs-general-tab">
<div class="row">
<div class="col-md col-sm-12 col-12">
<div class="form-group m-0">
<?php
$element = $form->get('name');
$element->setOptions(['label' => 'LABEL_NAME']);
$element->setAttributes(['class' => 'form-control']);
echo $this->formLabel($element);
echo $this->formText($element);
?>
</div>
</div>
<div class="col-md col-sm-12 col-12">
<div class="form-group m-0">
<?php
$element = $form->get('job_description_id_boss');
$element->setOptions(['label' => 'LABEL_BOSS']);
$element->setAttributes(['class' => 'form-control']);
echo $this->formLabel($element);
echo $this->formSelect($element);
?>
</div>
</div>
<div
class="col-md col-sm-12 col-12 d-flex align-items-center justify-content-center"
>
<div class="form-group m-0">
<label>LABEL_STATUS</label>
<br />
<?php
$element = $form->get('status');
$element->setOptions(['label' => 'LABEL_STATUS']);
// echo $this->formLabel($element);
echo $this->formCheckbox($element);
?>
</div>
</div>
</div>
<div class="form-group">
<?php
$element = $form->get('objectives');
$element->setOptions(['label' => 'LABEL_OBJECTIVES']);
$element->setAttributes(['class' => 'form-control']);
echo $this->formLabel($element);
echo $this->formTextArea($element);
?>
</div>
<div class="form-group">
<?php
$element = $form->get('functions');
$element->setOptions(['label' => 'LABEL_FUNCTIONS']);
$element->setAttributes(['class' => 'form-control']);
echo $this->formLabel($element);
echo $this->formTextArea($element);
?>
</div>
</div>
<div class="tab-pane fade" id="custom-tabs-compentencies" role="tabpanel" aria-labelledby="custom-tabs-compentencies-tab">
<div class="row">
<div class="col-md-8 col-sm-8 col-xs-12">
<select id="select-competency" class="form-control"> </select>
</div>
<div class="col-md-4 col-sm-4 col-xs-12">
<button type="button" class="btn btn-primary" id="btn-select-competency" data-toggle="tooltip" title="LABEL_ADD LABEL_COMPETENCY">LABEL_ADD LABEL_COMPETENCY</button>
</div>
</div>
<div class="row" >
<br>
<div class="col-md-12 col-sm-12 col-xs-12" id="competencies-job" style="margin-top: 10px;">
</div>
</div>
</div>
<div class="tab-pane fade" id="custom-tabs-subordinate" role="tabpanel" aria-labelledby="custom-tabs-subordinate-tab">
<div class="row">
<div class="col-md-8 col-sm-8 col-xs-12">
<select id="select-subordinate" class="form-control"></select>
</div>
<div class="col-md-4 col-sm-4 col-xs-12">
<button type="button" class="btn btn-primary" id="btn-select-subordinate" data-toggle="tooltip" title="LABEL_ADD ">LABEL_ADD </button>
</div>
</div>
<div class="row" >
<div class="col-md-12 col-sm-12 col-xs-12" style="margin-top: 10px;">
<table class="table table-bordered">
<thead>
<tr>
<th style="width: 60%;">LABEL_NAME</th>
<th style="width: 20%;">LABEL_ACTIONS</th>
</tr>
</thead>
<tbody id="subordinate"></tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<?php echo $this->form()->closeTag($form); ?>
<!-- /.card -->
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="submit" form="form" class="btn btn-primary">LABEL_SAVE</button>
<button type="button" class="btn btn-danger btn-edit-cancel" >Cerrar</button>
</div>
</section>
<!--start modal behavior-->
<div id="modal-behavior" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<form action="#" name="form-behavior" id="form-behavior">
<input type="hidden" name="behavior-id" id="behavior-id" value="" />
<input type="hidden" name="behavior-competency" id="behavior-competency" value="" />
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">LABEL_EDIT LABEL_LEVEL</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="form-group">
<label for="behavior-value">LABEL_LEVEL</label>
<select class="form-control" id="behavior-level" name="behavior-level">
<option value="0">LABEL_NA</option>
<option value="1">LABEL_LEVEL_ONE</option>
<option value="2">LABEL_LEVEL_TWO</option>
<option value="3">LABEL_LEVEL_THREE</option>
<option value="4">LABEL_LEVEL_FOUR</option>
</select>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary btn-behavior-submit">LABEL_SAVE</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">LABEL_CLOSE</button>
</div>
</div>
</form>
</div>
</div>
<!---end modal behavior --->
<!---Template Competencies --->
<script id="sectionTemplate" type="text/x-jsrender">
<div class="panel panel-default" id="panel-{{:competency_id}}">
<div class="panel-heading">
<h4 class="panel-title" style=" font-size: 18px;">
<a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:competency_id}}" href="#collapse-{{:competency_id}}">
<span class="section-name{{:competency_id}}">
{{:~getType(competency_type_id).name}} - {{:name}}
</span>
</a>
</h4>
</div>
<div id="collapse-{{:competency_id}}" class="panel-collapse in collapse show">
<div class="panel-body">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th style="width: 20%;">LABEL_ELEMENT</th>
<th style="width: 50%;">LABEL_TITLE</th>
<th style="width: 10%;">LABEL_LEVEL</th>
<th style="width: 20%;">LABEL_ACTIONS</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-left">LABEL_COMPETENCY</td>
<td class="text-left">{{:name}}</td>
<td>
</td>
<td>
<button type="button" class="btn btn-default btn-delete-competency" data-competency="{{:competency_id}}" data-toggle="tooltip" data-original-title="LABEL_DELETE LABEL_COMPETENCY"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_COMPETENCY </button>
</td>
</tr>
{{for behaviors}}
<tr >
<td class="text-left">--LABEL_CONDUCT</td>
<td class="text-left">
{{:description}}
</td>
<td>
{{if level == '0'}} LABEL_NA {{/if}}
{{if level == '1' }} LABEL_LEVEL_ONE {{/if}}
{{if level == '2' }} LABEL_LEVEL_TWO {{/if}}
{{if level == '3' }} LABEL_LEVEL_THREE {{/if}}
{{if level == '4' }} LABEL_LEVEL_FOUR {{/if}}
</td>
<td>
<button type="button" class="btn btn-default btn-edit-behavior" data-competency="{{:competency_id}}" data-behavior="{{:behavior_id}}" data-toggle="tooltip" data-original-title="LABEL_EDIT LABEL_LEVEL"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_LEVEL</button>
</td>
</tr>
{{/for}}
</tbody>
</table>
</div>
</div>
</div>
</div>
</script>
<script id="sectionJob" type="text/x-jsrender">
<tr>
<td class="text-left">{{:name}}</td>
<td>
<button type="button" class="btn btn-default btn-delete-subordinate" data-subordinate="{{:job_description_id}}" data-toggle="tooltip" data-original-title="LABEL_DELETE"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE</button>
</td>
</tr>
</script>
<!-- End Template Competencies-->