Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16971 | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

<?php
$acl = $this->viewModel()->getRoot()->getVariable('acl');
$currentUser = $this->currentUserHelper();

$roleName = $currentUser->getUserTypeId();

$routeAdd = $this->url('recruitment-selection/forms/add');
$routeDatatable = $this->url('recruitment-selection/forms');
$routeDashboard = $this->url('dashboard');

$allowAdd = $acl->isAllowed($roleName, 'recruitment-selection/forms/add') ? 1 : 0;
$allowEdit = $acl->isAllowed($roleName, 'recruitment-selection/forms/edit') ? 1 : 0;
$allowDelete = $acl->isAllowed($roleName, 'recruitment-selection/forms/delete') ? 1 : 0;
$allowReport = $acl->isAllowed($roleName, 'recruitment-selection/forms/report') ? 1 : 0;


$this->inlineScript()->appendFile($this->basePath('assets/vendors/ckeditor/ckeditor.js'));


$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.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/select2/css/select2.min.css'));
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/select2-bootstrap5-theme/select2-bootstrap-5-theme.css'));

$this->inlineScript()->appendFile($this->basePath('assets/vendors/select2/js/select2.full.min.js'));

$this->inlineScript()->appendFile($this->basePath('assets/vendors/moment/moment-with-locales.min.js'));
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-datetimepicker/js/bootstrap-datetimepicker.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/jquery-input-number/input-number-format.jquery.js'));

// bootbox Alert //


// JsRender //
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jsrender/jsrender.min.js'));


// Page Styles
$this->headLink()->appendStylesheet($this->basePath('css/pages/self-evaluation.css'));


$status_active = \LeadersLinked\Model\RecruitmentForm::STATUS_ACTIVE;
$status_inactive = \LeadersLinked\Model\RecruitmentForm::STATUS_INACTIVE;

$this->inlineScript()->captureStart();
echo <<<JS
jQuery(document).ready(function($) {
    var allowEdit = $allowEdit;
    var allowDelete = $allowDelete;
    var allowReport = $allowReport;
    var sections = [];
    var competencies_type = [];
    /**
     * Get rows and set data table
     */
    var tableForm = $('#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();
           
        },
        'aoColumns': [{
                'mDataProp': 'name'
            },
            {
                'mDataProp': 'job_description'
            },
            {
                'mDataProp': 'status'
            },
            {
                'mDataProp': 'actions'
            },
        ],
        'columnDefs': [{
                'targets': 0,
                'className': 'text-vertical-middle',
            },
            {
                'targets': 1,
                'className': 'text-vertical-middle',
            },
            {
                'targets': -2,
                'orderable': false,
                'className': 'text-center',
                'render': function(data, type, row) {
                    checked = data == 'a'  ? 'checked' : '';
                    return '<div class="form-check">' +
                        '<input type="checkbox" class="form-check-input" disabled="" ' + checked + '>' +
                        '<label class="form-check-label" for="checkCheckedDisabled"></label></div>' ;
                }
            },
            {
                'targets': -1,
                'orderable': false,
                'render': function(data, type, row) {
                    s = '';
                    if (allowEdit) {
                        s = s + '<button class="btn btn-primary btn-edit-form" data-href="' + data['link_edit'] + '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pen"></i> LABEL_EDIT </button>&nbsp;';
                    }
                    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>&nbsp;';
                    }
                    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>&nbsp;';
                    }
                    return s;
                }
            }
        ],
    });
    /**
     * Clicked on edit form
     */
    $('body').on('click', 'button.btn-edit-form', function(e) {
        e.preventDefault();
        renderCompetenciesData([]);
        form_id = $(this).data('id')
        var action = $(this).data('href');
        $.ajax({
            'dataType': 'json',
            'accept': 'application/json',
            'method': 'get',
            'url': action,
        }).done(function(response) {
            if (response['success']) {
                $("#rows").html('');
                sections = [];
                $('#form-main').attr('action', action);
                $('#form-main #form-name').val(response['data']['name']);
                $('#form-main #job_description_id').val(response['data']['job_description_id']).trigger('change');
                $('#form-main #form-status').val(response['data']['status']);
                CKEDITOR.instances['form-description'].setData(response['data']['description']);

                sections = response['data']['content'] || [];
                renderData(sections);
                $('#row-lists').hide();
                $('#row-form').show();
            } else {
                $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
            }
        }).fail(function(jqXHR, textStatus, errorThrown) {
            $.fn.showError(textStatus);
        });
    });
    /**
     * Clicked add new section
     */
    $('#btn-add-section').click(function(e) {
        $('#form-section #id-section').val('');
        $('#form-section #title-section').val('');
        $('#form-section #text-section').val('');
        $('#form-section #type-section').val($('#form-section #type-section option:first').val());
        $('#modal-section h6[class="modal-title"]').html('LABEL_ADD LABEL_SECTION');
        $('#modal-section').modal('show');
        return;
    });
    /**
     * Clicked edit section
     */
    /**
     * Clicked save section
     */
    $('#btn-save-section').click(function(e) {
        if ($('#title-section').val() == '') {
            $.fn.showError('ERROR_ENTER_TITLE');
            return;
        } else {
            $('#id-section').val() == "" ?
                addSection($('#title-section').val(), $('#text-section').val(), $('#type-section').val()) :
                editSection($('#id-section').val(), $('#title-section').val(), $('#text-section').val(), $('#type-section').val())
            $('#modal-section').modal('hide');
            return;
        }
    });
    /**
     * Clicked remove section
     */
    $('body').on('click', 'button.btn-delete-section', function(e) {
        var id_section = $(this).data('section');

          swal.fire({
            title: "LABEL_DELETE LABEL_SECTION",
            message: "LABEL_QUESTION_DELETE",
            icon: 'question',
            cancelButtonText: 'LABEL_NO',
            showCancelButton: true,
            confirmButtonText: 'LABEL_YES'
          }).then((result) => {
            if (result.isConfirmed) {
                removeSection(id_section);
            }
          });

       
    });
    $('body').on('click', 'button.btn-edit-section', function(e) {
        var id = $(this).data('section');
        sections.map((item) => {
            if (item.id_section == id) {
                $('#form-section #id-section').val(item.id_section);
                $('#form-section #title-section').val(item.title);
                $('#form-section #text-section').val(item.text);
                $('#form-section #type-section').val(item.type);
                $('#modal-section').modal('show');
                return;
            }
        });
    });
    /**
     * Clicked remove option
     */
    $('body').on('click', 'button.btn-delete-option', function(e) {
        var id_section = $(this).data('section');
        var id_option = $(this).data('option');

          swal.fire({
            title: "LABEL_DELETE LABEL_OPTION",
            message: "LABEL_QUESTION_DELETE",
            icon: 'question',
            cancelButtonText: 'LABEL_NO',
            showCancelButton: true,
            confirmButtonText: 'LABEL_YES'
          }).then((result) => {
            if (result.isConfirmed) {
                removeOption(id_section, id_option);
                    return;
            }
          });



    });
    /**
     * Clicked add new Option
     */
    $('body').on('click', 'button.btn-add-option', function(e) {
        var id = $(this).data('section');
        $('#section-option').val(id);
        $('#text-option').val('');
        $('#modal-option h6[class="modal-title"]').html('LABEL_EDIT LABEL_OPTION');
        $('#modal-option').modal('show');
        return;
    });
    /**
     * Clicked add new Option
     */
    $('#btn-save-option').click(function(e) {
        if ($('#text-option').val() == '') {
            $.fn.showError('ERROR_ENTER_TEXT');
            return;
        } else {
            $('#id-option').val() == "" ?
                addOption($('#section-option').val(), $('#text-option').val()) :
                editOption($('#section-option').val(), $('#id-option').val(), $('#text-option').val())
        }
        $('#modal-option').modal('hide');
        return;
    });
    /**
     * Clicked edit Option
     */
    $('body').on('click', 'button.btn-edit-option', function(e) {
        var id_section = $(this).data('section');
        var id_option = $(this).data('option');
        sections.map((item) => {
            if (item.id_section == id_section) {
                item.options.map((opt) => {
                    if (opt.id_option == id_option) {
                        $('#id-option').val(opt.id_option);
                        $('#section-option').val(opt.id_section);
                        $("#text-option").val(opt.title);
                        $('#modal-option h6[class="modal-title"]').html('LABEL_EDIT LABEL_OPTION');
                        $('#modal-option').modal('show');
                        return;
                    }
                });
            }
        });
    });
    /**
     * Clicked new Form
     */
    $('button.btn-add-form').click(function(e) {
        $("#rows").html('');
        sections = [];
        $('#form-main').attr('action', '$routeAdd');
        $('#form-main #form-name').val('');
        $('#form-main #job_description_id').val('').trigger('change');
        $('#form-main #form-status').val('$status_active');
        CKEDITOR.instances['form-description'].setData('');
        renderCompetenciesData([]);
        $('#row-lists').hide();
        $('#row-form').show();
        $('#form-main #form-name').focus();
        return;
    });
    /**
     * Clicked cancel new/edit Form
     */
    $('button.btn-edit-cancel').click(function(e) {
        $('#row-form').hide();
        $('#row-lists').show();
        return;
    });
    /**
     * Clicked save and continue new Form
     */
    $('button.btn-form-save-continue').click(function(e) {
        for (var instanceName in CKEDITOR.instances) {
            CKEDITOR.instances[instanceName].updateElement();
        }
        saveData(1);
    });
    /**
     * Clicked save and close new/edit Form
     */
    $('button.btn-form-save-close').click(function(e) {
        for (var instanceName in CKEDITOR.instances) {
            CKEDITOR.instances[instanceName].updateElement();
        }
        saveData(0);
    });
    /**
     * Save Form Data
     */
    const saveData = (action) => {
        if ($('#form-name').val() == '') {
            $.fn.showError('ERROR_ENTER_NAME');
        } else if ($('#form-description').val() == '') {
            $.fn.showError('ERROR_ENTER_DESCRIPTION');
        } else if ($('#form-text').val() == '') {
            $.fn.showError('ERROR_ENTER_TEXT');
        } else if ($('#form-status').val() == '') {
            $.fn.showError('ERROR_SELECT_STATUS');
        } else if ($('#job_description_id').val() == '') {
            $.fn.showError('ERROR_SELECT_JOB_DESCRIPTION');
        } else if (sections.length == 0) {
            $.fn.showError('ERROR_NOT_SECTIONS');
        } else {
            $.ajax({
                'dataType': 'json',
                'method': 'post',
                'url': $('#form-main').attr('action'),
                'data': {
                    'name': $('#form-main #form-name').val(),
                    'job_description_id': $('#form-main #job_description_id').val(),
                    'status': $('#form-main #form-status').val(),
                    'description': $('#form-main #form-description').val(),
                    'content': JSON.stringify(sections)
                },
            }).done(function(response) {
                if (response['success']) {
                    $.fn.showSuccess(response['data']);
                    if (action == 1) {
                        $('#form-main').attr('action', response['action_edit']);
                    } else {
                        $('#row-form').hide();
                        $('#row-lists').show();
                        /*---------- Reset Form -------- */
                        $('#form-main')[0].reset();
                        /*--------Reset Sections ----------*/
                        sections = [];
                        tableForm.fnDraw();
                    }
                    return;
                } else {
                    $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
                    return;
                }
            });
        }
    }
    /**
     * Remove Html Tags
     */
    const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
    /**
     * Render Sections data
     */
    const renderData = (data) => {
        $("#rows").html($("#sectionTemplate").render(data));
    }
    /**
     * Add Section to array
     */
    const addSection = (title, text, type) => {
        sections.push({
            'id_section': new Date().getTime(),
            'title': title,
            'type': type,
            'text': text,
            'answer': '',
            'options': []
        });
        return renderData(sections);
    }
    /**
     * Edit item behavior
     */
    const editSection = (id, title, text, type) => {
        sections.map((item) => {
            if (item.id_section == id) {
                item.title = title;
                item.type = type;
                item.text = text;
            }
        });
        return renderData(sections);
    }
    /**
     * Remove behavior
     */
    const removeSection = (id) => {
        sections = sections.filter((item) => item.id_section != id);
        return renderData(sections);
    }
    /**
     * Add Option to array
     */
    const addOption = (id_section, title) => {
        sections.map((item) => {
            if (item.id_section == id_section) {
                item.options.push({
                    'id_section': id_section,
                    'id_option': new Date().getTime(),
                    'title': title,
                    'answer': ''
                });
            }
        });
        return renderData(sections);
    }
    /**
     * Edit item Option
     */
    const editOption = (id_section, id, title) => {
        sections.map((item) => {
            if (item.id_section == id_section) {
                item.options.map((opt) => {
                    if (opt.id_option == id) {
                        opt.title = title
                    }
                });
            }
        });
        return renderData(sections);
    }
    /**
     * Remove Option
     */
    const removeOption = (id_section, id) => {
        sections.map((item) => {
            if (item.id_section == id_section) {
                item.options = item.options.filter((opt) => opt.id_option != id) || []
            }
        });
        return renderData(sections);
    }
    /**
     * Clicked refresh button
     */
    $('button.btn-refresh').click(function(e) {
        tableForm.fnDraw();
        return;
    });

 $('body').on('click', 'button.btn-delete', function(e) { 
        e.preventDefault();
        var action = $(this).data('href');


          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']);
                            gridTable.api().ajax.reload(null, false);
                        } else {
                            $.fn.showError(response['data']);
                        }
                    }).fail(function( jqXHR, textStatus, errorThrown) {
                        $.fn.showError(textStatus);
                    }).always(function() {
                        NProgress.done();
                    });
            }
       });
    });

    /**
     * Initialize select Jobdescription
     */
    $('#job_description_id').select2({
        theme: 'bootstrap-5',
        width: '100%',
    });
    /**
     * On change selecte JobDescription
     */
    $('#job_description_id').on('change', function() {
        if ($("#job_description_id").val() != '') {
            $.getJSON("/jobs-description/edit/" + $("#job_description_id").val(), function(response) {
                if (response['success']) {
                    competencies_type = response['data']['competency_types'];
                    renderCompetenciesData(response['data']['competencies_selected']);
                }
            });
        }
    });
    /**
     * Filter competencie type
     */
    const filterTypeById = (id) => competencies_type.filter((item) => item.competency_type_id == id ? item : false)[0];
    /**
     * Render Competencies data
     */
    const renderCompetenciesData = (data) => {
        if (data.length > 0) {
            $("#competencies-to-job").show();
            $("#rows-job-competencies").html($("#sectionCompetencies").render(data, {
                getType: filterTypeById
            }));
        } else {
            $("#competencies-to-job").hide();
            $("#rows-job-competencies").html('');
        }
    }
});
JS;

$this->inlineScript()->captureEnd();
?>
<div class="container">
        <div class="card" id="">
                <div class="card-header">
                        <h6 class="card-title">LABEL_PERFORMANCE_EVALUATION</h6>
                </div>
                <div class="card-body">
                        <div class="row">
                         <div class="col-12 mt-3">
                         
                            <table id="gridTable" class="table   table-bordered">
                  <thead>
                     <tr>
                        <th style="width:25%">LABEL_NAME</th>
                        <th style="width:20%">LABEL_JOB_DESCRIPTION</th>
                        <th style="width:10%">LABEL_ACTIVE</th>
                        <th style="width:25%">LABEL_ACTIONS</th>
                     </tr>
                  </thead>
                  <tbody></tbody>
               </table>
               
                         </div>
                     </div>
                </div>
                <div class="card-footer text-right">
                         <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) : ?>
                  <button type="button" class="btn btn-primary btn-add-form"><i class="fa fa-plus"></i> LABEL_ADD </button>
                  <?php endif; ?>
               </div>
                </div>
        </div>
</div>


<!-- Create/Edit Form -->
<div class="row" id="row-form" style="display: none; padding: 16px;">
   <div class="col-12">
      <form action="#" name="form-main" id="form-main">
        <div class="row">
                <div class="col-12 mt-3">
            <label for="form-name">LABEL_FIRST_NAME</label>
            <input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
            </div>
         </div>
        <div class="row">
                <div class="col-12 mt-3">
            <label for="job_description_id">LABEL_POSITION_EVALUATED</label>
            <select name="job_description_id" id="job_description_id" class="form-control">
               <option value="">LABEL_SELECT</option>
               <?php foreach ($jobsDescription as $rs): ?>
               <option value="<?php echo $rs->uuid;?>"><?php echo $rs->name;?></option>
               <?php endforeach; ?>
            </select>
            </div>
         </div>
        <div class="row">
                <div class="col-12 mt-3">
            <label for="form-description">LABEL_DESCRIPTION</label>
            <!--  ckeditor -->
            <textarea  name="form-description" id="form-description" rows="5" class="ckeditor form-control"></textarea>
            </div>
         </div>
        <div class="row">
                <div class="col-12 mt-3">
            <label for="form-status">LABEL_STATUS</label>
            <select name="form-status" id="form-status" class="form-control">
               <option value="<?php echo $status_inactive; ?>">LABEL_INACTIVE</option>
               <option value="<?php echo $status_active; ?>">LABEL_ACTIVE</option>
            </select>
            </div>
         </div>
         <div class="row">
            <div class="col-12 text-right">
               <button type="button" class="btn btn-primary" id="btn-add-section" data-toggle="tooltip" title="LABEL_ADD LABEL_SECTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD LABEL_SECTION</button>
            </div>
         </div>
         <br /> 
         <div class="row">
            <div class="col-12">
               <div class="panel-group" id="rows"></div>
            </div>
         </div>
         <div class="form-group" id="competencies-to-job" style="display:none">
            <div class="row">
               <div class="col-12">
                  <hr>
                  <h6 style="font-size: 18px;font-weight: bold;">LABEL_COMPETENCIES_TO_JOB:</h6>
                  <br>
                  <div class="panel-group" id="rows-job-competencies"></div>
               </div>
            </div>
         </div>
         <div class="form-group">
            <button type="button" form="form-main" class="btn btn-info btn-form-save-continue">LABEL_SAVE & LABEL_CONTINUE</button>
            <button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE & LABEL_CLOSE</button>
            <button type="button" class="btn btn-light btn-edit-cancel">LABEL_CANCEL</button>
         </div>
      </form>
   </div>
</div>
<!-- Create/Edit Form-->
<!-- section Modal -->
<div  id="modal-section" class="modal" tabindex="-1" role="dialog">
   <div class="modal-dialog modal-lg" role="document">
      <form action="#" name="form-section" id="form-section">
         <input type="hidden" name="id-section" id="id-section" />
         <div class="modal-content">
            <div class="modal-header">
               <h6 class="modal-title">LABEL_ADD LABEL_SECTION</h6>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
            </div>
            <div class="modal-body">
               <div class="form-group">
                  <label for="title-section">LABEL_FIRST_NAME</label>
                  <input type="text" name="title-section" id="title-section" class="form-control" maxlength="50" value="" />
               </div>
               <div class="form-group">
                  <label for="text-section">LABEL_TEXT</label>
                  <textarea  name="text-section" id="text-section" rows="5" class="form-control"></textarea>
               </div>
               <div class="form-group">
                  <label for="type-section">LABEL_TYPE</label>
                  <select name="type-section" id="type-section" class="form-control">
                     <option value="simple">Simple</option>
                     <option value="multiple">Multiple</option>
                  </select>
               </div>
            </div>
            <div class="modal-footer text-right">
               <button type="button" id="btn-save-section" class="btn btn-primary">LABEL_SAVE</button>
               <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close">LABEL_CLOSE</button>
            </div>
         </div>
      </form>
   </div>
</div>
<!-- End Modal section -->
<!-- Modal Options -->
<div  id="modal-option" class="modal" tabindex="-1" role="dialog">
   <div class="modal-dialog modal-lg" role="document">
      <form action="#" name="form-option" id="form-option">
         <input type="hidden" name="section-option" id="section-option" value="" />
         <input type="hidden" name="id-option" id="id-option" value="" />
         <div class="modal-content">
            <div class="modal-header">
               <h6 class="modal-title">LABEL_OPTION</h6>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
            </div>
            <div class="modal-body">
               <div class="form-group">
                  <label for="text-option">LABEL_TEXT</label>
                  <!--  ckeditor -->
                  <textarea  name="text-option" id="text-option" rows="5" class="form-control"></textarea>
               </div>
            </div>
            <div class="modal-footer text-right">
               <button type="button" class="btn btn-primary" id="btn-save-option">LABEL_SAVE</button>
               <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close">LABEL_CLOSE</button>
            </div>
         </div>
      </form>
   </div>
</div>

   <!-- End Modal Options -->
   <!---Template Sections --->
   <script id="sectionTemplate" type="text/x-jsrender">
   <div class="panel panel-default" id="panel-{{:id_section}}">
   <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-{{:id_section}}" href="#collapse-{{:id_section}}">
         <span class="section-name{{:id_section}}">
         {{:title}}
         </span>
         </a>
      </h6>
   </div>
   <div id="collapse-{{:id_section}}" class="panel-collapse in collapse show">
      <div class="panel-body">
         <div class="table-responsive">
            <table class="table table-bordered">
               <thead>
                  <tr>
                     <th style="width: 10%;">LABEL_ELEMENT</th>
                     <th style="width: 30%;">LABEL_TEXT</th>
                     <th style="width: 10%;">LABEL_TYPE</th>
                     <th style="width: 50%;">LABEL_ACTIONS</th>
                  </tr>
               </thead>
               <tbody>
                  <tr>
                     <td class="text-left">LABEL_SECTION</td>
                     <td class="text-left">{{:title}}</td>
                     <td>
                        {{if type == 'simple'}} Simple {{/if}}
                        {{if type == 'multiple'}} Multiple {{/if}}
                     </td>
                     <td>
                        <button  type="button" class="btn btn-default btn-edit-section" data-section="{{:id_section}}" data-toggle="tooltip"  data-original-title="LABEL_EDIT LABEL_SECTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_SECTION </button>
                        <button  type="button" class="btn btn-default btn-delete-section" data-section="{{:id_section}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE LABEL_SECTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_SECTION </button> 
                        {{if type == 'multiple'}}
                        <button type="button" class="btn btn-default btn-add-option" data-section="{{:id_section}}" data-toggle="tooltip"  data-original-title="LABEL_ADD  LABEL_OPTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD  LABEL_OPTION </button> 
                        {{/if}}
                     </td>
                  </tr>
                  {{for options}}
                  <tr >
                     <td class="text-left">--LABEL_OPTION</td>
                     <td class="text-left">
                        {{:title}}
                     </td>
                     <td></td>
                     <td>
                        <button type="button"  class="btn btn-default btn-edit-option" data-section="{{:id_section}}" data-option="{{:id_option}}" data-toggle="tooltip"  data-original-title="LABEL_EDIT LABEL_OPTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_OPTION</button> 
                        <button type="button" class="btn btn-default btn-delete-option" data-section="{{:id_section}}" data-option="{{:id_option}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE LABEL_OPTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_OPTION</button> 
                     </td>
                  </tr>
                  {{/for}}
               </tbody>
            </table>
         </div>
      </div>
   </div>
</div>
   </script>
   <!-- End Template Sections-->

  <!---Template Competencies --->
   <script id="sectionCompetencies" type="text/x-jsrender">
   <div class="panel panel-default" id="panel-{{:competency_id}}">
   <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-{{:competency_id}}" href="#collapse-{{:competency_id}}">
         <span class="competency-name{{:competency_id}}">
         {{:~getType(competency_type_id).name}} - {{:name}}
         </span>
         </a>
      </h6>
   </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: 80%;">LABEL_BEHAVIOR</th>
                     <th style="width: 20%;">LABEL_LEVEL</th>
                  </tr>
               </thead>
               <tbody>
                  {{for behaviors}}
                  <tr >
                     <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>

              
                  </tr>
                  {{/for}}
               </tbody>
            </table>
         </div>
      </div>
   </div>
</div>
   </script>
    <!-- End Template Competencies-->
   
</section>