Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16944 | 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('jobs/add');

$routeDatatable   = $this->url('jobs');

$allowAdd = $acl->isAllowed($roleName, 'jobs/add') ? 1 : 0;
$allowDelete = $acl->isAllowed($roleName, 'jobs/delete') ? 1 : 0;
$allowEdit = $acl->isAllowed($roleName, 'jobs/edit') ? 1 : 0;
$allowUsersWhoApplied = $acl->isAllowed($roleName, 'jobs/users-who-applied') ? 1 : 0;



$this->inlineScript()->appendFile('https://maps.googleapis.com/maps/api/js?key=' . $google_map_key . '&libraries=places');

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

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


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

$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/piexif.js'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/sortable.js'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/fileinput.js'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/locales/es.js'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/fas/theme.js'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fas/theme.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.min.js'));


$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-input-number/input-number-format.jquery.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/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->headStyle()->captureStart();
echo <<<CSS


#gridTableUsersWhoApplied {
    display: flex;
    flex-flow: column;
    width: 100%;
}

#gridTableUsersWhoApplied thead {
    flex: 0 0 auto;
}

#gridTableUsersWhoApplied tbody {
    flex: 1 1 auto;
    display: block;
    overflow-y: auto;
    overflow-x: hidden;
}

#gridTableUsersWhoApplied tr {
    width: 100%;
    display: table;
    table-layout: fixed;
}
CSS;
$this->headStyle()->captureEnd();

$this->inlineScript()->captureStart();
echo <<<JS
jQuery( document ).ready(function( $ ) {
       var route_status = '';
       var route_title =  '';
       var route_extended =  '';
       var route_location =  '';
       var route_job_category =  '';
       var route_employment_type =  '';
       var route_salary =  '';
       var route_experience = '';
       var route_languages =  '';
       var route_degrees = '';
       var route_skills =  '';
       var route_last_date_of_application =  '';
                                


        var allowDelete = $allowDelete;
        var allowEdit = $allowEdit;
        var allowUsersWhoApplied = $allowUsersWhoApplied;
        
        var gridTable = $('#gridTable').dataTable( {
            'processing': true,
            'serverSide': true,
            'searching': true,
            'order': [[ 0, 'desc' ]],
            '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': 'last_date_of_application' },
                { 'mDataProp': 'title' }, 
                { 'mDataProp': 'details' },
                { 'mDataProp': 'actions' },
            ],
            'columnDefs': [

                {
                    'targets': -2,
                    'orderable': false,
                    'render' : function ( data, type, row ) {
                        var s = 'LABEL_STATUS : ' + row['details']['status'] + '<br>';
                        s = s + 'LABEL_EMPLOYMENT_TYPE : <br>' + row['details']['employment_type'] + '<br>';
                        s = s +  'LABEL_QTY_USERS_WHO_APPLIED : ' + row['details']['users_who_applied'] + '<br>';

                        return s;
                    }
                },

                {
                    '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" style="margin-top: 5px" data-href="' + data['link_edit']+ '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pen"></i> LABEL_EDIT </button><br>';
                        }
                        if(allowDelete && data['link_delete']  ) {
                            s = s + '<button class="btn btn-danger btn-sm btn-delete" style="margin-top: 5px" data-href="' + data['link_delete']+ '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button><br>';
                        }
                        if(allowUsersWhoApplied && data['link_users_who_applied']  ) {
                            s = s + '<button class="btn btn-primary btn-sm btn-users-who-applied" style="margin-top: 5px" data-href="' + data['link_users_who_applied']+ '" data-toggle="tooltip" title="LABEL_USERS_WHO_APPLIED"><i class="fa fa-users"></i> LABEL_USERS_WHO_APPLIED </button><br>';
                        }

                        return s;
                    }
                }
              ],
        });

    $.validator.addMethod('greaterThanFloat', function (value, element, param) {
        var otherElement = $(param);
        return parseFloat(value) > parseFloat(otherElement.val());
    }, 'ERROR_INVALID_MINIMUM');
    


    $.validator.addMethod('greaterThan', function (value, element, param) {
        var otherElement = $(param);
        return parseInt(value, 10) > parseInt(otherElement.val(), 10);
    }, 'ERROR_INVALID_MINIMUM');
    

    $.validator.addMethod('checkLocation', function (value, element, param) {
        var otherElement = $(param);

        return $.trim(otherElement.val()).length > 0;
    }, 'ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY');

    var autocompleteLocation = new google.maps.places.Autocomplete(
        (document.getElementById('location_search')),
        {types: ['(cities)']}
    );
    
    $.fn.fillInAddressLocation = function() {
    
        var place = autocompleteLocation.getPlace();
        if (!place.geometry) {
            $.fn.showError('ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY')
            return;
        } else {
            address1 = '';
            address2 = '';
            city1 = '';
            city2 = '';
            state = '';
            country = '';
            postal_code = '';
            
            formatted_address = place.formatted_address;
            latitude = place.geometry.location.lat();
            longitude = place.geometry.location.lng();
            var arrAddress = place.address_components;
            
            $.each(arrAddress, function(i, address_component) {
                if (address_component.types[0] == "route") {
                    address1 = address_component.long_name;
                }
                if (address_component.types[0] == "sublocality") {
                    address2 = address_component.long_name;
                }
                if (address_component.types[0] == "locality") {
                    city1 = address_component.long_name;
                }
                if (address_component.types[0] == "administrative_area_level_2") {
                    city2 = address_component.long_name;
                }
                if (address_component.types[0] == "administrative_area_level_1") {
                    state = address_component.long_name;
                }
                if (address_component.types[0] == "country") {
                    country = address_component.long_name;
                }
                if (address_component.types[0] == "postal_code") {
                    postal_code = address_component.long_name;
                }
            });
            
            $('#form-location #formatted_address').val(formatted_address);
            $('#form-location #address1').val(address1);
            $('#form-location #address2').val(address2);
            $('#form-location #city1').val(city1);
            $('#form-location #city2').val(city2);
            $('#form-location #state').val(state);
            $('#form-location #country').val(country);
            $('#form-location #postal_code').val(postal_code);
            $('#form-location #latitude').val(latitude);
            $('#form-location #longitude').val(longitude);
        }
    }


    var autocompleteLocationNew = new google.maps.places.Autocomplete(
        (document.getElementById('add_location_search')),
        {types: ['(cities)']}
    );

    $.fn.fillInAddressNewLocation = function() {


        var place = autocompleteLocationNew.getPlace();
        if (!place.geometry) {
            $.fn.showError('ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY')
            return;
        } else {
            address1 = '';
            address2 = '';
            city1 = '';
            city2 = '';
            state = '';
            country = '';
            postal_code = '';
    
            formatted_address = place.formatted_address;
            latitude = place.geometry.location.lat();
            longitude = place.geometry.location.lng();
            var arrAddress = place.address_components;
                
            $.each(arrAddress, function(i, address_component) {
                if (address_component.types[0] == "route") {
                    address1 = address_component.long_name;
                }
                if (address_component.types[0] == "sublocality") {
                    address2 = address_component.long_name;
                }
                if (address_component.types[0] == "locality") {
                    city1 = address_component.long_name;
                }
                if (address_component.types[0] == "administrative_area_level_2") {
                    city2 = address_component.long_name;
                }
                if (address_component.types[0] == "administrative_area_level_1") {
                    state = address_component.long_name;
                }
                if (address_component.types[0] == "country") {
                    country = address_component.long_name;
                }
                if (address_component.types[0] == "postal_code") {
                    postal_code = address_component.long_name;
                }
            });
    
            $('#form-add #formatted_address').val(formatted_address);
            $('#form-add #address1').val(address1);
            $('#form-add #address2').val(address2);
            $('#form-add #city1').val(city1);
            $('#form-add #city2').val(city2);
            $('#form-add #state').val(state);
            $('#form-add #country').val(country);
            $('#form-add #postal_code').val(postal_code);
            $('#form-add #latitude').val(latitude);
            $('#form-add #longitude').val(longitude);
        }
    }


    var validatorAdd = $('#form-add').validate({
        debug: true,
        onclick: false,
        onkeyup: false,
        onfocusout: false,
        ignore: [],
        rules: {
            'name': {
                required: true,
                maxlength: 128,
            },
            'title': {
                required: true,
            },
            'last_date_of_application': {
                required: true,
            },
            'job_category_id' :  {
                required: true,
            },
            'employment_type' : {
                required: true,
            },
            'add_location_search': {
                required: true,
                checkLocation: '#form-add #latitude'
            }
        },
        submitHandler: function(form)
        {
            NProgress.start();
            $.ajax({
                'dataType'  : 'json',
                'accept'    : 'application/json',
                'method'    : 'post',
                'url'       :  '$routeAdd',
                'data'      :  $('#form-add').serialize(),
            }).done(function(response) {
                if(response['success']) {
                    $('#add-job-box').modal('hide');
                    gridTable.api().ajax.reload(null, false);

                    $('#overview-title').html(response['data']['title']);
                    $('#overview-job-category').html(response['data']['job_category']);
                                        $('#overview-last-date-of-application').html(response['data']['last_date_of_application']);
                                        $('#overview-employment-type').html(response['data']['employment_type']);
                    $('#overview-location').html(response['data']['location']);

                    $('#overview-status').html(response['data']['status']);
                    $('#overview-description').html(response['data']['description']);                                   
                    
                    $('#overview-salary').html(response['data']['salary']);
                    $('#overview-experience').html('')





                    $('list-skills').empty();
                    $('list-languages').empty();
                    $('list-degrees').empty();


                    route_status = response['data']['route_status'];
                    route_title =  response['data']['route_title'];
                    route_extended =  response['data']['route_extended'];
                    route_location =  response['data']['route_location'];
                    route_job_category =  response['data']['route_job_category'];
                    route_employment_type =  response['data']['route_employment_type'];
                    route_salary =  response['data']['route_salary'];
                    route_experience = response['data']['route_experience'];
                    route_languages =  response['data']['route_languages'];
                    route_degrees = response['data']['route_degrees'];
                    route_skills =  response['data']['route_skills'];
                    route_last_date_of_application =  response['data']['route_last_date_of_application'];
                    
                    $('#divListing').hide();
                    $('#divEdit').show();

                } 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) {
            
        }
    });

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

        var href = $(this).data('href');

        NProgress.start();
            $.ajax({
                'dataType'  : 'json',
                'accept'    : 'application/json',
                'method'    : 'get',
                'url'       :  href,
            }).done(function(response) {
                if(response['success']) {
                    $('#add-job-box').modal('hide');
                    gridTable.api().ajax.reload(null, false);

                    $('#overview-title').html(response['data']['title']);
                    $('#overview-job-category').html(response['data']['job_category']);
                                        $('#overview-last-date-of-application').html(response['data']['last_date_of_application']);
                                        $('#overview-employment-type').html(response['data']['employment_type']);
                    $('#overview-location').html(response['data']['location']);

                    $('#overview-status').html(response['data']['status']);
                    $('#overview-description').html(response['data']['description']);                                   

                    
                    if(response['data']['salary']) {
                                           $('#overview-salary').html(response['data']['salary']);
                    } else {
                       $('#overview-salary').html('')
                    } 

                    if(response['data']['experience']) {
                                           $('#overview-experience').html(response['data']['experience'] + ' LABEL_YEARS');
                    } else {
                       $('#overview-experience').html('')
                    } 



                    $('#list-skills').empty();
                    $.each(response['data']['skills'], function(i, name) {
                        $('#list-skills').append('<li>' + name + '</li>');
                    });

                    $('#list-languages').empty();
                    $.each(response['data']['languages'], function(i, name) {
                        $('#list-languages').append('<li>' + name + '</li>');
                    });

                    $('#list-degrees').empty();
                    $.each(response['data']['degrees'], function(i, name) {
                        $('#list-degrees').append('<li>' + name + '</li>');
                    });


                    route_status =  response['data']['route_status'];
                    route_title =   response['data']['route_title'];
                    route_extended =   response['data']['route_extended'];
                    route_location =   response['data']['route_location'];
                    route_job_category =   response['data']['route_job_category'];
                    route_employment_type =   response['data']['route_employment_type'];
                    route_salary =   response['data']['route_salary'];
                    route_experience =  response['data']['route_experience'];
                    route_languages =   response['data']['route_languages'];
                    route_degrees =  response['data']['route_degrees'];
                    route_skills =   response['data']['route_skills'];
                    route_last_date_of_application =   response['data']['route_last_date_of_application'];
                    

                    $('#divListing').hide();
                    $('#divEdit').show();

                } 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;
    });



    $(".close-box, .btn-add-job-cancel, .btn-users-who-applied-cancel").on("click", function(e){
        e.preventDefault();
        $('#add-job-box').modal('hide');
        $('#modalUsersWhoApplied').modal('hide');
        return false;
    });



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


        $('#form-add #title').val('');
        $('#form-add #last_date_of_application').val('');
        $('#form-add #employment_type').val('').trigger('change');
        $('#form-add #job_category_id').val('').trigger('change');
        $('#form-add #formatted_address').val('');
        $('#form-add #address1').val('');
        $('#form-add #address2').val('');
        $('#form-add #country').val('');
        $('#form-add #state').val('');
        $('#form-add #city1').val('');
        $('#form-add #city2').val('');
        $('#form-add #postal_code').val('');
        $('#form-add #latitude').val('');
        $('#form-add #longitude').val('');
        $('#form-add #add_location_search').val('');
        validatorAdd.resetForm();

        $('#add-job-box').modal('show');
        return false;
    });

    $('#form-add #last_date_of_application').datetimepicker({
        //viewMode: 'years',
        locale: 'es',
        format: 'YYYY-MM-DD'
    });


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

        var href = $(this).data('href');
        window.open(href, '_blank');

    });

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

        var href = $(this).data('href');
        NProgress.start();
        $.ajax({
            'dataType'  : 'json',
            'accept'    : 'application/json',
            'method'    : 'get',
            'url'       :  href
        }).done(function(response) {
            if(response['success']) {
                $('#gridTableUsersWhoApplied tbody').empty();
                $.each(response['data'], function(i, record) {
                    var s = '<tr>';
                    s = s + '<td>' + record['first_name'] + '</td>';
                    s = s + '<td>' + record['last_name'] + '</td>';
                    s = s + '<td>' + record['email'] + '</td>';
                    s = s + '<td><button class="btn btn-default btn-view-profile" data-href="' + record['link_view']+ '"><i class="fa fa-external-link-alt"></i></button></td>';
                    s = s + '<tr>'; 

                    $('#gridTableUsersWhoApplied tbody').append(s);               

                });

                
                $('#modalUsersWhoApplied').modal('show');
            } else {
                $.fn.showError(response['data']);

            }
        }).fail(function( jqXHR, textStatus, errorThrown) {
            $.fn.showError(textStatus);
        }).always(function() {
            NProgress.done();
        });
        return false;

    });

 var validatorLocation = $('#form-location').validate({
        debug: true,
        onclick: false,
        onkeyup: false,
        onfocusout: false,
        ignore: [],
        rules: {
            'location_search': {
                required: true,
                checkLocation: '#form-location #latitude'
            }
        },
        submitHandler: function(form)
        {
            NProgress.start();
            $.ajax({
                'dataType'  : 'json',
                'accept'    : 'application/json',
                'method'    : 'post',
                'url'       :  route_location,
                'data'      :  $('#form-location').serialize(),
            }).done(function(response) {



                if(response['success']) {
                    $('#overview-location').html(response.data);
                    $("#location-box").modal('hide');
                } else {
                    validatorLocation.resetForm();
                    $.fn.showError(response['data']);
                }
            }).fail(function( jqXHR, textStatus, errorThrown) {
                $.fn.showError(textStatus);
            }).always(function() {
                NProgress.done();
            });
            return false;
        },
        invalidHandler: function(form, validator) {
        
        }
    });

    
    $('body').on('click', 'a.btn-location-edit', function(e) {
        e.preventDefault();
        
        $('#form-location #location_search').val('');
        $('#form-location #formatted_address').val('');
        $('#form-location #address1').val('');
        $('#form-location #address2').val('');
        $('#form-location #country').val('');
        $('#form-location #state').val('');
        $('#form-location #city1').val('');
        $('#form-location #city2').val('');
        $('#form-location #postal_code').val('');
        $('#form-location #latitude').val('');
        $('#form-location #longitude').val('');
        validatorLocation.resetForm();
        
        $("#location-box").modal('show');
    });
    
    $('.btn-location-close').on("click", function(e){
        e.preventDefault();
        
        $("#location-box").modal('hide');
        return false;
    });
    

    

    var validatorLastDateOfApplication = $('#form-last-date-of-application').validate({
        debug: true,
        onclick: false,
        onkeyup: false,
        onfocusout: false,
        ignore: [],
        rules: {
            'last_date_of_application': {
                required: true,
            },
        },
        
        submitHandler: function(form)
        {
            NProgress.start();
            $.ajax({
                'dataType'  : 'json',
                'accept'    : 'application/json',
                'method'    : 'post',
                'url'       :  route_last_date_of_application,
                'data'      :  $('#form-last-date-of-application').serialize()
            }).done(function(response) {
                if(response['success']) {
                
                    $('#overview-last-date-of-application').html(response['data']);
                    $("#last-date-of-application-box").modal('hide');
                } else {
                    validatorLastDateOfApplication.resetForm();
                    if(jQuery.type(response['data']) == 'string') {
                        $.fn.showError(response['data']);
                    } else  {
                        $.each(response['data'], function( fieldname, errors ) {
                            $.fn.showFormErrorValidator('#form-last-date-of-application #' + fieldname, errors);
                        });
                    }
                }
            }).fail(function( jqXHR, textStatus, errorThrown) {
                $.fn.showError(textStatus);
            }).always(function() {
                NProgress.done();
            });
            return false;
        },
        invalidHandler: function(form, validator) {
        
        }
    });
    
    
    $('.btn-last-date-of-application-edit').on("click", function(e){
        e.preventDefault();
        
        NProgress.start();
        $.ajax({
            'dataType'  : 'json',
            'accept'    : 'application/json',
            'method'    : 'get',
            'url'       : route_last_date_of_application,
        }).done(function(response) {
           if(response['success']) {
                $('#form-last-date-of-application #last_date_of_application').val(response['data']);
                validatorLastDateOfApplication.resetForm();
                
                $("#last-date-of-application-box").modal('show');
            } else {
                $.fn.showError(response['data']);
            }
        }).fail(function( jqXHR, textStatus, errorThrown) {
            $.fn.showError(textStatus);
        }).always(function() {
            NProgress.done();
        });
        return false;
        
    });
    
    $('.btn-last-date-of-application-close').on("click", function(e){
        e.preventDefault();
        
        $("#last-date-of-application-box").modal('hide');
        return false;
    });
    
    
    var validatorExtended = $('#form-extended').validate({
        debug: true,
        onclick: false,
        onkeyup: false,
        onfocusout: false,
        ignore: [],
        rules: {
            'description': {
                updateCkeditor:function() {
                        CKEDITOR.instances.description.updateElement();
                },
                required: false,
            },
        },
        
        submitHandler: function(form)
        {
            NProgress.start();
            $.ajax({
                'dataType'  : 'json',
                'accept'    : 'application/json',
                'method'    : 'post',
                'url'       :  route_extended,
                'data'      :  $('#form-extended').serialize()
            }).done(function(response) {
                if(response['success']) {
                
                    $('#overview-description').html(response['data']['description']);
                    $("#extended-box").modal('hide');
                } else {
                    validatorExtended.resetForm();
                    if(jQuery.type(response['data']) == 'string') {
                        $.fn.showError(response['data']);
                    } else  {
                        $.each(response['data'], function( fieldname, errors ) {
                            $.fn.showFormErrorValidator('#form-extended #' + fieldname, errors);
                        });
                    }
                }
            }).fail(function( jqXHR, textStatus, errorThrown) {
                $.fn.showError(textStatus);
            }).always(function() {
                NProgress.done();
            });
            return false;
        },
        invalidHandler: function(form, validator) {
        
        }
    });
    
    
    $('.btn-extended-edit').on("click", function(e){
        e.preventDefault();
        
        NProgress.start();
        $.ajax({
            'dataType'  : 'json',
            'accept'    : 'application/json',
            'method'    : 'get',
            'url'       : route_extended,
        }).done(function(response) {
           if(response['success']) {
                CKEDITOR.instances.description.setData(response['data']['description']);
                validatorExtended.resetForm();
                
                $("#extended-box").modal('show');
            } else {
                $.fn.showError(response['data']);
            }
        }).fail(function( jqXHR, textStatus, errorThrown) {
            $.fn.showError(textStatus);
        }).always(function() {
            NProgress.done();
        });
        return false;
        
    });
    
    $('.btn-extended-close').on("click", function(e){
        e.preventDefault();
        
        $("#extended-box").modal('hide');
        return false;
    });
    

    var validatorJobCategory = $('#form-job-category').validate({
        debug: true,
        onclick: false,
        onkeyup: false,
        ignore: [],
        rules: {
            'job-category_id': {
                required: false,
                digits: true
            },
        },
        submitHandler: function(form)
        {
            NProgress.start();
            $.ajax({
                'dataType'  : 'json',
                'accept'    : 'application/json',
                'method'    : 'post',
                'url'       :  route_job_category,
                'data'      :  $('#form-job-category').serialize()
            }).done(function(response) {
                if(response['success']) {
                                        $('#overview-job-category').html(response['data']);
                    $("#job-category-box").modal('hide');
                } else {
                    validatorJobCategory.resetForm();
                    if(jQuery.type(response['data']) == 'string') {
                        $.fn.showError(response['data']);
                    } else  {
                        $.each(response['data'], function( fieldname, errors ) {
                            $.fn.showFormErrorValidator('#form-job-category #' + fieldname, errors);
                        });
                    }
                }
            }).fail(function( jqXHR, textStatus, errorThrown) {
                $.fn.showError(textStatus);
            }).always(function() {
                NProgress.done();
            });
            return false;
        },
        invalidHandler: function(form, validator) {
        
        }
    });
    
    $('.btn-job-category-edit').on("click", function(e){
        e.preventDefault();
        
        NProgress.start();
        $.ajax({
            'dataType'  : 'json',
            'accept'    : 'application/json',
            'method'    : 'get',
            'url'       : route_job_category,
        }).done(function(response) {
           if(response['success']) {
                $('#form-job-category #job_category_id').val(response['data']['job_category']).trigger('change');
                validatorJobCategory.resetForm();
                $("#job-category-box").modal('show');
            } else {
                $.fn.showError(response['data']);
            }
        }).fail(function( jqXHR, textStatus, errorThrown) {
            $.fn.showError(textStatus);
        }).always(function() {
            NProgress.done();
        });
        return false;
        
    });
    
    $('.btn-job-category-close').on("click", function(e){
        e.preventDefault();
        
        $("#job-category-box").modal('hide');
        return false;
    });
    


    var validatorEmploymentType = $('#form-employment-type').validate({
        debug: true,
        onclick: false,
        onkeyup: false,
        ignore: [],
        rules: {
            'employment_type': {
                required: false,
            },
        },
        submitHandler: function(form)
        {
            NProgress.start();
            $.ajax({
                'dataType'  : 'json',
                'accept'    : 'application/json',
                'method'    : 'post',
                'url'       :  route_employment_type,
                'data'      :  $('#form-employment-type').serialize()
            }).done(function(response) {
                if(response['success']) {
                                        $('#overview-employment-type').html(response['data']);
                    $("#employment-type-box").modal('hide');
                } else {
                    validatorEmploymentType.resetForm();
                    if(jQuery.type(response['data']) == 'string') {
                        $.fn.showError(response['data']);
                    } else  {
                        $.each(response['data'], function( fieldname, errors ) {
                            $.fn.showFormErrorValidator('#form-employment-type #' + fieldname, errors);
                        });
                    }
                }
            }).fail(function( jqXHR, textStatus, errorThrown) {
                $.fn.showError(textStatus);
            }).always(function() {
                NProgress.done();
            });
            return false;
        },
        invalidHandler: function(form, validator) {
        
        }
    });
    
    $('.btn-employment-type-edit').on("click", function(e){
        e.preventDefault();
        
        NProgress.start();
        $.ajax({
            'dataType'  : 'json',
            'accept'    : 'application/json',
            'method'    : 'get',
            'url'       : route_employment_type,
        }).done(function(response) {
           if(response['success']) {
                $('#form-employment-type #employment_type').val(response['data']).trigger('change');
                validatorEmploymentType.resetForm();
                $("#employment-type-box").modal('show');
            } else {
                $.fn.showError(response['data']);
            }
        }).fail(function( jqXHR, textStatus, errorThrown) {
            $.fn.showError(textStatus);
        }).always(function() {
            NProgress.done();
        });
        return false;
        
    });
    
    $('.btn-employment-type-close').on("click", function(e){
        e.preventDefault();
        
        $("#employment-type-box").modal('hide');
        return false;
    });

    var validatorSalary = $('#form-salary').validate({
        debug: true,
        onclick: false,
        onkeyup: false,
        ignore: [],
        rules: {
            'salary_visible': {
                required: false,
            },
            'salary_min': {
                required:  '#form-salary #salary_visible:checked',
                number: true,
                maxlength: 10,
            },
            'salary currency': {
                required:  '#form-salary #salary_visible:checked',
                maxlength: 5,
            },
            'salary_max': {
                required:  '#form-salary #salary_visible:checked',
                number: true,
                maxlength: 10,
                greaterThanFloat : '#form-salary #salary_min',
            },
        },
        submitHandler: function(form)
        {
            NProgress.start();
            $.ajax({
                'dataType'  : 'json',
                'accept'    : 'application/json',
                'method'    : 'post',
                'url'       :  route_salary,
                'data'      :  $('#form-salary').serialize()
            }).done(function(response) {
                if(response['success']) {
                                        $('#overview-salary').html(response['data']);
                    $("#salary-box").modal('hide');
                } else {
                    validatorSalary.resetForm();
                    if(jQuery.type(response['data']) == 'string') {
                        $.fn.showError(response['data']);
                    } else  {
                        $.each(response['data'], function( fieldname, errors ) {
                            $.fn.showFormErrorValidator('#form-salary #' + fieldname, errors);
                        });
                    }
                }
            }).fail(function( jqXHR, textStatus, errorThrown) {
                $.fn.showError(textStatus);
            }).always(function() {
                NProgress.done();
            });
            return false;
        },
        invalidHandler: function(form, validator) {
        
        }
    });
    
    $('.btn-salary-edit').on("click", function(e){
        e.preventDefault();
        
        NProgress.start();
        $.ajax({
            'dataType'  : 'json',
            'accept'    : 'application/json',
            'method'    : 'get',
            'url'       : route_salary,
        }).done(function(response) {
           if(response['success']) {
                if(response['data']['salary_visible'] == 'y') {
                    $('#form-salary #salary_visible').bootstrapToggle('on')
                    $('#form-salary #salary_min').val(response['data']['salary_min']);
                    $('#form-salary #salary_min').prop('readonly', false);
                    $('#form-salary #salary_max').val(response['data']['salary_max']);
                    $('#form-salary #salary_max').prop('readonly', false);
                    $('#form-salary #salary_currency').val(response['data']['salary_currency']);
                    $('#form-salary #salary_currency').prop('disable',false);      
                } else {
                    $('#form-salary #salary_visible').bootstrapToggle('off')
                    $('#form-salary #salary_min').val('1');
                    $('#form-salary #salary_min').prop('readonly', true);
                    $('#form-salary #salary_max').val('99');
                    $('#form-salary #salary_max').prop('readonly', true);
                    $('#form-salary #salary_currency').val('USD');
                    $('#form-salary #salary_currency').prop('disable',true);    
                }
                validatorSalary.resetForm();
                $("#salary-box").modal('show');
            } else {
                $.fn.showError(response['data']);
            }
        }).fail(function( jqXHR, textStatus, errorThrown) {
            $.fn.showError(textStatus);
        }).always(function() {
            NProgress.done();
        });
        return false;
        
    });
    
    $('.btn-salary-close').on("click", function(e){
        e.preventDefault();
        
        $("#salary-box").modal('hide');
        return false;
    });

    var validatorExperience = $('#form-experience').validate({
        debug: true,
        onclick: false,
        onkeyup: false,
        ignore: [],
        rules: {
            'experience_visible': {
                required: false,
            },
            'experience_min': {
                required:  '#form-experience #experience_visible:checked',
                digits: true,
                maxlength: 2,
            },
            'experience_max': {
                required:  '#form-experience #experience_visible:checked',
                digits: true,
                maxlength: 4,
                greaterThan : '#form-experience #experience_min',
            },
        },
        submitHandler: function(form)
        {
            NProgress.start();
            $.ajax({
                'dataType'  : 'json',
                'accept'    : 'application/json',
                'method'    : 'post',
                'url'       :  route_experience,
                'data'      :  $('#form-experience').serialize()
            }).done(function(response) {
                if(response['success']) {
                                        $('#overview-experience').html(response['data']);
                    $("#experience-box").modal('hide');
                } else {
                    validatorExperience.resetForm();
                    if(jQuery.type(response['data']) == 'string') {
                        $.fn.showError(response['data']);
                    } else  {
                        $.each(response['data'], function( fieldname, errors ) {
                            $.fn.showFormErrorValidator('#form-experience #' + fieldname, errors);
                        });
                    }
                }
            }).fail(function( jqXHR, textStatus, errorThrown) {
                $.fn.showError(textStatus);
            }).always(function() {
                NProgress.done();
            });
            return false;
        },
        invalidHandler: function(form, validator) {
        
        }
    });
    
    $('.btn-experience-edit').on("click", function(e){
        e.preventDefault();
        
        NProgress.start();
        $.ajax({
            'dataType'  : 'json',
            'accept'    : 'application/json',
            'method'    : 'get',
            'url'       : route_experience,
        }).done(function(response) {
           if(response['success']) {
                if(response['data']['experience_visible'] == 'y') {
                    $('#form-experience #experience_visible').bootstrapToggle('on')
                    $('#form-experience #experience_min').val(response['data']['experience_min']);
                    $('#form-experience #experience_min').prop('readonly', false);
                    $('#form-experience #experience_max').val(response['data']['experience_max']);
                    $('#form-experience #experience_max').prop('readonly', false);
                } else {
                    $('#form-experience #experience_visible').bootstrapToggle('off')
                    $('#form-experience #experience_min').val('1');
                    $('#form-experience #experience_min').prop('readonly', true);
                    $('#form-experience #experience_max').val('5');
                    $('#form-experience #experience_max').prop('readonly', true);
                }

                validatorExperience.resetForm();
                $("#experience-box").modal('show');
            } else {
                $.fn.showError(response['data']);
            }
        }).fail(function( jqXHR, textStatus, errorThrown) {
            $.fn.showError(textStatus);
        }).always(function() {
            NProgress.done();
        });
        return false;
        
    });
    
    $('.btn-experience-close').on("click", function(e){
        e.preventDefault();
        
        $("#experience-box").modal('hide');
        return false;
    });


    $('.btn-skills-edit').on("click", function(e){
        e.preventDefault();

        NProgress.start();
        $.ajax({
            'dataType'  : 'json',
            'accept'    : 'application/json',
            'method'    : 'get',
            'url'       : route_skills,
        }).done(function(response) {
           if(response['success']) {

                $('#form-skill #skills').val(response['data']['skills_selected']).trigger('change');
                validatorSkills.resetForm();
                
                $('#skills-box').modal('show');
            } else {
                $.fn.showError(response['data']);
            }
        }).fail(function( jqXHR, textStatus, errorThrown) {
            $.fn.showError(textStatus);
        }).always(function() {
            NProgress.done();
        });
        return false;

    });
    
    $('.btn-skills-close').on("click", function(e){
        e.preventDefault();
            
        $('#skills-box').modal('hide');
        return false;
    });
    
    var validatorSkills = $('#form-skill').validate({
        debug: true,
        onclick: false,
        onkeyup: false,
         onfocusout: false,
        ignore: [],
        rules: {
            'skills[]': {
                required: true,
            }
        },
        submitHandler: function(form)
        {
            NProgress.start();
            $.ajax({
                'dataType'  : 'json',
                'accept'    : 'application/json',
                'method'    : 'post',
                'url'       :  route_skills,
                'data'      :  {
                    'skills[]' : $('#form-skill #skills').val()
                },
            }).done(function(response) {
                if(response['success']) {

                                        $('#list-skills').empty();
                    $.each(response['data'], function(index, item) {
                        $('#list-skills').append('<li><a href="#" title="">' + item.label + '</a></li>');
                    });                     
                                                        
                    $("#skills-box").modal('hide');
                } else {
                    validatorSkills.resetForm();
                    if(jQuery.type(response['data']) == 'string') {
                        $.fn.showError(response['data']);
                    } else  {
                        $.each(response['data'], function( fieldname, errors ) {
                            $.fn.showFormErrorValidator('#form-skill #' + fieldname, errors);
                        });
                    }
                }
            }).fail(function( jqXHR, textStatus, errorThrown) {
                $.fn.showError(textStatus);
            }).always(function() {
                NProgress.done();
            });
            return false;
        },
        invalidHandler: function(form, validator) {
        
        }
    });
    

    
    var validatorLanguages = $('#form-language').validate({
        debug: true,
        onclick: false,
        onkeyup: false,
         onfocusout: false,
        ignore: [],
        rules: {
            'languages[]': {
                required: true,
            }
        },
        submitHandler: function(form)
        {
            NProgress.start();
            $.ajax({
                'dataType'  : 'json',
                'accept'    : 'application/json',
                'method'    : 'post',
                'url'       :  route_languages,
                'data'      :  {
                    'languages[]' : $('#form-language #languages').val()
                },
            }).done(function(response) {
                if(response['success']) {

                                        $('#list-languages').empty();
                    $.each(response['data'], function(index, item) {
                        $('#list-languages').append('<li><a href="#" title="">' + item.label + '</a></li>');
                    });                     
                                                        
                    $("#languages-box").modal('hide');
                } else {
                    validatorLanguages.resetForm();
                    if(jQuery.type(response['data']) == 'string') {
                        $.fn.showError(response['data']);
                    } else  {
                        $.each(response['data'], function( fieldname, errors ) {
                            $.fn.showFormErrorValidator('#form-language #' + fieldname, errors);
                        });
                    }
                }
            }).fail(function( jqXHR, textStatus, errorThrown) {
                $.fn.showError(textStatus);
            }).always(function() {
                NProgress.done();
            });
            return false;
        },
        invalidHandler: function(form, validator) {
        
        }
    });

    $('.btn-languages-edit').on("click", function(e){
        e.preventDefault();

        NProgress.start();
        $.ajax({
            'dataType'  : 'json',
            'accept'    : 'application/json',
            'method'    : 'get',
            'url'       : route_languages,
        }).done(function(response) {
           if(response['success']) {
                $('#form-language #languages').val(response['data']['languages_selected']).trigger('change');
                validatorLanguages.resetForm();

                $("#languages-box").modal('show');
            } else {
                $.fn.showError(response['data']);
            }
        }).fail(function( jqXHR, textStatus, errorThrown) {
            $.fn.showError(textStatus);
        }).always(function() {
            NProgress.done();
        });
        return false;

    });
    
    $('.btn-languages-close').on("click", function(e){
        e.preventDefault();
        
        $("#languages-box").modal('hide');
        return false;
    });


    var validatorDegrees = $('#form-degree').validate({
        debug: true,
        onclick: false,
        onkeyup: false,
         onfocusout: false,
        ignore: [],
        rules: {
            'degrees[]': {
                required: true,
            }
        },
        submitHandler: function(form)
        {
            NProgress.start();
            $.ajax({
                'dataType'  : 'json',
                'accept'    : 'application/json',
                'method'    : 'post',
                'url'       :  route_degrees,
                'data'      :  {
                    'degrees[]' : $('#form-degree #degrees').val()
                },
            }).done(function(response) {
                if(response['success']) {

                                        $('#list-degrees').empty();
                    $.each(response['data'], function(index, item) {
                        $('#list-degrees').append('<li><a href="#" title="">' + item.label + '</a></li>');
                    });                     
                                                        
                    $("#degrees-box").modal('hide');
                } else {
                    validatorDegrees.resetForm();
                    if(jQuery.type(response['data']) == 'string') {
                        $.fn.showError(response['data']);
                    } else  {
                        $.each(response['data'], function( fieldname, errors ) {
                            $.fn.showFormErrorValidator('#form-degree #' + fieldname, errors);
                        });
                    }
                }
            }).fail(function( jqXHR, textStatus, errorThrown) {
                $.fn.showError(textStatus);
            }).always(function() {
                NProgress.done();
            });
            return false;
        },
        invalidHandler: function(form, validator) {
        
        }
    });

    $('.btn-degrees-edit').on("click", function(e){
        e.preventDefault();

        NProgress.start();
        $.ajax({
            'dataType'  : 'json',
            'accept'    : 'application/json',
            'method'    : 'get',
            'url'       : route_degrees,
        }).done(function(response) {
           if(response['success']) {
                $('#form-degree #degrees').val(response['data']['degrees_selected']).trigger('change');
                validatorDegrees.resetForm();

                $("#degrees-box").modal('show');
            } else {
                $.fn.showError(response['data']);
            }
        }).fail(function( jqXHR, textStatus, errorThrown) {
            $.fn.showError(textStatus);
        }).always(function() {
            NProgress.done();
        });
        return false;

    });
    
    $('.btn-degrees-close').on("click", function(e){
        e.preventDefault();
        
        $("#degrees-box").modal('hide');
        return false;
    });


    $('#form-degree #degrees').select2({ 
        theme: 'bootstrap-5',
        width: '100%',
        placeholder: 'LABEL_SELECT_DEGREE',
        dropdownParent: $('#degrees-box')
    });

    $('#form-skill #skills').select2({ 
        theme: 'bootstrap-5',
        width: '100%', 
        placeholder: 'LABEL_SELECT_ONE_SKILLS'
    });

    $('#form-language #languages').select2({ 
        theme: 'bootstrap-5',
        width: '100%', 
        placeholder: 'LABEL_SELECT_ONE_LANGUAGE',
        dropdownParent: $('#languages-box'),
    });


    
    $('#form-last-date-of-application #last_date_of_application').datetimepicker({
        locale: 'es',
        format: 'YYYY-MM-DD'
    });

    $('#form-salary #salary_visible').bootstrapToggle({'on' : 'LABEL_SHOW',  'off' : 'LABEL_NO_SHOW', 'width' : '160px', 'height' : '40px'});
    $('#form-salary #salary_min').inputNumberFormat({ 'decimal': 2 });
    $('#form-salary #salary_max').inputNumberFormat({ 'decimal': 2 });

    $('#form-salary #salary_visible').change(function(e) {
        e.preventDefault();

        if($(this).prop('checked')) {
            $('#form-salary #salary_min').prop('readonly', false);
            $('#form-salary #salary_max').prop('readonly', false);
            $('#form-salary #salary_currency').prop('disabled', false);
        } else {
            $('#form-salary #salary_min').val('1');
            $('#form-salary #salary_max').val('99');
            $('#form-salary #salary_min').prop('readonly', true);
            $('#form-salary #salary_max').prop('readonly', true);
            $('#form-salary #salary_currency').prop('disabled', true);
        }
    });

    $('#form-experience #experience_visible').bootstrapToggle({'on' : 'LABEL_SHOW',  'off' : 'LABEL_NO_SHOW', 'width' : '160px', 'height' : '40px'});
    $('#form-experience #experience_min').inputNumberFormat({ 'decimal': 0 });
    $('#form-experience #experience_max').inputNumberFormat({ 'decimal': 0 });

    $('#form-experience #experience_visible').change(function(e) {
        e.preventDefault();

        if($(this).prop('checked')) {
            $('#form-experience #experience_min').prop('readonly', false);
            $('#form-experience #experience_max').prop('readonly', false);
        } else {
            $('#form-experience #experience_min').val('1');
            $('#form-experience #experience_max').val('5');
            $('#form-experience #experience_min').prop('readonly', true);
            $('#form-experience #experience_max').prop('readonly', true);
       }
    });


    var validatorStatus = $('#form-status').validate({
        debug: true,
        onclick: false,
        onkeyup: false,
        ignore: [],
        rules: {
            'status': {
                required: false,
            },
        },
        submitHandler: function(form)
        {
            NProgress.start();
            $.ajax({
                'dataType'  : 'json',
                'accept'    : 'application/json',
                'method'    : 'post',
                'url'       :  route_status,
                'data'      :  $('#form-status').serialize()
            }).done(function(response) {
                if(response['success']) {
                                        $('#overview-status').html(response['data']['status']);
                    $("#status-box").modal('hide');
                } else {
                    validatorStatus.resetForm();
                    if(jQuery.type(response['data']) == 'string') {
                        $.fn.showError(response['data']);
                    } else  {
                        $.each(response['data'], function( fieldname, errors ) {
                            $.fn.showFormErrorValidator('#form-status #' + fieldname, errors);
                        });
                    }
                }
            }).fail(function( jqXHR, textStatus, errorThrown) {
                $.fn.showError(textStatus);
            }).always(function() {
                NProgress.done();
            });
            return false;
        },
        invalidHandler: function(form, validator) {
        
        }
    });
    
    $('.btn-status-edit').on("click", function(e){
        e.preventDefault();
        
        NProgress.start();
        $.ajax({
            'dataType'  : 'json',
            'accept'    : 'application/json',
            'method'    : 'get',
            'url'       : route_status,
        }).done(function(response) {
           if(response['success']) {
                $('#form-status #status').val(response['data']['status']);
                validatorStatus.resetForm();
                $("#status-box").modal('show');
            } else {
                $.fn.showError(response['data']);
            }
        }).fail(function( jqXHR, textStatus, errorThrown) {
            $.fn.showError(textStatus);
        }).always(function() {
            NProgress.done();
        });
        return false;
        
    });
    
    $('.btn-status-close').on("click", function(e){
        e.preventDefault();
        
        $("#status-box").modal('hide');
        return false;
    });
    

    var validatorTitle = $('#form-title').validate({
        debug: true,
        onclick: false,
        onkeyup: false,
        ignore: [],
        rules: {
            'title': {
                required: true,
                maxlength: 128,
            },
        },
        submitHandler: function(form)
        {
            NProgress.start();
            $.ajax({
                'dataType'  : 'json',
                'accept'    : 'application/json',
                'method'    : 'post',
                'url'       :  route_title,
                'data'      :  $('#form-title').serialize()
            }).done(function(response) {
                if(response['success']) {
                                        $('#overview-title').html(response['data']['title']);
                    $("#title-box").modal('hide');
                } else {
                    validatorTitle.resetForm();
                    if(jQuery.type(response['data']) == 'string') {
                        $.fn.showError(response['data']);
                    } else  {
                        $.each(response['data'], function( fieldname, errors ) {
                            $.fn.showFormErrorValidator('#form-title #' + fieldname, errors);
                        });
                    }
                }
            }).fail(function( jqXHR, textTitle, errorThrown) {
                $.fn.showError(textTitle);
            }).always(function() {
                NProgress.done();
            });
            return false;
        },
        invalidHandler: function(form, validator) {
        
        }
    });
    
    $('.btn-title-edit').on("click", function(e){
        e.preventDefault();
        
        NProgress.start();
        $.ajax({
            'dataType'  : 'json',
            'accept'    : 'application/json',
            'method'    : 'get',
            'url'       : route_title,
        }).done(function(response) {
           if(response['success']) {
                $('#form-title #title').val(response['data']['title'] );
                validatorTitle.resetForm();
                $("#title-box").modal('show');
            } else {
                $.fn.showError(response['data']);
            }
        }).fail(function( jqXHR, textTitle, errorThrown) {
            $.fn.showError(textTitle);
        }).always(function() {
            NProgress.done();
        });
        return false;
        
    });

    $('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();
                    });
            }
       });
    });
    
    $('.btn-title-close').on("click", function(e){
        e.preventDefault();
        
        $("#title-box").modal('hide');
        return false;
    });

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


        
        $('#divEdit').hide();
        $('#divListing').show();
        return false;
    });


    CKEDITOR.replace('description');
    
    autocompleteLocation.addListener('place_changed', $.fn.fillInAddressLocation);
    autocompleteLocationNew.addListener('place_changed', $.fn.fillInAddressNewLocation);
});
JS;
$this->inlineScript()->captureEnd();
?>

<div class="container">
    <div class="card" id="divListing">
        <div class="card-header">
            LABEL_JOBS
        </div>
        <div class="card-body">
            <div class="row">
                <div class="col-12 mt-3">
                    <table id="gridTable" class="table   table-bordered">
                        <thead>
                            <tr>
                                <th>LABEL_LAST_DATE_OF_APPLICATION</th>
                                <th>LABEL_TITLE</th>
                                <th>LABEL_DETAILS</th>
                                <th>LABEL_ACTIONS</th>
                            </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="card-footer text-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"><i class="fa fa-plus"></i> LABEL_ADD </button>
            <?php endif; ?>
        </div>
    </div>

    <div class="card" id="divEdit" style="display: none">
        <div class="card-header ">
            LABEL_EDIT_JOB
        </div>
        <div class="card-body">
            <div class="card  mt-3">
                <div class="card-body">
                    <h6 class="card-title">
                        LABEL_STATUS <a href="#" title="" class="btn-status-edit"> <i class="fa fa-pen"></i></a>
                    </h6>
                    <div class="row">
                        <div class="col-12 mt-3" id="overview-status">
                        </div>
                    </div>
                </div>
            </div>

            <div class="card  mt-3">
                <div class="card-body">
                    <h6 class="card-title">
                        LABEL_TITLE <a href="#" title="" class="btn-title-edit"><i class="fa fa-pen"></i></a>
                    </h6>
                    <div class="row">
                        <div class="col-12 mt-3" id="overview-title">
                        </div>
                    </div>
                </div>
            </div>

            <div class="card  mt-3">
                <div class="card-body">
                    <h6 class="card-title">
                        LABEL_OVERVIEW <a href="#" title="" class="btn-extended-edit"><i class="fa fa-pen"></i></a>
                    </h6>
                    <div class="row">
                        <div class="col-12 mt-3" id="overview-description">
                        </div>
                    </div>
                </div>
            </div>


            <div class="card  mt-3">
                <div class="card-body">
                    <h6 class="card-title">
                        LABEL_LAST_DATE_OF_APPLICATION <a href="#" title="" class="btn-last-date-of-application-edit"><i class="fa fa-pen"></i></a>
                    </h6>
                    <div class="row">
                        <div class="col-12 mt-3" id="overview-last-date-of-application">
                        </div>
                    </div>
                </div>
            </div>

            <div class="card  mt-3">
                <div class="card-body">
                    <h6 class="card-title">
                        LABEL_EMPLOYMENT_TYPE <a href="#" title="" class="btn-employment-type-edit"><i class="fa fa-pen"></i></a>
                    </h6>
                    <div class="row">
                        <div class="col-12 mt-3" id="overview-employment-type">
                        </div>
                    </div>
                </div>
            </div>

            <div class="card  mt-3">
                <div class="card-body">
                    <h6 class="card-title">
                        LABEL_LOCATION <a href="#" title="" class="btn-location-edit"><i class="fa fa-pen"></i></a>
                    </h6>
                    <div class="row">
                        <div class="col-12 mt-3" id="overview-location">
                        </div>
                    </div>
                </div>
            </div>

            <div class="card  mt-3">
                <div class="card-body">
                    <h6 class="card-title">
                        LABEL_EXPERIENCE <a href="#" title="" class="btn-experience-edit"><i class="fa fa-pen"></i></a>
                    </h6>
                    <div class="row">
                        <div class="col-12 mt-3" id="overview-experience">
                        </div>
                    </div>
                </div>
            </div>

            <div class="card  mt-3">
                <div class="card-body">
                    <h6 class="card-title">
                        LABEL_SALARY <a href="#" title="" class="btn-salary-edit"><i class="fa fa-pen"></i></a>
                    </h6>
                    <div class="row">
                        <div class="col-12 mt-3" id="overview-salary">
                        </div>
                    </div>
                </div>
            </div>


            <div class="card  mt-3">
                <div class="card-body">
                    <h6 class="card-title">
                        LABEL_CATEGORIE <a href="#" title="" class="btn-job-category-edit"><i class="fa fa-pen"></i></a>
                    </h6>
                    <div class="row">
                        <div class="col-12 mt-3" id="overview-job-category">
                        </div>
                    </div>
                </div>
            </div>

            <div class="card  mt-3">
                <div class="card-body">
                    <h6 class="card-title">
                        LABEL_SKILLS <a href="#" title="" class="btn-skills-edit"> <i class="fa fa-pen"></i></a>
                    </h6>
                    <div class="row">
                        <div class="col-12 mt-3">
                            <ul id="list-skills">
                            </ul>
                        </div>
                    </div>
                </div>
            </div>

            <div class="card  mt-3">
                <div class="card-body">
                    <h6 class="card-title">
                        LABEL_LANGUAGES <a href="#" title="" class="btn-languages-edit"> <i class="fa fa-pen"></i></a>
                    </h6>
                    <div class="row">
                        <div class="col-12 mt-3">
                            <ul id="list-languages">
                            </ul>
                        </div>
                    </div>
                </div>
            </div>

            <div class="card  mt-3">
                <div class="card-body">
                    <h6 class="card-title">
                        LABEL_DEGREES <a href="#" title="" class="btn-degrees-edit"> <i class="fa fa-pen"></i></a>
                    </h6>
                    <div class="row">
                        <div class="col-12 mt-3">
                            <ul id="list-degrees">
                            </ul>
                        </div>
                    </div>
                </div>
            </div>

        </div>
        <div class="card-footer text-right">
            <button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
        </div>
    </div>
</div>



<div class="modal" tabindex="-1" role="dialog" id="add-job-box">
    <div class="modal-dialog" role="document">
        <?php
        $form = $this->formAdd;
        $form->setAttributes([
            'method'    => 'post',
            'name'      => 'form-add',
            'id'        => 'form-add'
        ]);
        $form->prepare();
        echo $this->form()->openTag($form);

        $fieldnames = [
            'formatted_address',
            'address1',
            'address2',
            'country',
            'state',
            'city1',
            'city2',
            'postal_code',
            'latitude',
            'longitude',
        ];

        foreach ($fieldnames as $fieldname) {

            $element = $form->get($fieldname);
            echo $this->formHidden($element);
        }
        ?>
        <div class="modal-content">
            <div class="modal-header">
                <h6 class="modal-title">LABEL_NEW_JOB</h6>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('title');
                        $element->setOptions(['label' => 'LABEL_TITLE']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        echo $this->formText($element);
                        ?>
                    </div>
                </div>
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('employment_type');
                        $element->setAttributes(['class' => 'form-control']);
                        $element->setOptions(['empty_option' => 'LABEL_SELECT_EMPLOYMENT_TYPE', 'label' => 'LABEL_EMPLOYMENT_TYPE']);
                        echo $this->formLabel($element);
                        echo $this->formSelect($element);
                        ?>
                    </div>
                </div>
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('last_date_of_application');
                        $element->setAttributes(['class' => 'form-control']);
                        $element->setOptions(['label' => 'LABEL_LAST_DATE_OF_APPLICATION']);
                        echo $this->formLabel($element);
                        echo $this->formText($element);
                        ?>
                    </div>
                </div>
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('job_category_id');
                        $element->setOptions(['empty_option' => 'LABEL_SELECT_JOB_CATEGORY', 'label' => 'LABEL_JOB_CATEGORY']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        echo $this->formSelect($element);
                        ?>
                    </div>
                </div>
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('location_search');
                        $element->setAttributes(['name' => 'add_location_search',  'id' => 'add_location_search', 'class' => 'form-control']);
                        $element->setOptions(['label' => 'LABEL_LOCATION']);
                        echo $this->formLabel($element);
                        echo $this->formText($element);
                        ?>
                    </div>
                </div>
            </div>

            <div class="modal-footer text-right">
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
                <button type="button" class="btn btn-default btn-add-job-cancel">LABEL_CANCEL</button>
            </div>
            <?php echo $this->form()->closeTag($form); ?>
        </div>
    </div>
</div>


<!-- The Modal -->
<div class="modal" id="modalUsersWhoApplied">
    <div class="modal-dialog modal-xl">
        <div class="modal-content">

            <!-- Modal Header -->
            <div class="modal-header">
                <h6 class="modal-title">LABEL_USERS_WHO_APPLIED</h6>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
            </div>

            <!-- Modal body -->
            <div class="modal-body">
                <div style="height: 300px;overflow: scroll;">
                    <table id="gridTableUsersWhoApplied" style="width: 100%" class="table table-bordered">
                        <thead>
                            <tr>
                                <th>LABEL_FIRST_NAME</th>
                                <th>LABEL_LAST_NAME</th>
                                <th>LABEL_EMAIL</th>
                                <th>LABEL_ACTIONS</th>
                            </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div>

            </div>

            <!-- Modal footer -->
            <div class="modal-footer text-right">
                <button type="button" class="btn btn-default btn-users-who-applied-cancel">LABEL_CANCEL</button>
            </div>

        </div>
    </div>
</div>

<div class="modal" tabindex="-1" role="dialog" id="extended-box">
    <div class="modal-dialog" role="document">
        <?php
        $form = $this->formExtended;
        $form->setAttributes([
            'method' => 'post',
            'name' => 'form-extended',
            'id' => 'form-extended'
        ]);
        $form->prepare();
        echo $this->form()->openTag($form);
        ?>
        <div class="modal-content">
            <div class="modal-header">
                <h6 class="modal-title">LABEL_OVERVIEW</h6>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('description');
                        $element->setOptions(['label' => 'LABEL_OVERVIEW']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        echo $this->formTextArea($element);
                        ?>
                    </div>
                </div>
            </div>
            <div class="modal-footer text-right">
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
                <button type="button" class="btn btn-default btn-extended-close">LABEL_CANCEL</button>
            </div>
            <?php echo $this->form()->closeTag($form); ?>
        </div>
    </div>
</div>

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

        $fieldnames = [
            'formatted_address',
            'address1',
            'address2',
            'country',
            'state',
            'city1',
            'city2',
            'postal_code',
            'latitude',
            'longitude',
        ];

        foreach ($fieldnames as $fieldname) {

            $element = $form->get($fieldname);
            echo $this->formHidden($element);
        }
        ?>
        <div class="modal-content">
            <div class="modal-header">
                <h6 class="modal-title">LABEL_LOCATION</h6>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-12 mt-3">

                        <?php
                        $element = $form->get('location_search');
                        $element->setOptions(['label' => 'LABEL_LOCATION']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        ?>
                        <div class="input-group mb-3">

                            <?php
                            echo $this->formText($element);
                            ?>
                            <span class="input-group-text"><i class="fa fa-map-marker"></i></span>
                        </div>


                    </div>
                </div>
            </div>
            <div class="modal-footer text-right">
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
                <button type="button" class="btn btn-default btn-location-close">LABEL_CANCEL</button>
            </div>
            <?php echo $this->form()->closeTag($form); ?>
        </div>
    </div>
</div>

<div class="modal" tabindex="-1" role="dialog" id="employment-type-box">
    <div class="modal-dialog" role="document">
        <?php
        $form = $this->formEmploymentType;
        $form->setAttributes([
            'method' => 'post',
            'name' => 'form-employment-type',
            'id' => 'form-employment-type'
        ]);
        $form->prepare();
        echo $this->form()->openTag($form);
        ?>
        <div class="modal-content">
            <div class="modal-header">
                <h6 class="modal-title">LABEL_EMPLOYMENT_TYPE</h6>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('employment_type');
                        $element->setOptions(['label' => 'LABEL_EMPLOYMENT_TYPE']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        echo $this->formSelect($element);
                        ?>
                    </div>
                </div>
            </div>
            <div class="modal-footer text-right">
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
                <button type="button" class="btn btn-default btn-employment-type-close">LABEL_CANCEL</button>
            </div>
            <?php echo $this->form()->closeTag($form); ?>
        </div>
    </div>
</div>

<div class="modal" tabindex="-1" role="dialog" id="job-category-box">
    <div class="modal-dialog" role="document">
        <?php
        $form = $this->formJobCategory;
        $form->setAttributes([
            'method' => 'post',
            'name' => 'form-job-category',
            'id' => 'form-job-category'
        ]);
        $form->prepare();
        echo $this->form()->openTag($form);
        ?>
        <div class="modal-content">
            <div class="modal-header">
                <h6 class="modal-title">LABEL_JOB_CATEGORY</h6>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('job_category_id');
                        $element->setOptions(['label' => 'LABEL_JOB_CATEGORY']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        echo $this->formSelect($element);
                        ?>
                    </div>
                </div>
            </div>
            <div class="modal-footer text-right">
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
                <button type="button" class="btn btn-default btn-job-category-close">LABEL_CANCEL</button>
            </div>
            <?php echo $this->form()->closeTag($form); ?>
        </div>
    </div>
</div>

<div class="modal" tabindex="-1" role="dialog" id="salary-box">
    <div class="modal-dialog" role="document">
        <?php
        $form = $this->formSalary;
        $form->setAttributes([
            'method' => 'post',
            'name' => 'form-salary',
            'id' => 'form-salary'
        ]);
        $form->prepare();
        echo $this->form()->openTag($form);
        ?>
        <div class="modal-content">
            <div class="modal-header">
                <h6 class="modal-title">LABEL_SALARY</h6>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('salary_visible');
                        echo $this->formCheckbox($element);
                        ?>
                    </div>
                </div>
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('salary_currency');
                        $element->setAttributes(['class' => 'form-control']);
                        $element->setOptions(['label' => 'LABEL_CURRENCY']);
                        echo $this->formLabel($element);
                        echo $this->formSelect($element);
                        ?>
                    </div>
                </div>
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('salary_min');
                        $element->setOptions(['label' => 'LABEL_MINIMUM']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        echo $this->formText($element);
                        ?>
                    </div>
                </div>
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('salary_max');
                        $element->setOptions(['label' => 'LABEL_MAXIMUM']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        echo $this->formText($element);
                        ?>
                    </div>
                </div>
            </div>
            <div class="modal-footer text-right">
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
                <button type="button" class="btn btn-default btn-salary-close">LABEL_CANCEL</button>
            </div>
            <?php echo $this->form()->closeTag($form); ?>
        </div>
    </div>
</div>

<div class="modal" tabindex="-1" role="dialog" id="experience-box">
    <div class="modal-dialog" role="document">
        <?php
        $form = $this->formExperience;
        $form->setAttributes([
            'method' => 'post',
            'name' => 'form-experience',
            'id' => 'form-experience'
        ]);
        $form->prepare();
        echo $this->form()->openTag($form);
        ?>
        <div class="modal-content">
            <div class="modal-header">
                <h6 class="modal-title">LABEL_EXPERIENCE</h6>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('experience_visible');

                        echo $this->formCheckbox($element);
                        ?>
                    </div>
                </div>
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('experience_min');
                        $element->setOptions(['label' => 'LABEL_MINIMUM']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        echo $this->formText($element);
                        ?>
                    </div>
                </div>
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('experience_max');
                        $element->setOptions(['label' => 'LABEL_MAXIMUM']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        echo $this->formText($element);
                        ?>
                    </div>
                </div>
            </div>
            <div class="modal-footer text-right">
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
                <button type="button" class="btn btn-default btn-experience-close">LABEL_CANCEL</button>
            </div>
            <?php echo $this->form()->closeTag($form); ?>
        </div>
    </div>
</div>


<div class="modal" tabindex="-1" role="dialog" id="skills-box">
    <div class="modal-dialog" role="document">
        <?php
        $form = $this->formSkill;
        $form->setAttributes([
            'method' => 'post',
            'name' => 'form-skill',
            'id' => 'form-skill'
        ]);
        $form->prepare();
        echo $this->form()->openTag($form);
        ?>
        <div class="modal-content">
            <div class="modal-header">
                <h6 class="modal-title">LABEL_SKILLS</h6>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('skills');
                        $element->setOptions(['label' => 'LABEL_SKILLS']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        echo $this->formSelect($element);
                        ?>
                    </div>
                </div>
            </div>


            <div class="modal-footer text-right">
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
                <button type="button" class="btn btn-default btn-skills-close">LABEL_CANCEL</button>
            </div>
            <?php echo $this->form()->closeTag($form); ?>
        </div>
    </div>
</div>

<div class="modal" tabindex="-1" role="dialog" id="languages-box">
    <div class="modal-dialog" role="document">
        <?php
        $form = $this->formLanguage;
        $form->setAttributes([
            'method' => 'post',
            'name' => 'form-language',
            'id' => 'form-language'
        ]);
        $form->prepare();
        echo $this->form()->openTag($form);
        ?>
        <div class="modal-content">
            <div class="modal-header">
                <h6 class="modal-title">LABEL_LANGUAGES</h6>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('languages');
                        $element->setOptions(['label' => 'LABEL_LANGUAGES']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        echo $this->formSelect($element);
                        ?>
                    </div>
                </div>
            </div>
            <div class="modal-footer text-right">
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
                <button type="button" class="btn btn-default btn-languages-close">LABEL_CANCEL</button>
            </div>
            <?php echo $this->form()->closeTag($form); ?>
        </div>
    </div>
</div>

<div class="modal" tabindex="-1" role="dialog" id="last-date-of-application-box">
    <div class="modal-dialog" role="document">
        <?php
        $form = $this->fromLastDateOfApplication;
        $form->setAttributes([
            'method' => 'post',
            'name' => 'form-last-date-of-application',
            'id' => 'form-last-date-of-application'
        ]);
        $form->prepare();
        echo $this->form()->openTag($form);
        ?>
        <div class="modal-content">
            <div class="modal-header">
                <h6 class="modal-title">LABEL_LAST_DATE_OF_APPLICATION</h6>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('last_date_of_application');
                        $element->setOptions(['label' => 'LABEL_LAST_DATE_OF_APPLICATION']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        echo $this->formText($element);
                        ?>
                    </div>
                </div>
            </div>
            <div class="modal-footer text-right">
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
                <button type="button" class="btn btn-default btn-last-date-of-application-close">LABEL_CANCEL</button>
            </div>
            <?php echo $this->form()->closeTag($form); ?>
        </div>
    </div>
</div>

<div class="modal" tabindex="-1" role="dialog" id="degrees-box">
    <div class="modal-dialog" role="document">
        <?php
        $form = $this->formDegree;
        $form->setAttributes([
            'method' => 'post',
            'name' => 'form-degree',
            'id' => 'form-degree'
        ]);
        $form->prepare();
        echo $this->form()->openTag($form);
        ?>
        <div class="modal-content">
            <div class="modal-header">
                <h6 class="modal-title">LABEL_DEGREES</h6>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('degrees');
                        $element->setOptions(['label' => 'LABEL_DEGREES']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        echo $this->formSelect($element);
                        ?>
                    </div>
                </div>
            </div>
            <div class="modal-footer text-right">
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
                <button type="button" class="btn btn-default btn-degrees-close">LABEL_CANCEL</button>
            </div>
            <?php echo $this->form()->closeTag($form); ?>
        </div>
    </div>
</div>

<div class="modal" tabindex="-1" role="dialog" id="status-box">
    <div class="modal-dialog" role="document">
        <?php
        $form = $this->formStatus;
        $form->setAttributes([
            'method' => 'post',
            'name' => 'form-status',
            'id' => 'form-status'
        ]);
        $form->prepare();
        echo $this->form()->openTag($form);
        ?>
        <div class="modal-content">
            <div class="modal-header">
                <h6 class="modal-title">LABEL_STATUS</h6>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('status');
                        $element->setOptions(['label' => 'LABEL_STATUS']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        echo $this->formSelect($element);
                        ?>
                    </div>
                </div>
            </div>


            <div class="modal-footer text-right">
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
                <button type="button" class="btn btn-default btn-status-close">LABEL_CANCEL</button>
            </div>
            <?php echo $this->form()->closeTag($form); ?>
        </div>
    </div>
</div>

<div class="modal" tabindex="-1" role="dialog" id="title-box">
    <div class="modal-dialog" role="document">
        <?php
        $form = $this->formTitle;
        $form->setAttributes([
            'method' => 'post',
            'name' => 'form-title',
            'id' => 'form-title'
        ]);
        $form->prepare();
        echo $this->form()->openTag($form);
        ?>
        <div class="modal-content">
            <div class="modal-header">
                <h6 class="modal-title">LABEL_TITLE</h6>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-12 mt-3">
                        <?php
                        $element = $form->get('title');
                        $element->setOptions(['label' => 'LABEL_TITLE']);
                        $element->setAttributes(['class' => 'form-control']);
                        echo $this->formLabel($element);
                        echo $this->formText($element);
                        ?>
                    </div>
                </div>
            </div>


            <div class="modal-footer text-right">
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
                <button type="button" class="btn btn-default btn-title-close">LABEL_CANCEL</button>
            </div>
            <?php echo $this->form()->closeTag($form); ?>
        </div>
    </div>
</div>