Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 10135 | Rev 11070 | 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();

$routeDatatable = $this->url('recruitment-and-selection/candidates');
$routeEmail = $this->url('recruitment-and-selection/user-by-email');
$routeAdd = $this->url('recruitment-and-selection/candidates/add', ['vacancy_uuid' => 'UUID_PLACEHOLDER']);

$allowAdd = $acl->isAllowed($roleName, 'recruitment-and-selection/candidates/add') ? 1 : 0;
$allowDelete = $acl->isAllowed($roleName, 'recruitment-and-selection/candidates/delete') ? 1 : 0;
$allowEdit = $acl->isAllowed($roleName, 'recruitment-and-selection/candidates/edit') ? 1 : 0;
$allowEmail = $acl->isAllowed($roleName, 'recruitment-and-selection/user-by-email') ? 1 : 0;

$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));

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

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

$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/css/fileinput.min.css'));
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.css'));

$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/piexif.js'));
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/sortable.js'));
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/fileinput.js'));
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/locales/es.js'));
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/fas/theme.js'));
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.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->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/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/select2/js/select2.js'));
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/i18n/es.js'));
$this->headLink()->appendStylesheet($this->basePath('plugins/select2/css/select2.css'));

$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.css'));

$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));


$status_active = \LeadersLinked\Model\RecruitmentSelectionCandidate::STATUS_ACEPTED;
$status_inactive = \LeadersLinked\Model\RecruitmentSelectionCandidate::STATUS_REJECTED;

$evaluation_0 = \LeadersLinked\Model\RecruitmentSelectionCandidate::EVALUATION_0;
$evaluation_1 = \LeadersLinked\Model\RecruitmentSelectionCandidate::EVALUATION_1;
$evaluation_2 = \LeadersLinked\Model\RecruitmentSelectionCandidate::EVALUATION_2;
$evaluation_3 = \LeadersLinked\Model\RecruitmentSelectionCandidate::EVALUATION_3;
$evaluation_4 = \LeadersLinked\Model\RecruitmentSelectionCandidate::EVALUATION_4;

$this->inlineScript()->captureStart();
echo <<<JS
    $.prototype.fileinput.Constructor.prototype["setUploadUrl"] = function(url) {
        this.uploadUrl = url;
    }


jQuery(document).ready(function ($) {



    var allowAdd = $allowAdd;
    var allowDelete = $allowDelete;
    var allowEdit = $allowEdit;
    var allowEmail = $allowEmail;

    var gridTable = $('#gridTable').dataTable({
        'processing': true,
        'serverSide': true,
        'searching': true,
        'order': [[1, 'asc']],
        'ordering': true,
        'ordenable': true,
        'responsive': true,
        'select': false,
        'paging': true,
        'pagingType': 'simple_numbers',
        'lengthMenu': [[10, 25, 50, -1], [10, 25, 50, 'All']],

        'ajax': {
            'url': '$routeDatatable',
            'type': 'get',
            'data': function (d) {
            },
            'beforeSend': function (request) {
                NProgress.start();
            },
            'dataFilter': function (response) {
                var response = jQuery.parseJSON(response);

                var json = {};
                json.recordsTotal = 0;
                json.recordsFiltered = 0;
                json.data = [];

                if (response.success) {
                    json.recordsTotal = response.data.total;
                    json.recordsFiltered = response.data.total;
                    json.data = response.data.items;
                } else {
                    $.fn.showError(response.data)
                }

                return JSON.stringify(json);
            }
        },
        'language': {
            'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
            'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
            'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
            'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
            'sInfo': 'LABEL_DATATABLE_SINFO',
            'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
            'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
            'sInfoPostFix': '',
            'sSearch': 'LABEL_DATATABLE_SSEARCH',
            'sUrl': '',
            'sInfoThousands': ',',
            'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
            'oPaginate': {
                'sFirst': 'LABEL_DATATABLE_SFIRST',
                'sLast': 'LABEL_DATATABLE_SLAST',
                'sNext': 'LABEL_DATATABLE_SNEXT',
                'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
            },
            'oAria': {
                'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
                'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
            },
        },
        'drawCallback': function (settings) {
            NProgress.done();
            $('button.btn-delete').confirmation({
                rootSelector: 'button.btn-delete',
                title: 'LABEL_ARE_YOU_SURE',
                singleton: true,
                btnOkLabel: 'LABEL_YES',
                btnCancelLabel: 'LABEL_NO',
                onConfirm: function (value) {
                    action = $(this).data('href');
                    NProgress.start();
                    $.ajax({
                        'dataType': 'json',
                        'accept': 'application/json',
                        'method': 'post',
                        'url': action,
                    }).done(function (response) {
                        if (response['success']) {
                            $.fn.showSuccess(response['data']);
                            gridTable.api().ajax.reload(null, false);
                        } else {
                            $.fn.showError(response['data']);
                        }
                    }).fail(function (jqXHR, textStatus, errorThrown) {
                        $.fn.showError(textStatus);
                    }).always(function () {
                        NProgress.done();
                    });
                },
            });

            $('#form-add #file').fileinput({
                theme: 'fas',
                language: 'es',
                showUpload: false,
                dropZoneEnabled: false,
                maxFileCount: 1,
                allowedFileExtensions: ['pdf', 'docx'],
            });

            $('#form-edit #file').fileinput({
                theme: 'fas',
                language: 'es',
                showUpload: false,
                initialPreviewAsData: true,
                dropZoneEnabled: false,
                maxFileCount: 1,
                allowedFileExtensions: ['pdf', 'docx'],
            });


            $('body').on('click', 'button.btn-add', function (e) {
                e.preventDefault();

                $('#form-add #user_id').val('');
                $('#form-add #first_name').val('');
                $('#form-add #last_name').val('');
                $('#form-add #email').val('');
                $('#form-add #file').fileinput('reset');
                $('#form-add #file').val('');
                $('#form-add #status').val('$status_active');
                $('#form-add #evaluation').val('$evaluation_0');
                $('#first-step').show();
                $('#second-step').hide();
                CKEDITOR.instances.coment.setData('');
                validatorAdd.resetForm();
                
                $('#add-candidate-box').modal('show');
                return false;
            });

            $(".close-box, .btn-add-cancel").on("click", function (e) {
                e.preventDefault();
                $('#form-add #first_name').prop("disabled", false);
                $('#form-add #last_name').prop('disabled', false);
                $('#secon-step').hide();
                $('#add-candidate-box').modal('hide');
                $('#edit-candidate-box').modal('hide');
                return false;
            });

            var validatorEdit = $('#form-edit').validate({
                debug: true,
                onclick: false,
                onkeyup: false,
                onfocusout: false,
                ignore: [],
                rules: {
                    'user_id': {
                        required: false,
                    },
                    'first_name': {
                        required: true,
                        maxlength: 128,
                    },
                    'file': {
                        required: false,
                        extension: 'pdf|docx',
                        accept: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/msword,application/pdf'
                    },
                    'last_name': {
                        required: true,
                    },
                    'email': {
                        required: true,
                    },
                    'evaluation':{
                        required: false,
                    },
                    'coment':{
                        updateCkeditor:function() {
                        CKEDITOR.instances.coment.updateElement();
                        },
                    },
                    'status': {
                        required: true,
                    }
                },
                submitHandler: function (form) {
                    var formdata = false;
                    if (window.FormData) {
                        formdata = new FormData(form); //form[0]);
                    }

                    $('input[type="submit"]').prop('disabled', true);

                    $.ajax({
                        'dataType': 'json',
                        'accept': 'application/json',
                        'method': 'post',
                        'url': $('#form-edit').attr('action'),
                        'data': formdata,
                        'processData': false,
                        'contentType': false,
                    }).done(function (response) {
                        if (response['success']) {
                            $.fn.showSuccess(response['data']);

                            $('#edit-candidate-box').modal('hide');
                            gridTable.api().ajax.reload(null, false);
                        } else {
                            validatorEdit.resetForm();
                            if (jQuery.type(response['data']) == 'string') {
                                $.fn.showError(response['data']);
                            } else {
                                $.each(response['data'], function (fieldname, errors) {
                                    $.fn.showFormErrorValidator('#form-edit #' + 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-edit', function (e) {
                e.preventDefault();

                var url = $(this).data('href');
                $.ajax({
                    'dataType': 'json',
                    'accept': 'application/json',
                    'method': 'get',
                    'url': url,
                }).done(function (response) {
                    if (response['success']) {
                        $('#form-edit')[0].reset();

                        $('#form-edit').attr('action', url);

                        $('#form-edit #first_name').val(response['data']['user_id']);
                        $('#form-edit #first_name').val(response['data']['first_name']);
                        $('#form-edit #last_name').val(response['data']['last_name']);
                        $('#form-edit #email').val(response['data']['email']);
                        $('#form-edit #status').val(response['data']['status']);
                        $('#form-edit #evaluation').val(response['data']['evaluation']);
                        $('#form-edit #coment').val(response['data']['coment']);
                        $('#form-edit #btn-cv').attr('href', response['data']['file']);

                        

                        $('#form-edit #file').fileinput('reset');
                        $('#form-edit #file').fileinput('setUploadUrl', response['data']['file'] );


                        $('#form-edit #status').val(response['data']['status']);

                        $('#edit-candidate-box').modal('show');
                    } else {
                        validatorEdit.resetForm();
                        if (jQuery.type(response['data']) == 'string') {
                            $.fn.showError(response['data']);
                        } else {
                            $.each(response['data'], function (fieldname, errors) {
                                $.fn.showFormErrorValidator('#form-edit #' + fieldname, errors);
                            });
                        }
                    }
                }).fail(function (jqXHR, textStatus, errorThrown) {
                    $.fn.showError(textStatus);
                }).always(function () {
                    NProgress.done();
                });
            });

            var validatorAdd = $('#form-add').validate({
                debug: true,
                onclick: false,
                onkeyup: false,
                onfocusout: false,
                ignore: [],
                rules: {
                    'user_id': {
                        required: false,
                    },
                    'first_name': {
                        required: true,
                        maxlength: 128,
                    },
                    'file': {
                        required: false,
                        extension: 'pdf|docx',
                        accept: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/msword,application/pdf'
                    },
                    'last_name': {
                        required: true,
                    },
                    'email': {
                        required: true,
                    },
                    'evaluation':{
                        required: false,
                    },
                    'coment':{
                        updateCkeditor:function() {
                            CKEDITOR.instances.coment.updateElement();
                        },
                    },
                    'status': {
                        required: true,
                    }
                },
                submitHandler: function (form) {
                    var formdata = false;
                    if (window.FormData) {
                        formdata = new FormData(form); //form[0]);
                    }

                    $('input[type="submit"]').prop('disabled', true);

                    $.ajax({
                        'dataType': 'json',
                        'accept': 'application/json',
                        'method': 'post',
                        'url': $('#form-add').attr('action'),
                        'data': formdata,
                        'processData': false,
                        'contentType': false,
                    }).done(function (response) {
                        if (response['success']) {
                            $.fn.showSuccess(response['data']);

                            $('#add-candidate-box').modal('hide');
                            gridTable.api().ajax.reload(null, false);
                        } else {
                            validatorAdd.resetForm();
                            if (jQuery.type(response['data']) == 'string') {
                                $.fn.showError(response['data']);
                            } else {
                                $.each(response['data'], function (fieldname, errors) {
                                    $.fn.showFormErrorValidator('#form-add #' + fieldname, errors);
                                });
                            }
                        }
                    }).fail(function (jqXHR, textStatus, errorThrown) {
                        $.fn.showError(textStatus);
                    }).always(function () {
                        NProgress.done();
                    });
                    return false;
                },
                invalidHandler: function (form, validator) {

                }
            });
        },
        'aoColumns': [
            { 'mDataProp': 'first_name' },
            { 'mDataProp': 'last_name' },
            { 'mDataProp': 'email' },
            { 'mDataProp': 'status' },
            { 'mDataProp': 'actions' },
        ],
        'columnDefs': [
            {
                '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 && data['link_edit']) {
                        s = s + '<button class="btn btn-info btn-sm btn-edit" data-href="' + data['link_edit'] + '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button>&nbsp;';
                    }

                    if (allowDelete && data['link_delete']) {
                        s = s + '<button class="btn btn-danger btn-sm btn-delete" data-href="' + data['link_delete'] + '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-times"></i> LABEL_DELETE </button>&nbsp;';
                    }

                    return s;
                }
            }
        ],
    });

    $('#form-filter #form_uuid').change(function (e) {
        e.preventDefault();

        var uuid = e.target.value;

        $('#form-add').attr('action', String("$routeAdd").replaceAll('UUID_PLACEHOLDER', uuid));

        gridTable.api().ajax.url("$routeDatatable" + "/" + uuid);
        gridTable.api().ajax.reload(null, false);
    })


    $('body').on('click', 'button.btn-refresh', function (e) {
        e.preventDefault();
        gridTable.api().ajax.reload(null, false);
    });

    $('body').on('click', '#btn-next', function () {
       $("#first-step").hide();
       $("#second-step").show();
    });

    $('#form-filter #form_uuid').change();

    $('body').on('click', '#check-email', function () {
        $.ajax("$routeEmail", {
            accepts: 'application/json',
            method: 'GET',
            data: {
                'email': $('#form-add #email').val(),
            }
        }).done(function (response) {
            if (response['success']) {
                $('#form-add #user_id').val(response['data']['user_id']);
                $('#form-add #first_name').val(response['data']['first_name']);
                $('#form-add #last_name').val(response['data']['last_name']);
               // $('#form-add #first_name').prop("disabled", true);
               // $('#form-add #last_name').prop('disabled', true);
            } else {
                $.fn.showError(response['data']);
            }
        }).fail(function (jqXHR, textStatus, errorThrown) {
            $.fn.showError(textStatus);
        }).always(function () {
            NProgress.done();
        });
    })

    CKEDITOR.replace('coment', {
        toolbar: [
                    { name: 'editing', items: ['Scayt'] },
                    { name: 'links', items: ['Link', 'Unlink'] },
                    { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
                    { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
                    '/',
                    { name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
                    { name: 'styles', items: ['Styles', 'Format'] },
                    { name: 'tools', items: ['Maximize'] }
                ],
                removePlugins: 'elementspath,Anchor',
                heigth: 100
    });
});
JS;
$this->inlineScript()->captureEnd();

$jsonVacancies = json_encode($vacancies);

$js = <<<JS
        const backendVariables= {
                email_link: "$routeEmail",
        add_link: "$routeAdd",
        table_link: "$routeDatatable",
        vacancies: $jsonVacancies,
        permisions: {
            allowAdd: $allowAdd,
            allowEdit: $allowEdit,
            allowDelete: $allowDelete,
            allowEmail: $allowEmail
        }
        }       
JS;

$this->inlineScript()->appendScript($js);
$this->headLink()->appendStylesheet($this->basePath('/react-bundles/recruitment_and_selection/candidates/main.css'));
$this->inlineScript()->appendFile('/react-bundles/recruitment_and_selection/candidates/candidatesBundle.js');
?>

<div id="recruitment-candidates">
</div>

<!-- Content Header (Page header) -->
<section class="content-header">
    <div class="container-fluid">
        <div class="row mb-2">
            <div class="col-sm-12">
                <h1>LABEL_PRE_SELECTION</h1>
            </div>
        </div>
    </div><!-- /.container-fluid -->
</section>

<section class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <div class="card">
                    <div class="card-header">
                        <?php
                        // $form = $this->form;
                        $form->setAttributes([
                            'name' => 'form-filter',
                            'id' => 'form-filter',
                        ]);

                        $form->prepare();
                        echo $this->form()->openTag($form);
                        ?>
                        <div class="row">
                            <div class="col-md-6 col-sm-12">
                                <div class="form-group">
                                    <?php
                                    $element = $form->get('form_uuid');

                                    $element->setOptions(['label' => 'LABEL_VACANCIES']);

                                    $element->setAttributes(['class' => 'form-control']);
                                    echo $this->formLabel($element);
                                    echo $this->formSelect($element);
                                    ?>
                                </div>
                            </div>

                        </div>
                        <?php echo $this->form()->closeTag($form); ?>
                    </div>
                    <div class="card-body">
                        <table id="gridTable" class="table   table-hover">
                            <thead>
                            <tr>
                                <th>LABEL_FIRST_NAME</th>
                                <th>LABEL_LAST_NAME</th>
                                <th>LABEL_EMAIL</th>
                                <th>LABEL_STATUS</th>
                                <th>LABEL_ACTIONS</th>
                            </tr>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                    <div class="card-footer clearfix">
                        <div style="float:right;">
                            <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i>
                                LABEL_REFRESH
                            </button>
                            <?php if ($allowAdd) : ?>
                                <button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i>
                                    LABEL_ADD
                                </button>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

<!-- The Add Modal -->
<div class="modal" tabindex="-1" role="dialog" id="add-candidate-box">
    <div class="modal-dialog" role="document">
        <?php
        //$form = $this->formAdd;
        $form->setAttributes([
            'method' => 'post',
            'name' => 'form-add',
            'action' => $routeAdd,
            'email' => $routeEmail,
            'id' => 'form-add'
        ]);
        $form->prepare();
        echo $this->form()->openTag($form);

        $fields = ['user_id'];
        
        foreach($fields as $field) 
        {
            $element = $form->get($field);
            echo $this->formHidden($element);
        }

        ?>
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title">LABEL_NEW_CANDIDATE</h3>
            </div>
            <div class="modal-body">
                <div id="first-step" style="display: none;">    
                    <div class="form-group">
                        <?php
                        $element = $form->get('email');
                        $element->setOptions(['label' => 'LABEL_EMAIL']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        echo $this->formText($element);
                        ?>
                    </div>
                    <button id="check-email" type="button" class="btn btn-primary">LABEL_CHECK_EMAIL</button>
                    <div class="form-group">
                        <?php
                        $element = $form->get('first_name');
                        $element->setOptions(['label' => 'LABEL_FIRST_NAME']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        echo $this->formText($element);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $element = $form->get('last_name');
                        $element->setOptions(['label' => 'LABEL_LAST_NAME']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        echo $this->formText($element);
                        ?>
                    </div>
                    <div class="modal-footer">
                        <button id="btn-next" type="button" class="btn btn-primary">LABEL_NEXT</button>
                    </div>
                </div>
                <div id="second-step" style="display: none;">
                    <div class="form-group">
                       <?php 
                         $element = $form->get('coment');
                         $element->setAttributes(['class' => 'form-control']);    
                         $element->setOptions(['label' => 'LABEL_COMMENT']);                                       
                         echo $this->formLabel($element);
                         echo $this->formTextArea($element);
                        ?>
                    </div>
                      <div class="form-group">
                        <?php
                        $element = $form->get('evaluation');
                        $element->setAttributes(['class' => 'form-control']);
                        $element->setOptions(['label' => 'LABEL_EVALUATION']);
                        echo $this->formLabel($element);
                        echo $this->formSelect($element);
                        ?>
                    </div>
                    <div class="form-group">
                        <?php
                        $element = $form->get('file');
                        $element->setAttributes(['class' => 'form-control', 'accept' => 'pdf/docx']);
                        $element->setOptions(['label' => 'LABEL_CURRICULUM']);
                        echo $this->formLabel($element);
                        ?>
                        <div class="file-loading">
                            <?php echo $this->formFile($element); ?>
                        </div>
                    </div>
                    <div class="form-group">
                        <?php
                        $element = $form->get('status');
                        $element->setAttributes(['class' => 'form-control']);
                        $element->setOptions(['label' => 'LABEL_STATUS']);
                        echo $this->formLabel($element);
                        echo $this->formSelect($element);
                        ?>
                    </div>
                    <div class="modal-footer">
                        <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
                        <button type="button" class="btn btn-default btn-add-cancel">LABEL_CANCEL</button>
                    </div>
                </div>
            </div>
            
            <?php echo $this->form()->closeTag($form); ?>
        </div>
    </div>
</div>

<!-- The Edit Modal -->
<div class="modal" tabindex="-1" role="dialog" id="edit-candidate-box">
    <div class="modal-dialog" role="document">
        <?php
        $form->setAttributes([
            'method' => 'post',
            'name' => 'form-edit',
            'id' => 'form-edit'
        ]);
        $form->prepare();
        echo $this->form()->openTag($form);

        $fields = ['user_id'];
        
        foreach($fields as $field) 
        {
            $element = $form->get($field);
            echo $this->formHidden($element);
        }

        ?>
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title">LABEL_CANDIDATE</h3>
            </div>
            <div class="modal-body">
                <div class="form-group">
                    <?php
                    $element = $form->get('first_name');
                    $element->setOptions(['label' => 'LABEL_FIRST_NAME']);
                    $element->setAttributes(['class' => 'form-control']);
                    echo $this->formLabel($element);
                    echo $this->formText($element);
                    ?>
                </div>
                <div class="form-group">
                    <?php
                    $element = $form->get('last_name');
                    $element->setOptions(['label' => 'LABEL_LAST_NAME']);
                    $element->setAttributes(['class' => 'form-control']);
                    echo $this->formLabel($element);
                    echo $this->formText($element);
                    ?>
                </div>
                <div class="form-group">
                    <?php
                    $element = $form->get('email');
                    $element->setOptions(['label' => 'LABEL_EMAIL']);
                    $element->setAttributes(['class' => 'form-control']);
                    echo $this->formLabel($element);
                    echo $this->formText($element);
                    ?>
                </div>
                <div class="form-group">
                   <?php 
                     $element = $form->get('coment');
                     $element->setAttributes(['class' => 'form-control']);    
                     $element->setOptions(['label' => 'LABEL_COMMENT']);                                       
                     echo $this->formLabel($element);
                     echo $this->formTextArea($element);
                    ?>
                </div>
                  <div class="form-group">
                    <?php
                    $element = $form->get('evaluation');
                    $element->setAttributes(['class' => 'form-control']);
                    $element->setOptions(['label' => 'LABEL_EVALUATION']);
                    echo $this->formLabel($element);
                    echo $this->formSelect($element);
                    ?>
                </div>
                <div class="form-group">     
                    <?php
                    $element = $form->get('file');
                    $element->setAttributes(['class' => 'form-control', 'accept' => 'pdf/docx']);
                    $element->setOptions(['label' => 'LABEL_CURRICULUM']);
                    echo $this->formLabel($element);
                    ?>
                    <div class="file-loading">
                        <?php echo $this->formFile($element); ?>
                    </div>

                    <div class="mt-2" id="current-file">
                        <a href="" class="btn btn-primary" id="btn-cv"  target="_blank">CV actual</a>
                    </div>
                </div>

                <div class="form-group">
                    <?php
                    $element = $form->get('status');
                    $element->setAttributes(['class' => 'form-control']);
                    $element->setOptions(['label' => 'LABEL_STATUS']);
                    echo $this->formLabel($element);
                    echo $this->formSelect($element);
                    ?>
                </div>
            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
                <button type="button" class="btn btn-default btn-add-cancel">LABEL_CANCEL</button>
            </div>
            <?php echo $this->form()->closeTag($form); ?>
        </div>
    </div>
</div>