Rev 16929 | 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('jobs-description/add');
$routeDatatable = $this->url('jobs-description');
$routeImport = $this->url('jobs-description/import');
$routeDashboard = $this->url('dashboard');
$allowAdd = $acl->isAllowed($roleName, 'jobs-description/add') ? 1 : 0;
$allowEdit = $acl->isAllowed($roleName, 'jobs-description/edit') ? 1 : 0;
$allowDelete = $acl->isAllowed($roleName, 'jobs-description/delete') ? 1 : 0;
$allowReport = $acl->isAllowed($roleName, 'jobs-description/report') ? 1 : 0;
$allowImport = $acl->isAllowed($roleName, 'jobs-description/import') ? 1 : 0;
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.js'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-maxlength/bootstrap-maxlength.min.js'));
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.css'));
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.css'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net/jquery.dataTables.js'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.js'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/dataTables.responsive.min.js'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.min.js'));
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/select2/js/select2.js'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/select2/js/i18n/es.js'));
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/select2/css/select2.css'));
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/select2-bootstrap5-theme/select2-bootstrap-5-theme.css'));
// JsRender //
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jsrender/jsrender.min.js'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/orgchart/js/jquery.orgchart.js'));
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/orgchart/css/jquery.orgchart.css'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootbox/bootbox.all.js'));
$status_active = JobDescription::STATUS_ACTIVE;
$status_inactive = JobDescription::STATUS_INACTIVE;
$this->headStyle()->captureStart();
echo <<<CSS
div.orgchart
{
width: 100%;
height: 600px
}
CSS;
$this->headStyle()->captureEnd();
$this->inlineScript()->captureStart();
echo <<<JS
jQuery(document).ready(function($) {
var competencies_selected = new Array();
var behaviors = new Array();
var competency_types = new Array();
var competencies = new Array();
var allowEdit = $allowEdit;
var allowDelete = $allowDelete;
var allowReport = $allowReport;
var datasource = {};
var dataactions = [];
var oc = null;
$.fn.renderCompetencies = function() {
if(competencies_selected.length > 0) {
$('#renderCompetencies').html($('#competencyTemplate').render(competencies_selected, {
getCompetencyType: (uuid) => competency_types.filter((item) => item.uuid == uuid ? item : false)[0],
getCompetency: (uuid) => competencies.filter((item) => item.uuid == uuid ? item : false)[0],
getBehavior: (uuid) => behaviors.filter((item) => item.uuid == uuid ? item : false)[0]
}));
} else {
$('#renderCompetencies').html('');
}
}
$.fn.comboCompetencies = function() {
$('#select-competency').children().remove();
$.each(competency_types, function(i, competency_type) {
competencies_filtered = competencies.filter((item) => item.competency_type_uuid == competency_type.uuid ? item : false)
$.each(competencies_filtered, function(i, competency) {
selected = competencies_selected.filter((item) => item.uuid == competency.uuid ? item : false)[0];
if(!selected) {
$('#select-competency').append($('<option>', {
value: competency.uuid,
text: competency_type.name + ' - ' + competency.name
}));
}
});
});
}
$.fn.recursiveTree = function(parent_branch, parent_item) {
$.each(parent_item, function(i, item) {
dataactions.push({
'uuid' : item['uuid'],
'link_report' : item['link_report'],
'link_edit' : item['link_edit'],
'link_delete' : item['link_delete'],
})
var branch = {
'uuid' : item['uuid'],
'name' : item['name'],
'children' : [
]
}
if(item.children.length > 0) {
$.fn.recursiveTree(branch, item.children);
}
parent_branch.children.push(branch)
});
}
$.fn.refreshTree = function() {
NProgress.start();
$.ajax({
'dataType': 'json',
'accept': 'application/json',
'method': 'get',
'url': '$routeDatatable',
}).done(function(response) {
if (response['success']) {
dataactions = [];
datasource = {
'uuid' : 'n-a',
'name' : '$company_name',
'children' : [
]
}
$.fn.recursiveTree(datasource, response['data']['items']);
oc.init({ 'data': datasource });
oc.\$chart.find('.node').on('mouseover', function(e) {
e.preventDefault();
$('.horizontalEdge').hide();
$('.verticalEdge').hide();
});
oc.\$chart.find('.node').on('click', function() {
var message = $(this).children('.title').text();
if(!allowEdit && !allowDelete && !allowReport) {
return;
}
var uuid = $(this).attr('id');
var link_report = '';
var link_edit = '';
var link_delete = '';
$.each(dataactions, function(i, item) {
if(uuid == item.uuid) {
link_report = item.link_report;
link_edit = item.link_edit;
link_delete = item.link_delete;
}
});
var buttons = {}
buttons.cancel = {
label: 'LABEL_CANCEL',
className: 'btn-secondary',
callback: function(){
console.log('CANCEL clicked');
}
};
if(allowEdit && link_edit) {
buttons.edit = {
label: 'LABEL_EDIT',
className: ' btn-primary',
callback: function(){
setTimeout(() => {
$.fn.editJobDescription(link_edit);
}, 250);
}
};
}
if(allowDelete && link_delete) {
buttons.delete = {
label: 'LABEL_DELETE',
className: 'btn-danger',
callback: function(){
setTimeout(() => {
$.fn.deleteJobDescription(link_delete);
}, 250);
}
};
}
if(allowReport && link_report) {
buttons.report = {
label: 'LABEL_REPORT',
className: 'btn-info',
callback: function() {
setTimeout(() => {
$.fn.reportJobDescription(link_report);
}, 250);
}
};
}
let dialog = bootbox.dialog({
title: 'LABEL_JOB_DESCRIPTION',
message: message,
size: 'large',
buttons: buttons,
});
dialog.show();
});
} else {
$.fn.showError(response['data']);
}
}).fail(function(jqXHR, textStatus, errorThrown) {
$.fn.showError(textStatus);
}).always(function() {
NProgress.done();
});
}
var validator = $('#form').validate({
debug: true,
onclick: false,
onkeyup: false,
ignore: [],
rules: {
'name': {
required: true,
maxlength: 64,
},
'functions': {
required: true,
maxlength: 1024,
},
'objectives': {
required: true,
maxlength: 1024,
},
'status': {
required: false,
},
'job_description_id_boss' : {
required: false,
},
},
submitHandler: function(form) {
var data = {
name : $('#form #name').val(),
functions : $('#form #functions').val(),
objectives : $('#form #objectives').val(),
status : $('#form #status').prop('checked') ? '$status_active' : '$status_inactive',
job_description_id_boss: $('#form #job_description_id_boss').val(),
competencies_selected : new Array(),
};
$.each(competencies_selected, function(i, c) {
$.each(c.behaviors, function(i, b) {
data.competencies_selected.push({'competency_uuid' : c.uuid, 'behavior_uuid' : b.uuid, 'level' : b.level});
});
});
NProgress.start();
$.ajax({
'dataType': 'json',
'accept': 'application/json',
'method': 'post',
'url': $('#form').attr('action'),
'data': data,
}).done(function(response) {
if (response['success']) {
$.fn.showSuccess(response['data']);
$('#row-lists').show();
$('#row-form').hide();
$.fn.refreshTree();
} 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-refresh', function(e) {
e.preventDefault();
$.fn.refreshTree();
});
$('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']);
$.fn.refreshTree();
} else {
$.fn.showError(response['data']);
}
}).fail(function(jqXHR, textStatus, errorThrown) {
$.fn.showError(textStatus);
}).always(function() {
NProgress.done();
});
return false;
});
$('body').on('click', 'button.btn-add-job-description', function(e) {
e.preventDefault();
var action = $(this).data('link');
NProgress.start();
$.ajax({
'dataType': 'json',
'accept': 'application/json',
'method': 'get',
'url' : '$routeAdd',
}).done(function(response) {
if (response['success']) {
behaviors = response['data']['behaviors'];
competency_types = response['data']['competency_types'];
competencies = response['data']['competencies'];
competencies_selected = [];
$.each(competencies, function(i, competency) {
$.each(competency.behaviors, function(j, behavior) {
competencies[i].behaviors[j].level = 0;
});
});
$.fn.renderCompetencies();
$.fn.comboCompetencies();
$('#form').attr('action', action);
$('#form #name').val('');
$('#form #status').bootstrapToggle('on');
$('#form #functions').val('');
$('#form #objectives').val('');
$('#job_description_id_boss').empty();
$.each(response['data']['jobs_description'], function(id, text) {
var option = new Option(text, id, false, false);
$('#job_description_id_boss').append(option).trigger('change');
});
$('#job_description_id_boss').trigger('change');
$('#job_description_id_boss').val('').trigger('change');
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();
});
});
$.fn.deleteJobDescription = function(action)
{
swal.fire({
title: 'LABEL_ARE_YOU_SURE',
icon: 'question',
cancelButtonText: 'LABEL_NO',
showCancelButton: true,
confirmButtonText: 'LABEL_YES'
}).then((result) => {
if (result.isConfirmed) {
NProgress.start();
$.ajax({
'dataType' : 'json',
'accept' : 'application/json',
'method' : 'post',
'url' : action,
}).done(function(response) {
if(response['success']) {
$.fn.showSuccess(response['data']);
$.fn.refreshTree();
} else {
$.fn.showError(response['data']);
}
}).fail(function( jqXHR, textStatus, errorThrown) {
$.fn.showError(textStatus);
}).always(function() {
NProgress.done();
});
}
});
}
$.fn.editJobDescription = function(action)
{
NProgress.start();
$.ajax({
'dataType': 'json',
'accept': 'application/json',
'method': 'get',
'url': action,
}).done(function(response) {
if (response['success']) {
$('#form').attr('action', action);
$('#form #id').val(response['data']['id']);
$('#form #name').val(response['data']['name']);
$('#form #status').bootstrapToggle(response['data']['status'] == '$status_active' ? 'on' : 'off')
$('#form #functions').val(response['data']['functions']);
$('#form #objectives').val(response['data']['objectives']);
behaviors = response['data']['behaviors'];
competency_types = response['data']['competency_types'];
competencies = response['data']['competencies'];
competencies_selected = response['data']['competencies_selected'];
$('#job_description_id_boss').empty();
$.each(response['data']['jobs_description'], function(id, text) {
var option = new Option(text, id, false, false);
$('#job_description_id_boss').append(option).trigger('change');
});
$('#job_description_id_boss').trigger('change');
$('#job_description_id_boss').val(response['data']['job_description_id_boss']).trigger('change');
$.fn.renderCompetencies();
$.fn.comboCompetencies();
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();
});
}
$.fn.reportJobDescription = function(action)
{
window.open(action, '_blank');
}
$('body').on('click', 'button[id="btn-select-competency"]', function(e) {
var competency_uuid = $('#select-competency').val();
if (competency_uuid.length == '') {
$.fn.showError('ERROR_SELECT_COMPETENCY_IS_EMPTY');
} else {
competency = competencies.filter((item) => item.uuid == competency_uuid ? item : false)[0];
if(competency) {
var competency_selected = {
uuid : competency.uuid,
competency_type_uuid: competency.competency_type_uuid,
behaviors : new Array(),
}
$.each(competency.behaviors, function(index, uuid) {
competency_selected.behaviors.push({uuid: uuid, level: 0});
})
competencies_selected.push(competency_selected);
$.fn.renderCompetencies();
$.fn.comboCompetencies();
}
}
});
/*
$('body').on('click', 'i.btn-delete-job-description', function(e) {
e.preventDefault();
var action = $(this).data('link');
swal.fire({
title: 'LABEL_ARE_YOU_SURE',
icon: 'question',
cancelButtonText: 'LABEL_NO',
showCancelButton: true,
confirmButtonText: 'LABEL_YES'
}).then((result) => {
if (result.isConfirmed) {
NProgress.start();
$.ajax({
'dataType': 'json',
'accept': 'application/json',
'method': 'post',
'url': action,
}).done(function(response) {
if (response['success']) {
$.fn.showSuccess(response['data']);
$.fn.refreshTree();
} else {
$.fn.showError(response['data']);
}
}).fail(function(jqXHR, textStatus, errorThrown) {
$.fn.showError(textStatus);
}).always(function() {
NProgress.done();
});
}
});
});*/
$('body').on('click', 'button.btn-delete-job-description-competency', function(e) {
e.preventDefault();
var uuid = $(this).data('competency');
swal.fire({
title: 'LABEL_COMPETENCY_DELETE_TITLE',
message: 'LABEL_COMPETENCY_DELETE_MESSAGE',
icon: 'question',
cancelButtonText: 'LABEL_NO',
showCancelButton: true,
confirmButtonText: 'LABEL_YES'
}).then((result) => {
if (result.isConfirmed) {
competencies_selected = competencies_selected.filter((item) => item.uuid != uuid ? item : false);
$.fn.renderCompetencies();
$.fn.comboCompetencies();
}
});
});
$('body').on('click','button.btn-edit-job-description-behavior', function(e) {
e.preventDefault();
var competency_uuid = $(this).closest('div.panel-competency').data('competency');
var behavior_uuid = $(this).data('behavior');
competency_selected = competencies_selected.filter((item) => item.uuid == competency_uuid ? item : false)[0];
if(competency_selected) {
console.log(competency_selected);
behavior = competency_selected .behaviors.filter((item) => item.uuid == behavior_uuid ? item : false)[0];
if(behavior) {
$('#form-behavior #competency-uuid').val(competency_uuid);
$('#form-behavior #behavior-uuid').val(behavior_uuid);
$('#form-behavior #level').val(behavior.level);
$('#modal-behavior').modal('show');
}
}
});
$('body').on('click','button.btn-behavior-submit', function(e) {
e.preventDefault();
$('#modal-behavior').modal('hide');
var competency_uuid = $('#form-behavior #competency-uuid').val();
var behavior_uuid = $('#form-behavior #behavior-uuid').val();
var level = $('#form-behavior #level').val();
competency_selected = competencies_selected.filter((item) => item.uuid == competency_uuid ? item : false)[0];
if(competency_selected) {
behavior = competency_selected .behaviors.filter((item) => item.uuid == behavior_uuid ? item : false)[0];
if(behavior) {
behavior.level = level;
$.fn.renderCompetencies();
}
}
});
$('body').on('click', 'button.btn-edit-job-description-cancel', function(e) {
$('#row-lists').show();
$('#row-form').hide();
});
$('#form #status').bootstrapToggle({
'on': 'LABEL_ACTIVE',
'off': 'LABEL_INACTIVE',
'width': '160px',
'height': '40px'
});
$('#form #functions').maxlength({
alwaysShow: true,
validate: true
});
$('#form #objectives').maxlength({
alwaysShow: true,
validate: true
});
$('#select-competency').select2({
theme: 'bootstrap-5',
width: '100%',
});
$('#job_description_id_boss').select2({
theme: 'bootstrap-5',
width: '100%',
});
oc = $('#chart-container').orgchart({
'data' : datasource,
'nodeId': 'uuid' ,
});
$.fn.refreshTree();
});
JS;
$this->inlineScript()->captureEnd();
?>
<div class="container">
<div class="row" id="row-lists">
<div class="col-12 mt-3">
<div class="card">
<div class="card-header">
<h6 class="card-title">LABEL_JOBS_DESCRIPTION</h6>
</div>
<div class="card-body">
<div id="chart-container" style="width: 100%; height: 600px">
</div>
</div>
<div class="card-footer clearfix">
<div style="float:right;" >
<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-sync"></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-job-description" data-link="<?php echo $routeAdd ?>"><i class="fa fa-plus"></i> LABEL_ADD </button>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
<div class="card" id="row-form" style="display:none">
<div class="card-header">
<h6 class="modal-title">LABEL_JOB_DESCRIPTION</h6>
</div>
<?php
$form = $this->form;
$form->setAttributes([
'method' => 'post',
'name' => 'form',
'id' => 'form'
]);
$form->prepare();
echo $this->form()->openTag($form);
$element = $form->get('competencies');
echo $this->formHidden($element);
?>
<div class="card-body">
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="custom-tabs-general-tab" data-bs-toggle="tab" href="#custom-tabs-general" role="tab" aria-controls="home" aria-selected="true">LABEL_GENERAL</a>
</li>
<li class="nav-item">
<a class="nav-link" id="custom-tabs-compentencies-tab" data-bs-toggle="tab" href="#custom-tabs-compentencies" role="tab" aria-controls="custom-tabs-compentencies" aria-selected="false">LABEL_COMPETENCIES</a>
</li>
</ul>
<div class="tab-content border border-top-0 p-3" id="myTabContent">
<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-12 mt-3">
<?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="row">
<div class="col-12 mt-3">
<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 class="row">
<div class="col-12 mt-3">
<?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>
<div class="row">
<div class="col-12 mt-3">
<?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="row">
<div class="col-12 mt-3">
<?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>
<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 mt-3">
<select id="select-competency" class="form-control"> </select>
</div>
<div class="col-md-4 col-sm-4 col-xs-12 mt-3">
<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">
<div class="col-12 mt-3" id="renderCompetencies">
</div>
</div>
</div>
</div>
</div>
<div class="card-footer text-right">
<button type="submit" form="form" class="btn btn-primary">LABEL_SAVE</button>
<button type="button" class="btn btn-danger btn-edit-job-description-cancel">Cerrar</button>
</div>
<?php echo $this->form()->closeTag($form); ?>
</div>
</div>
<!--start modal behavior-->
<div id="modal-behavior" class="modal" tabindex="-1" role="dialog">
<form action="#" name="form-behavior" id="form-behavior">
<div class="modal-dialog " role="document">
<input type="hidden" id="behavior-uuid" name="behavior-uuid" value="" />
<input type="hidden" id="competency-uuid" name="competency-uuid value="" />
<div class=" modal-content">
<div class="modal-header">
<h6 class="modal-title">LABEL_EDIT LABEL_LEVEL</h6>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-12 mt-3">
<label for="behavior-value">LABEL_LEVEL</label>
<input type="number" step="1" min="0" max="100" id="level" name="level">
</div>
</div>
</div>
<div class="modal-footer text-right">
<button type="button" class="btn btn-primary btn-behavior-submit">LABEL_SAVE</button>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close">LABEL_CLOSE</button>
</div>
</div>
</div>
</form>
</div>
<!---Template Competencies --->
<script id="competencyTemplate" type="text/x-jsrender">
<div class="panel panel-default panel-competency" id="panel-{{:uuid}}" data-competency="{{:uuid}}">
<div class="panel-heading">
<h6 class="panel-title" style=" font-size: 18px;">
<a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:uuid}}" href="#collapse-{{:uuid}}">
<span class="section-name{{:uuid}}">
{{:~getCompetencyType(competency_type_uuid).name}} - {{:~getCompetency(uuid).name}}
</span>
</a>
</h6>
</div>
<div id="collapse-{{:uuid}}" 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-job-description-competency" data-competency="{{:uuid}}" 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_BEHAVIOR</td>
<td class="text-left">
{{:~getBehavior(uuid).description}}
</td>
<td class="text-right">
{{:level}}
</td>
<td>
<button type="button" class="btn btn-default btn-edit-job-description-behavior" data-behavior="{{:uuid}}" 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="competencyTemplateWithLevel" type="text/x-jsrender">
<div class="panel panel-default panel-competency" id="panel-{{:uuid}}" data-competency="{{:uuid}}">
<div class="panel-heading">
<h6 class="panel-title" style=" font-size: 18px;">
<a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:uuid}}" href="#collapse-{{:uuid}}">
<span class="section-name{{:uuid}}">
{{:~getCompetencyType(competency_type_uuid).name}} - {{:~getCompetency(uuid).name}}
</span>
</a>
</h6>
</div>
<div id="collapse-{{:uuid}}" 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-job-description-competency" data-competency="{{:uuid}}" 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_BEHAVIOR</td>
<td class="text-left">
{{:~getBehavior(uuid).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-job-description-behavior" data-behavior="{{:uuid}}" 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="listJobDescriptionTemplate" type="text/x-jsrender">
<li data-id="{{:uuid}}" >
<div class="content">
<div class="sidebar {{if status == '<?php echo JobDescription::STATUS_INACTIVE ?>' }} sidebar-inactive {{/if}}">
{{>name}}
<div class="float-right right-sidebar">
{{if status == '<?php echo JobDescription::STATUS_ACTIVE ?>' }}
{{if link_add }}
<i class="fa fa-plus btn-add-job-description" data-link="{{:link_add}}"></i>
{{/if}}
{{/if}}
{{if link_edit }}
<i class="fa-pen btn-edit-job-description" data-link="{{:link_edit}}"></i>
{{/if}}
{{if link_delete }}
<i class="fa fa-trash btn-delete-job-description" data-link="{{:link_delete}}"></i>
{{/if}}
{{if status == '<?php echo JobDescription::STATUS_ACTIVE ?>' }}
{{if link_report }}
<i class="fa fa-file-o btn-pdf-job-description" data-link="{{:link_report}}"></i>
{{/if}}
{{/if}}
</div>
</div>
</div>
<ol>
{{for children tmpl="#listJobDescriptionTemplate"/}}
</ol>
</li>
</script>