Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 1078 | Rev 1085 | Ir a la última revisión | 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('performance-evaluation/forms/add');
$routeDatatable = $this->url('performance-evaluation/forms');
$routeDashboard = $this->url('dashboard');

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


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


$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.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/select2/css/select2.min.css'));
$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css'));

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

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

// bootbox Alert //
$this->inlineScript()->appendFile($this->basePath('plugins/bootbox/bootbox.min.js'));

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


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

$this->inlineScript()->captureStart();
echo <<<JS
   jQuery(document).ready(function($) {
            var allowEdit = $allowEdit;
            var allowDelete = $allowDelete;
            var sections = [];
            /**
             * 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();
                    $('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']);
                                    tableForm.fnDraw();
                                } else {
                                    $.fn.showError(response['data']);
                                }
                            }).fail(function(jqXHR, textStatus, errorThrown) {
                                $.fn.showError(textStatus);
                            }).always(function() {
                                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="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-form" data-href="' + data['link_edit'] + '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></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;';
                            }
                            return s;
                        }
                    }
                ],
            });
            /**
             * Clicked on edit form
             */
            $('body').on('click', 'button.btn-edit-form', function(e) {
                e.preventDefault();
                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']);
                        $('#form-main #form-status').val(response['data']['status']);
                        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 h4[class="modal-title"]').html('LABEL_ADD LABEL_SECTION');
                $('#modal-section').modal('show');
            });
            /**
             * Clicked edit section
             */
            /**
             * Clicked save section
             */
            $('#btn-save-section').click(function(e) {
                if ($('#title-section').val() == '') {
                    $.fn.showError('Ingrese un nombre');
                    return;
                } else {
                    if ($('#id-section').val() == "") {
                        addSection(
                            $('#title-section').val(),
                            $('#text-section').val(),
                            $('#type-section').val(),
                        )
                    } else {
                        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) {
                e.preventDefault();
                var id_section = $(this).data('section');
                bootbox.confirm({
                    title: "LABEL_DELETE LABEL_SECTION",
                    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) {
                            removeSection(id_section);
                        }
                    }
                });
            });
            $('body').on('click', 'button.btn-edit-section', function(e) {
                e.preventDefault();
                var id = $(this).data('section');
                console.log(id);
                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-text').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) {
                e.preventDefault();
                var id_section = $(this).data('section');
                var id_option = $(this).data('option');
                bootbox.confirm({
                    title: "LABEL_DELETE LABEL_OPTION",
                    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) {
                            removeOption(id_section, id_option);
                        }
                    }
                });
            });
            /**
             * Clicked add new Option
             */
            $('body').on('click', 'button.btn-add-option', function(e) {
                e.preventDefault();
                var id = $(this).data('section');
                $('#section-option').val(id);
                $('#text-option').val('');
                $('#modal-option h4[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('Ingrese un texto');
                    return;
                } else {
                    if ($('#id-option').val() == "") {
                        addOption(
                            $('#section-option').val(),
                            $('#text-option').val(),
                        )
                    } else {
                        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) {
                e.preventDefault();
                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 h4[class="modal-title"]').html('LABEL_EDIT LABEL_OPTION');
                                $('#modal-option').modal('show');
                                return;
                            }
                        });
                    }
                });
            });
            /**
             * Clicked new Form
             */
            $('button.btn-add-form').click(function(e) {
                $('#form-main').attr('action', '$routeAdd');
                $('#form-main #form-name').val('');
                $('#form-main #job_description_id').val('');
                $('#form-main #form-status').val('$status_active');
                $("#rows").html('');
                sections = [];
                $('#row-lists').hide();
                $('#row-form').show();
                $('#form-main #form-name').focus();
            });
            /**
             * Clicked cancel new/edit Form
             */
            $('button.btn-edit-cancel').click(function(e) {
                e.preventDefault();
                $('#row-form').hide();
                $('#row-lists').show();
            });
            /**
             * Clicked save and close new/edit Form
             */
            $('button.btn-form-save-close').click(function(e) {
                e.preventDefault();
                if ($('#form-name').val() == '') {
                    $.fn.showError('Ingrese un nombre');
                } else if ($('#form-status').val() == '') {
                    $.fn.showError('Seleccione un status');
                } else if ($('#job_description_id').val() == '') {
                    $.fn.showError('Seleccione una descripción de cargo');
                } else if (sections.length == 0) {
                    $.fn.showError('Debe ingresar al menos una sección');
                } else {
                    var data = {
                        'name': $('#form-main #form-name').val(),
                        'job_description_id': $('#form-main #job_description_id').val(),
                        'status': $('#form-main #form-status').val(),
                        'content': JSON.stringify(sections)
                    }
                    $.ajax({
                        'dataType': 'json',
                        'method': 'post',
                        'url': $('#form-main').attr('action'),
                        'data': data,
                    }).done(function(response) {
                        if (response['success']) {
                            $.fn.showSuccess(response['data']);
                            $('#row-form').hide();
                            $('#row-lists').show();
                            /*---------- Reset Form -------- */
                            $('#form-main')[0].reset();
                            /*--------Reset Sections ----------*/
                            sections = [];
                            tableForm.fnDraw();
                        } else {
                            $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
                        }
                    });
                }
            });
            /**
             * Remove Html Tags
             */
            const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
            /**
             * Render Sections data
             */
            const renderData = (data) => {
                console.log(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,
                    'options': []
                });
                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;
                    }
                });
                renderData(sections);
            }
            /**
             * Remove behavior
             */
            const removeSection = (id) => {
                sections = sections.filter((item) => item.id_section != id);
                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,
                        });
                    }
                });
                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
                            }
                        });
                    }
                });
                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) || []
                    }
                });
                renderData(sections);
            }
            /**
             * Clicked refresh button
             */
            $('button.btn-refresh').click(function(e) {
                tableForm.fnDraw();
            });
});
JS;
$this->inlineScript()->captureEnd();
?>
<!-- Content Header (Page header) -->
<section class="content-header">
   <div class="container-fluid">
      <div class="row mb-2">
         <div class="col-sm-12">
            <h1>LABEL_PERFORMANCE_EVALUATION</h1>
         </div>
      </div>
   </div>
   <!-- /.container-fluid -->
</section>
<section class="content">
   <div class="container-fluid" id="row-lists">
      <div class="row">
         <div class="col-12">
            <div class="card">
               <div class="card-body">
                  <table id="gridTable" class="table   table-hover">
                     <thead>
                        <tr>
                           <th style="width:15%">LABEL_NAME</th>
                           <th style="width:25%">LABEL_JOB_DESCRIPTION</th>
                           <th style="width:15%">LABEL_ACTIVE</th>
                           <th style="width:20%">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) : ?>
                     <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>
      </div>
   </div>
   <!-- Create/Edit Form -->
   <div class="row" id="row-form" style="display: none; padding: 16px;">
      <div class="col-xs-12 col-md-12">
         <form action="#" name="form-main" id="form-main">
            <input type="hidden" name="form-continue" id="form-continue" value="0" />
            <div class="form-group">
               <label for="form-name">LABEL_FIRST_NAME</label>
               <input type="text" name="form-name" id="form-name" class="form-control" maxlength="50" />
            </div>
            <div class="form-group">
                    <label for="job_description_id">LABEL_JOB_DESCRIPTION</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 class="form-group">
                    <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 class="row">
               <div class="col-xs-12 col-md-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-xs-12 col-md-12">
                  <div class="panel-group" id="rows"></div>
               </div>
            </div>
            <div class="form-group">
               <button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE & LABEL_CLOSE</button>
               <button type="button" class="btn btn-secondary 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">
                  <h4 class="modal-title">LABEL_ADD LABEL_SECTION</h4>
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                  </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">
                  <button type="button" id="btn-save-section" class="btn btn-primary">LABEL_SAVE</button>
                  <button type="button" class="btn btn-secondary" data-dismiss="modal">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">
                  <h4 class="modal-title">LABEL_OPTION</h4>
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                  </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">
                  <button type="button" class="btn btn-primary" id="btn-save-option">LABEL_SAVE</button>
                  <button type="button" class="btn btn-secondary" data-dismiss="modal">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">
      <h4 class="panel-title">
         <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}}">
         {{:name}}
         </span>
         </a>
      </h4>
   </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 class="tr-section">
                     <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  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  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 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 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-->
</section>