Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 1630 | Rev 1633 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1630 Rev 1631
Línea 1... Línea 1...
1
<?php 
1
<?php
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
2
$acl = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser    = $this->currentUserHelper();
3
$currentUser = $this->currentUserHelper();
4
$roleName       = $currentUser->getUserTypeId();
4
$roleName = $currentUser->getUserTypeId();
Línea 5... Línea 5...
5
 
5
 
6
$routeDatatable = $this->url('recruitment-and-selection/candidates');
6
$routeDatatable = $this->url('recruitment-and-selection/candidates');
7
$routeEmail = $this->url('recruitment-and-selection/candidates/email');
7
$routeEmail = $this->url('recruitment-and-selection/candidates/email');
Línea 45... Línea 45...
45
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
45
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
46
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
46
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
47
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
47
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
Línea 48... Línea -...
48
 
-
 
49
 
48
 
50
 
49
 
Línea 51... Línea 50...
51
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
50
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
52
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
51
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
Línea 53... Línea 52...
53
 
52
 
54
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
53
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
55
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
-
 
56
 
-
 
57
 
54
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
58
$this->inlineScript()->captureStart();
-
 
59
echo <<<JS
55
 
60
 
56
 
61
 
57
$this->inlineScript()->captureStart();
62
jQuery( document ).ready(function( $ ) {
58
echo <<<JS
Línea 63... Línea 59...
63
 
59
jQuery(document).ready(function ($) {
64
    var allowAdd = $allowAdd;
60
    var allowAdd = $allowAdd;
65
    var allowDelete = $allowDelete;
61
    var allowDelete = $allowDelete;
66
    var allowEdit = $allowEdit;
62
    var allowEdit = $allowEdit;
67
    var allowEmail = $allowEmail;
63
    var allowEmail = $allowEmail;
68
 
64
 
69
        var gridTable = $('#gridTable').dataTable( {
65
    var gridTable = $('#gridTable').dataTable({
70
            'processing': true,
66
        'processing': true,
71
            'serverSide': true,
67
        'serverSide': true,
72
            'searching': true,
68
        'searching': true,
73
            'order': [[ 1, 'asc' ]],
69
        'order': [[1, 'asc']],
74
            'ordering':  true,
70
        'ordering': true,
75
            'ordenable' : true,
71
        'ordenable': true,
76
            'responsive': true,
72
        'responsive': true,
77
            'select' : false,
73
        'select': false,
78
        	'paging': true,
74
        'paging': true,
79
            'pagingType': 'simple_numbers',
75
        'pagingType': 'simple_numbers',
80
            'lengthMenu': [ [10, 25, 50, -1], [10, 25, 50, 'All'] ],
76
        'lengthMenu': [[10, 25, 50, -1], [10, 25, 50, 'All']],
81
 
77
 
82
    		'ajax': {
78
        'ajax': {
83
    			'url' : '$routeDatatable',
79
            'url': '$routeDatatable',
84
    			'type' : 'get',
80
            'type': 'get',
85
                'data': function ( d ) {
81
            'data': function (d) {
86
                },
82
            },
87
                'beforeSend': function (request) {
83
            'beforeSend': function (request) {
88
                  NProgress.start();
84
                NProgress.start();
89
                },
85
            },
90
                'dataFilter': function(response) {
86
            'dataFilter': function (response) {
91
                    var response = jQuery.parseJSON( response );
87
                var response = jQuery.parseJSON(response);
92
                    
88
 
93
                    var json                = {};
89
                var json = {};
94
                    json.recordsTotal       = 0;
90
                json.recordsTotal = 0;
95
                    json.recordsFiltered    = 0;
91
                json.recordsFiltered = 0;
96
                    json.data               = [];
92
                json.data = [];
97
                    
93
 
98
                    if(response.success) {
-
 
99
                                               json.recordsTotal       = response.data.total;
-
 
100
                        json.recordsFiltered    = response.data.total;
-
 
101
                        json.data               = response.data.items;
94
                if (response.success) {
102
                    } else {
-
 
103
                        $.fn.showError(response.data)
-
 
104
                    }
-
 
105
                    
-
 
106
                    return JSON.stringify( json );
-
 
107
                }
-
 
108
    		},
-
 
109
            'language' : {
-
 
110
                'sProcessing':     'LABEL_DATATABLE_SPROCESSING',
-
 
111
                'sLengthMenu':     'LABEL_DATATABLE_SLENGTHMENU',
-
 
112
                'sZeroRecords':    'LABEL_DATATABLE_SZERORECORDS',
-
 
113
                'sEmptyTable':     'LABEL_DATATABLE_SEMPTYTABLE',
-
 
114
                'sInfo':           'LABEL_DATATABLE_SINFO',
-
 
115
                'sInfoEmpty':      'LABEL_DATATABLE_SINFOEMPTY',
-
 
116
                'sInfoFiltered':   'LABEL_DATATABLE_SINFOFILTERED',
-
 
117
                'sInfoPostFix':    '',
-
 
118
                'sSearch':         'LABEL_DATATABLE_SSEARCH',
-
 
119
                'sUrl':            '',
-
 
120
                'sInfoThousands':  ',',
-
 
121
                'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
-
 
122
                'oPaginate': {
-
 
123
                    'sFirst':    'LABEL_DATATABLE_SFIRST',
-
 
124
                    'sLast':     'LABEL_DATATABLE_SLAST',
-
 
125
                    'sNext':     'LABEL_DATATABLE_SNEXT',
-
 
126
                    'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
-
 
127
                },
-
 
128
                'oAria': {
-
 
129
                    'sSortAscending':  ': LABEL_DATATABLE_SSORTASCENDING',
-
 
130
                    'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
-
 
131
                },
-
 
132
            },
-
 
133
            'drawCallback': function( settings ) {
-
 
134
                NProgress.done();
-
 
135
                $('button.btn-delete').confirmation({
-
 
136
                    rootSelector: 'button.btn-delete',
-
 
137
                    title : 'LABEL_ARE_YOU_SURE',
-
 
138
                    singleton : true,
-
 
139
                    btnOkLabel: 'LABEL_YES',
-
 
140
                    btnCancelLabel: 'LABEL_NO',
-
 
141
                    onConfirm: function(value) {
-
 
142
                        action = $(this).data('href');
-
 
143
                        NProgress.start();
-
 
144
                        $.ajax({
-
 
145
                            'dataType'  : 'json',
-
 
146
                            'accept'    : 'application/json',
-
 
147
                            'method'    : 'post',
-
 
148
                            'url'       :  action,
-
 
149
                        }).done(function(response) {
-
 
150
                            if(response['success']) {
-
 
151
                                $.fn.showSuccess(response['data']);
-
 
152
                                gridTable.api().ajax.reload(null, false);
-
 
153
                            } else {
-
 
154
                                $.fn.showError(response['data']);
-
 
155
                            }
-
 
156
                        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
157
                            $.fn.showError(textStatus);
-
 
158
                        }).always(function() {
-
 
159
                            NProgress.done();
-
 
160
                        });
-
 
161
                    },
-
 
162
                });
-
 
163
 
-
 
164
                $('#form-add #file').fileinput({
-
 
165
                    theme: 'fas',
-
 
Línea -... Línea 95...
-
 
95
                    json.recordsTotal = response.data.total;
-
 
96
                    json.recordsFiltered = response.data.total;
-
 
97
                    json.data = response.data.items;
-
 
98
                } else {
-
 
99
                    $.fn.showError(response.data)
-
 
100
                }
-
 
101
 
-
 
102
                return JSON.stringify(json);
-
 
103
            }
-
 
104
        },
-
 
105
        'language': {
-
 
106
            'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
-
 
107
            'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
-
 
108
            'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
-
 
109
            'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
-
 
110
            'sInfo': 'LABEL_DATATABLE_SINFO',
-
 
111
            'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
-
 
112
            'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
-
 
113
            'sInfoPostFix': '',
-
 
114
            'sSearch': 'LABEL_DATATABLE_SSEARCH',
-
 
115
            'sUrl': '',
-
 
116
            'sInfoThousands': ',',
-
 
117
            'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
-
 
118
            'oPaginate': {
-
 
119
                'sFirst': 'LABEL_DATATABLE_SFIRST',
-
 
120
                'sLast': 'LABEL_DATATABLE_SLAST',
-
 
121
                'sNext': 'LABEL_DATATABLE_SNEXT',
-
 
122
                'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
-
 
123
            },
-
 
124
            'oAria': {
166
                    language: 'es',
125
                'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
-
 
126
                'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
-
 
127
            },
-
 
128
        },
-
 
129
        'drawCallback': function (settings) {
-
 
130
            NProgress.done();
-
 
131
            $('button.btn-delete').confirmation({
167
                    showUpload: false,
132
                rootSelector: 'button.btn-delete',
-
 
133
                title: 'LABEL_ARE_YOU_SURE',
-
 
134
                singleton: true,
-
 
135
                btnOkLabel: 'LABEL_YES',
-
 
136
                btnCancelLabel: 'LABEL_NO',
-
 
137
                onConfirm: function (value) {
-
 
138
                    action = $(this).data('href');
-
 
139
                    NProgress.start();
-
 
140
                    $.ajax({
-
 
141
                        'dataType': 'json',
-
 
142
                        'accept': 'application/json',
-
 
143
                        'method': 'post',
-
 
144
                        'url': action,
-
 
145
                    }).done(function (response) {
-
 
146
                        if (response['success']) {
-
 
147
                            $.fn.showSuccess(response['data']);
-
 
148
                            gridTable.api().ajax.reload(null, false);
-
 
149
                        } else {
-
 
150
                            $.fn.showError(response['data']);
-
 
151
                        }
Línea -... Línea 152...
-
 
152
                    }).fail(function (jqXHR, textStatus, errorThrown) {
-
 
153
                        $.fn.showError(textStatus);
-
 
154
                    }).always(function () {
-
 
155
                        NProgress.done();
-
 
156
                    });
-
 
157
                },
-
 
158
            });
-
 
159
 
Línea 168... Línea 160...
168
                    dropZoneEnabled: false,
160
            $('#form-add #file').fileinput({
169
                    maxFileCount: 1,
-
 
170
                    allowedFileExtensions: ['pdf', 'docx'],
-
 
171
                });
-
 
172
 
-
 
173
                $('body').on('click', 'button.btn-add', function(e) {
161
                theme: 'fas',
Línea 174... Línea -...
174
                     e.preventDefault();
-
 
175
 
-
 
176
 
-
 
Línea 177... Línea 162...
177
                     $('#form-add #first_name').val('');
162
                language: 'es',
178
                     $('#form-add #last_name').val('');
163
                showUpload: false,
179
                     $('#form-add #email').val('');
164
                dropZoneEnabled: false,
180
                     $('#form-add #file').fileinput('reset');
165
                maxFileCount: 1,
181
                     $('#form-add #file').val('');
166
                allowedFileExtensions: ['pdf', 'docx'],
182
                     validatorAdd.resetForm();
167
            });
Línea 183... Línea -...
183
 
-
 
184
                     $('#add-candidate-box').modal('show');
-
 
185
                     return false;
-
 
186
                    });
-
 
187
 
-
 
188
                    $(".close-box, .btn-add-cancel").on("click", function(e){
-
 
189
                         e.preventDefault();
-
 
190
                         $('#add-candidate-box').modal('hide');
-
 
191
                         $('#edit-candidate-box').modal('hide');
-
 
192
                         return false;
168
 
193
                    });
-
 
194
 
-
 
195
    var validatorEdit = $('#form-edit').validate({
169
            $('body').on('click', 'button.btn-add', function (e) {
196
        debug: true,
-
 
197
        onclick: false,
-
 
198
        onkeyup: false,
-
 
199
        onfocusout: false,
-
 
200
        ignore: [],
-
 
201
        rules: {
-
 
202
            'first_name': {
-
 
203
                required: true,
-
 
204
                maxlength: 128,
170
                e.preventDefault();
205
            },
-
 
206
            'file': {
-
 
207
                required: false,
-
 
208
                extension: 'pdf|docx',
-
 
209
                accept: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/msword,application/pdf'
-
 
210
            },
-
 
211
            'last_name': {
-
 
212
                required: true,
-
 
213
            },
-
 
214
            'email' :  {
-
 
Línea -... Línea 171...
-
 
171
 
-
 
172
 
-
 
173
                $('#form-add #first_name').val('');
215
                required: true,
174
                $('#form-add #last_name').val('');
-
 
175
                $('#form-add #email').val('');
-
 
176
                $('#form-add #file').fileinput('reset');
Línea -... Línea 177...
-
 
177
                $('#form-add #file').val('');
216
            },
178
                validatorAdd.resetForm();
217
            'status' : {
179
 
218
                required: true,
180
                $('#add-candidate-box').modal('show');
219
            }
181
                return false;
-
 
182
            });
-
 
183
 
220
        },
184
            $(".close-box, .btn-add-cancel").on("click", function (e) {
221
        submitHandler: function(form)
185
                e.preventDefault();
222
        {
186
                $('#add-candidate-box').modal('hide');
223
            var formdata = false;
187
                $('#edit-candidate-box').modal('hide');
224
            if (window.FormData){
188
                return false;
225
                formdata = new FormData(form); //form[0]);
189
            });
226
            }
190
 
227
 
-
 
-
 
191
            var validatorEdit = $('#form-edit').validate({
-
 
192
                debug: true,
228
            $('input[type="submit"]').prop('disabled', true);
193
                onclick: false,
229
 
194
                onkeyup: false,
230
            $.ajax({
195
                onfocusout: false,
-
 
196
                ignore: [],
231
                'dataType'  : 'json',
197
                rules: {
-
 
198
                    'first_name': {
232
                'accept'    : 'application/json',
199
                        required: true,
233
                'method'    : 'post',
200
                        maxlength: 128,
234
                'url'       :  $('#form-edit').attr('action'),
201
                    },
-
 
202
                    'file': {
235
                'data'      :  formdata,
203
                        required: false,
236
                'processData': false,
204
                        extension: 'pdf|docx',
237
                'contentType': false,
205
                        accept: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/msword,application/pdf'
-
 
206
                    },
238
            }).done(function(response) {
207
                    'last_name': {
239
                if(response['success']) {
-
 
240
                    $.fn.showSuccess(response['data']);
-
 
241
                       
-
 
242
                    $('#edit-candidate-box').modal('hide');
-
 
243
                    gridTable.api().ajax.reload(null, false);
-
 
244
                } else {
-
 
245
                    validatorEdit.resetForm();
-
 
246
                    if(jQuery.type(response['data']) == 'string') {
-
 
247
                        $.fn.showError(response['data']);
-
 
248
                    } else  {
-
 
249
                        $.each(response['data'], function( fieldname, errors ) {
-
 
250
                            $.fn.showFormErrorValidator('#form-edit #' + fieldname, errors);
-
 
Línea 251... Línea -...
251
                        });
-
 
252
                    }
-
 
253
                }
-
 
254
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
255
                $.fn.showError(textStatus);
-
 
256
            }).always(function() {
-
 
257
                NProgress.done();
-
 
258
            });
-
 
259
            return false;
-
 
260
        },
-
 
261
        invalidHandler: function(form, validator) {
-
 
262
            
-
 
263
        }
-
 
264
    });
208
                        required: true,
265
 
-
 
266
    $('body').on('click', 'button.btn-edit', function(e) {
-
 
267
            e.preventDefault();
-
 
268
    
-
 
269
            var url = $(this).data('href');
-
 
Línea -... Línea 209...
-
 
209
                    },
-
 
210
                    'email': {
-
 
211
                        required: true,
-
 
212
                    },
-
 
213
                    'status': {
-
 
214
                        required: true,
-
 
215
                    }
-
 
216
                },
-
 
217
                submitHandler: function (form) {
-
 
218
                    var formdata = false;
-
 
219
                    if (window.FormData) {
270
            $.ajax({
220
                        formdata = new FormData(form); //form[0]);
-
 
221
                    }
-
 
222
 
-
 
223
                    $('input[type="submit"]').prop('disabled', true);
-
 
224
 
271
                'dataType'  : 'json',
225
                    $.ajax({
-
 
226
                        'dataType': 'json',
-
 
227
                        'accept': 'application/json',
-
 
228
                        'method': 'post',
-
 
229
                        'url': $('#form-edit').attr('action'),
-
 
230
                        'data': formdata,
-
 
231
                        'processData': false,
-
 
232
                        'contentType': false,
-
 
233
                    }).done(function (response) {
-
 
234
                        if (response['success']) {
-
 
235
                            $.fn.showSuccess(response['data']);
-
 
236
 
-
 
237
                            $('#edit-candidate-box').modal('hide');
-
 
238
                            gridTable.api().ajax.reload(null, false);
-
 
239
                        } else {
-
 
240
                            validatorEdit.resetForm();
Línea 272... Línea -...
272
                'accept'    : 'application/json',
-
 
273
                'method'    : 'get',
-
 
274
                'url'       :  url,
-
 
275
            }).done(function(response) {
-
 
276
                if(response['success']) {
-
 
277
                    $('#form-edit')[0].reset();
-
 
278
    
-
 
279
                    $('#form-edit').attr('action',url);
-
 
280
                    $('#form-edit #first_name').val(response['data']['first_name']);
-
 
281
                    $('#form-edit #last_name').val(response['data']['last_name']);
-
 
282
                    $('#form-edit #email').val(response['data']['email']);
241
                            if (jQuery.type(response['data']) == 'string') {
283
                    $('#form-edit #file').fileinput('reset');
-
 
284
                    $('#form-edit #file').val('');
-
 
285
 
-
 
286
    
-
 
287
                    $('#form-edit #status').val(response['data']['status']);
242
                                $.fn.showError(response['data']);
288
 
-
 
Línea 289... Línea 243...
289
                    $('#edit-candidate-box').modal('show');
243
                            } else {
290
                } else {
-
 
291
                    validatorEdit.resetForm();
-
 
292
                    if(jQuery.type(response['data']) == 'string') {
-
 
293
                        $.fn.showError(response['data']);
-
 
294
                    } else  {
-
 
295
                        $.each(response['data'], function( fieldname, errors ) {
-
 
296
                            $.fn.showFormErrorValidator('#form-edit #' + fieldname, errors);
-
 
297
                        });
-
 
298
                    }
-
 
299
                }
-
 
300
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
301
                $.fn.showError(textStatus);
244
                                $.each(response['data'], function (fieldname, errors) {
302
            }).always(function() {
-
 
303
                NProgress.done();
-
 
304
            });
-
 
305
        });
-
 
306
 
-
 
307
    var validatorAdd = $('#form-add').validate({
-
 
308
        debug: true,
-
 
309
        onclick: false,
-
 
310
        onkeyup: false,
-
 
311
        onfocusout: false,
-
 
312
        ignore: [],
-
 
313
        rules: {
-
 
314
            'first_name': {
-
 
315
                required: true,
-
 
316
                maxlength: 128,
-
 
317
            },
-
 
318
            'file': {
-
 
319
                required: false,
-
 
320
                extension: 'pdf|docx',
-
 
Línea -... Línea 245...
-
 
245
                                    $.fn.showFormErrorValidator('#form-edit #' + fieldname, errors);
-
 
246
                                });
-
 
247
                            }
-
 
248
                        }
-
 
249
                    }).fail(function (jqXHR, textStatus, errorThrown) {
-
 
250
                        $.fn.showError(textStatus);
-
 
251
                    }).always(function () {
-
 
252
                        NProgress.done();
-
 
253
                    });
-
 
254
                    return false;
321
                accept: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/msword,application/pdf'
255
                },
-
 
256
                invalidHandler: function (form, validator) {
-
 
257
 
-
 
258
                }
-
 
259
            });
-
 
260
 
Línea 322... Línea -...
322
            },
-
 
323
            'last_name': {
-
 
324
                required: true,
-
 
325
            },
-
 
326
            'email' :  {
-
 
327
                required: true,
-
 
328
            }, 
-
 
329
            'status' : {
-
 
330
                required: true,
-
 
331
            }
-
 
-
 
261
            $('body').on('click', 'button.btn-edit', function (e) {
332
        },
262
                e.preventDefault();
333
        submitHandler: function(form)
263
 
334
        {
264
                var url = $(this).data('href');
335
            var formdata = false;
-
 
336
            if (window.FormData){
265
                $.ajax({
337
                formdata = new FormData(form); //form[0]);
266
                    'dataType': 'json',
338
            }
267
                    'accept': 'application/json',
339
 
268
                    'method': 'get',
340
            $('input[type="submit"]').prop('disabled', true);
269
                    'url': url,
341
 
270
                }).done(function (response) {
342
            $.ajax({
271
                    if (response['success']) {
-
 
272
                        $('#form-edit')[0].reset();
343
                'dataType'  : 'json',
273
 
344
                'accept'    : 'application/json',
274
                        $('#form-edit').attr('action', url);
345
                'method'    : 'post',
-
 
346
                'url'       :  $('#form-add').attr('action'),
275
                        $('#form-edit #first_name').val(response['data']['first_name']);
347
                'data'      :  formdata,
276
                        $('#form-edit #last_name').val(response['data']['last_name']);
348
                'processData': false,
277
                        $('#form-edit #email').val(response['data']['email']);
349
                'contentType': false,
278
                        $('#form-edit #file').fileinput('reset');
-
 
279
                        $('#form-edit #file').val('');
350
            }).done(function(response) {
280
 
351
                if(response['success']) {
-
 
352
                    $.fn.showSuccess(response['data']);
-
 
353
                       
-
 
354
                    $('#add-candidate-box').modal('hide');
-
 
355
                    gridTable.api().ajax.reload(null, false);
-
 
356
                } else {
-
 
Línea 357... Línea 281...
357
                    validatorAdd.resetForm();
281
 
358
                    if(jQuery.type(response['data']) == 'string') {
282
                        $('#form-edit #status').val(response['data']['status']);
359
                        $.fn.showError(response['data']);
283
 
360
                    } else  {
284
                        $('#edit-candidate-box').modal('show');
361
                        $.each(response['data'], function( fieldname, errors ) {
285
                    } else {
362
                            $.fn.showFormErrorValidator('#form-add #' + fieldname, errors);
286
                        validatorEdit.resetForm();
363
                        });
287
                        if (jQuery.type(response['data']) == 'string') {
364
                    }
288
                            $.fn.showError(response['data']);
365
                }
289
                        } else {
366
            }).fail(function( jqXHR, textStatus, errorThrown) {
290
                            $.each(response['data'], function (fieldname, errors) {
367
                $.fn.showError(textStatus);
291
                                $.fn.showFormErrorValidator('#form-edit #' + fieldname, errors);
368
            }).always(function() {
292
                            });
369
                NProgress.done();
293
                        }
370
            });
294
                    }
371
            return false;
295
                }).fail(function (jqXHR, textStatus, errorThrown) {
372
        },
296
                    $.fn.showError(textStatus);
373
        invalidHandler: function(form, validator) {
297
                }).always(function () {
374
            
298
                    NProgress.done();
375
        }
299
                });
376
    });
300
            });
377
 
301
 
378
    var validatorAdd = $('#form-add').validate({
302
            var validatorAdd = $('#form-add').validate({
379
        debug: true,
303
                debug: true,
380
        onclick: false,
304
                onclick: false,
381
        onkeyup: false,
305
                onkeyup: false,
382
        onfocusout: false,
306
                onfocusout: false,
383
        ignore: [],
307
                ignore: [],
384
       /* rules: {
-
 
385
            'first_name': {
308
                rules: {
386
                required: true,
309
                    'first_name': {
387
                maxlength: 128,
310
                        required: true,
388
            },
311
                        maxlength: 128,
Línea 389... Línea 312...
389
            'file': {
312
                    },
-
 
313
                    'file': {
-
 
314
                        required: false,
-
 
315
                        extension: 'pdf|docx',
-
 
316
                        accept: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/msword,application/pdf'
-
 
317
                    },
-
 
318
                    'last_name': {
-
 
319
                        required: true,
-
 
320
                    },
-
 
321
                    'email': {
-
 
322
                        required: true,
-
 
323
                    },
-
 
324
                    'status': {
-
 
325
                        required: true,
-
 
326
                    }
-
 
327
                },
-
 
328
                submitHandler: function (form) {
-
 
329
                    var formdata = false;
-
 
330
                    if (window.FormData) {
-
 
331
                        formdata = new FormData(form); //form[0]);
-
 
332
                    }
-
 
333
 
-
 
334
                    $('input[type="submit"]').prop('disabled', true);
-
 
335
 
-
 
336
                    $.ajax({
-
 
337
                        'dataType': 'json',
-
 
338
                        'accept': 'application/json',
-
 
339
                        'method': 'post',
-
 
340
                        'url': $('#form-add').attr('action'),
-
 
341
                        'data': formdata,
-
 
342
                        'processData': false,
-
 
343
                        'contentType': false,
-
 
344
                    }).done(function (response) {
-
 
345
                        if (response['success']) {
Línea 390... Línea -...
390
                required: false,
-
 
391
                extension: 'pdf|docx',
-
 
392
                accept: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/msword,application/pdf'
-
 
393
            },
-
 
394
            'last_name': {
-
 
395
                required: true,
-
 
396
            },
-
 
397
            'email' :  {
-
 
398
                required: true,
-
 
399
            }, 
-
 
400
            'status' : {
-
 
401
                required: true,
-
 
402
            }
-
 
403
        },*/
-
 
404
        submitHandler: function(form)
-
 
405
        {
-
 
406
            var formdata = false;
-
 
407
            if (window.FormData){
-
 
408
                formdata = new FormData(form); //form[0]);
-
 
409
            }
-
 
410
 
-
 
411
            $('input[type="email"]').prop('disabled', true);
-
 
412
 
-
 
413
            $.ajax({
346
                            $.fn.showSuccess(response['data']);
414
                'dataType'  : 'json',
-
 
415
                'accept'    : 'application/json',
-
 
416
                'method'    : 'get',
-
 
417
                'url'       :  $('#form-add').attr('email'),
-
 
418
                'data'      :  formdata,
347
 
419
                'processData': false,
-
 
420
                'contentType': false,
-
 
421
            }).done(function(response) {
-
 
422
                if(response['success']) {
-
 
423
                    $.fn.showSuccess(response['data']);
-
 
424
                       
-
 
Línea -... Línea 348...
-
 
348
                            $('#add-candidate-box').modal('hide');
-
 
349
                            gridTable.api().ajax.reload(null, false);
-
 
350
                        } else {
-
 
351
                            validatorAdd.resetForm();
-
 
352
                            if (jQuery.type(response['data']) == 'string') {
425
                    $('#add-candidate-box').modal('hide');
353
                                $.fn.showError(response['data']);
-
 
354
                            } else {
426
                    gridTable.api().ajax.reload(null, false);
355
                                $.each(response['data'], function (fieldname, errors) {
427
                } else {
356
                                    $.fn.showFormErrorValidator('#form-add #' + fieldname, errors);
428
                    validatorAdd.resetForm();
357
                                });
429
                    if(jQuery.type(response['data']) == 'string') {
358
                            }
430
                        $.fn.showError(response['data']);
359
                        }
431
                    } else  {
360
                    }).fail(function (jqXHR, textStatus, errorThrown) {
432
                        $.each(response['data'], function( fieldname, errors ) {
361
                        $.fn.showError(textStatus);
433
                            $.fn.showFormErrorValidator('#form-add #' + fieldname, errors);
-
 
434
                        });
-
 
435
                    }
362
                    }).always(function () {
436
                }
363
                        NProgress.done();
437
            }).fail(function( jqXHR, textStatus, errorThrown) {
364
                    });
438
                $.fn.showError(textStatus);
365
                    return false;
439
            }).always(function() {
366
                },
440
                NProgress.done();
-
 
441
            });
-
 
442
            return false;
-
 
443
        },
-
 
Línea 444... Línea 367...
444
        invalidHandler: function(form, validator) {
367
                invalidHandler: function (form, validator) {
445
            
368
 
446
        }
369
                }
Línea 447... Línea 370...
447
    });
370
            });
-
 
371
 
448
 
372
            $('body').on('click', '#check-email', function () {
-
 
373
                $.ajax("$routeEmail", {
-
 
374
                    accepts: 'application/json',
449
            },
375
                    method: 'GET',
450
            'aoColumns': [
376
                });
451
                { 'mDataProp': 'first_name' },
377
            })
-
 
378
        },
Línea 452... Línea 379...
452
                { 'mDataProp': 'last_name' },
379
        'aoColumns': [
453
                { 'mDataProp': 'email' },
380
            { 'mDataProp': 'first_name' },
Línea 454... Línea 381...
454
                { 'mDataProp': 'actions' },
381
            { 'mDataProp': 'last_name' },
Línea 455... Línea 382...
455
    	    ],
382
            { 'mDataProp': 'email' },
Línea 486... Línea 413...
486
        gridTable.api().ajax.url("$routeDatatable" + "/" + uuid);
413
        gridTable.api().ajax.url("$routeDatatable" + "/" + uuid);
487
        gridTable.api().ajax.reload(null, false);
414
        gridTable.api().ajax.reload(null, false);
488
    })
415
    })
Línea 489... Línea 416...
489
 
416
 
490
 
417
 
491
    $('body').on('click', 'button.btn-refresh', function(e) {
418
    $('body').on('click', 'button.btn-refresh', function (e) {
492
        e.preventDefault();
419
        e.preventDefault();
Línea 493... Línea 420...
493
        gridTable.api().ajax.reload(null, false);
420
        gridTable.api().ajax.reload(null, false);
Línea 500... Línea 427...
500
?>
427
?>
Línea 501... Línea 428...
501
 
428
 
502
 
429
 
503
<!-- Content Header (Page header) -->
430
<!-- Content Header (Page header) -->
504
<section class="content-header">
431
<section class="content-header">
505
	<div class="container-fluid">
432
    <div class="container-fluid">
506
    	<div class="row mb-2">
433
        <div class="row mb-2">
507
        	<div class="col-sm-12">
434
            <div class="col-sm-12">
508
            	<h1>LABEL_CANDIDATES</h1>
435
                <h1>LABEL_CANDIDATES</h1>
509
			</div>
436
            </div>
510
		</div>
437
        </div>
Línea 511... Línea 438...
511
	</div><!-- /.container-fluid -->
438
    </div><!-- /.container-fluid -->
512
</section>
439
</section>
513
 
440
 
514
<section class="content">
441
<section class="content">
515
	<div class="container-fluid">
442
    <div class="container-fluid">
516
    	<div class="row">
443
        <div class="row">
517
        	<div class="col-12">
444
            <div class="col-12">
518
				<div class="card">        
445
                <div class="card">
519
					<div class="card-header">
446
                    <div class="card-header">
520
						<?php 
447
                        <?php
521
                        // $form = $this->form;
448
                        // $form = $this->form;
522
            	        $form->setAttributes([
449
                        $form->setAttributes([
523
                            'name'    => 'form-filter',
450
                            'name' => 'form-filter',
524
                            'id'      => 'form-filter',
451
                            'id' => 'form-filter',
525
                        ]);
452
                        ]);
526
    
453
 
527
                        $form->prepare();
454
                        $form->prepare();
528
                        echo $this->form()->openTag($form);
455
                        echo $this->form()->openTag($form);
529
                        ?>		
456
                        ?>
530
                        <div class="row">
457
                        <div class="row">
531
                            <div class="col-md-6 col-sm-12">
458
                            <div class="col-md-6 col-sm-12">
532
                                <div class="form-group">
459
                                <div class="form-group">
533
                                    <?php
460
                                    <?php
534
                                    $element = $form->get('form_uuid');
461
                                    $element = $form->get('form_uuid');
535
                                   
462
 
536
                                    $element->setOptions(['label' => 'LABEL_VACANCIES']);
463
                                    $element->setOptions(['label' => 'LABEL_VACANCIES']);
537
                                    
464
 
538
                                    $element->setAttributes(['class' => 'form-control']);
465
                                    $element->setAttributes(['class' => 'form-control']);
539
                                    echo $this->formLabel($element);
466
                                    echo $this->formLabel($element);
540
                                    echo $this->formSelect($element);
467
                                    echo $this->formSelect($element);
Línea 541... Línea 468...
541
                                    ?>
468
                                    ?>
542
                                </div>	
469
                                </div>
543
                            </div>
470
                            </div>
544
 
471
 
545
                        </div>
472
                        </div>
546
						<?php echo $this->form()->closeTag($form); ?>
473
                        <?php echo $this->form()->closeTag($form); ?>
547
					</div>            
474
                    </div>
548
					<div class="card-body">
475
                    <div class="card-body">
549
        	    		<table id="gridTable" class="table   table-hover">
476
                        <table id="gridTable" class="table   table-hover">
550
                      		<thead>
477
                            <thead>
551
        						<tr>
478
                            <tr>
552
                                	<th>LABEL_FIRST_NAME</th>
479
                                <th>LABEL_FIRST_NAME</th>
553
                                	<th>LABEL_LAST_NAME</th>
480
                                <th>LABEL_LAST_NAME</th>
554
                                	<th>LABEL_EMAIL</th>	
481
                                <th>LABEL_EMAIL</th>
555
                                  	<th>LABEL_ACTIONS</th>
482
                                <th>LABEL_ACTIONS</th>
556
                                </tr>
483
                            </tr>
557
                       		</thead>
484
                            </thead>
558
                         	<tbody>
485
                            <tbody>
559
                         	</tbody>
486
                            </tbody>
560
                    	</table>
487
                        </table>
-
 
488
                    </div>
-
 
489
                    <div class="card-footer clearfix">
561
                   	</div>
490
                        <div style="float:right;">
562
                       <div class="card-footer clearfix">
491
                            <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i>
-
 
492
                                LABEL_REFRESH
-
 
493
                            </button>
563
                       		<div style="float:right;">
494
                            <?php if ($allowAdd) : ?>
564
    							<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
495
                                <button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i>
565
    							<?php if($allowAdd) : ?>
496
                                    LABEL_ADD
566
    							<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
497
                                </button>
567
    							<?php endif; ?>
498
                            <?php endif; ?>
568
    						</div>
499
                        </div>
569
                     	</div>
500
                    </div>
570
          		</div>
501
                </div>
Línea 571... Línea 502...
571
           	</div>     
502
            </div>
572
        </div>          
503
        </div>
573
 	</div>
504
    </div>
574
</section> 
505
</section>
575
 
506
 
576
<!-- The Add Modal -->
507
<!-- The Add Modal -->
577
<div class="modal" tabindex="-1" role="dialog" id="add-candidate-box">
508
<div class="modal" tabindex="-1" role="dialog" id="add-candidate-box">
578
	<div class="modal-dialog" role="document">
509
    <div class="modal-dialog" role="document">
579
		<?php 
510
        <?php
580
	    //$form = $this->formA;
511
        //$form = $this->formA;
581
	    $form->setAttributes([
512
        $form->setAttributes([
582
	       'method'    => 'post',
513
            'method' => 'post',
583
	        'name'      => 'form-add',
514
            'name' => 'form-add',
584
            'action'    => $routeAdd,
515
            'action' => $routeAdd,
585
            'email'     => $routeEmail,
516
            'email' => $routeEmail,
586
	        'id'        => 'form-add'
517
            'id' => 'form-add'
587
	    ]);  
518
        ]);
588
	    $form->prepare();
519
        $form->prepare();
589
	    echo $this->form()->openTag($form);
520
        echo $this->form()->openTag($form);
590
	    
521
 
591
	    ?>
522
        ?>
592
    	<div class="modal-content">
523
        <div class="modal-content">
593
      		<div class="modal-header">
524
            <div class="modal-header">
594
        		<h3 class="modal-title">LABEL_NEW_CANDIDATE</h3>
525
                <h3 class="modal-title">LABEL_NEW_CANDIDATE</h3>
595
      		</div>
526
            </div>
596
      		<div class="modal-body">
527
            <div class="modal-body">
597
      			<div class="form-group">
528
                <div class="form-group">
598
    				<?php 
529
                    <?php
599
                        $element = $form->get('first_name');
530
                    $element = $form->get('first_name');
600
                        $element->setOptions(['label' => 'LABEL_FIRST_NAME']);
531
                    $element->setOptions(['label' => 'LABEL_FIRST_NAME']);
601
                        $element->setAttributes(['class' => 'form-control']); 
532
                    $element->setAttributes(['class' => 'form-control']);
602
                        echo $this->formLabel($element);
533
                    echo $this->formLabel($element);
603
                        echo $this->formText($element);
534
                    echo $this->formText($element);
604
                    ?>
535
                    ?>
605
				</div>
536
                </div>
606
				<div class="form-group">
537
                <div class="form-group">
607
    				<?php 
538
                    <?php
608
                        $element = $form->get('last_name');
539
                    $element = $form->get('last_name');
609
                        $element->setOptions(['label' => 'LABEL_LAST_NAME']);
540
                    $element->setOptions(['label' => 'LABEL_LAST_NAME']);
610
                        $element->setAttributes(['class' => 'form-control']); 
541
                    $element->setAttributes(['class' => 'form-control']);
611
                        echo $this->formLabel($element);
542
                    echo $this->formLabel($element);
612
                        echo $this->formText($element);
543
                    echo $this->formText($element);
613
                    ?>
544
                    ?>
614
				</div>
545
                </div>
615
      			<div class="form-group">
546
                <div class="form-group">
616
    				<?php 
547
                    <?php
617
                        $element = $form->get('email');
548
                    $element = $form->get('email');
618
                        $element->setOptions(['label' => 'LABEL_EMAIL']);
549
                    $element->setOptions(['label' => 'LABEL_EMAIL']);
619
                        $element->setAttributes(['class' => 'form-control']); 
550
                    $element->setAttributes(['class' => 'form-control']);
620
                        echo $this->formLabel($element);
551
                    echo $this->formLabel($element);
621
                        echo $this->formText($element);
552
                    echo $this->formText($element);
622
                    ?>
553
                    ?>
623
				</div>
554
                </div>
624
				
555
 
625
				<div class="form-group">
556
                <div class="form-group">
626
    				<?php 
557
                    <?php
627
                    $element = $form->get('file');
558
                    $element = $form->get('file');
628
                        
559
 
629
                    $element->setAttributes(['class' => 'form-control',  'accept' => 'pdf/docx']);
560
                    $element->setAttributes(['class' => 'form-control', 'accept' => 'pdf/docx']);
630
                    $element->setOptions(['label' => 'LABEL_CURRICULUM']);
561
                    $element->setOptions(['label' => 'LABEL_CURRICULUM']);
631
                    echo $this->formLabel($element);
562
                    echo $this->formLabel($element);
632
                    ?>
563
                    ?>
633
                    <div class="file-loading">
564
                    <div class="file-loading">
634
                    	<?php echo $this->formFile($element); ?>
565
                        <?php echo $this->formFile($element); ?>
635
                    </div>
566
                    </div>
636
				</div>
567
                </div>
637
          		<div class="form-group">
568
                <div class="form-group">
638
    				<?php 
569
                    <?php
639
                        $element = $form->get('status');
570
                    $element = $form->get('status');
640
                        $element->setAttributes(['class' => 'form-control']);
571
                    $element->setAttributes(['class' => 'form-control']);
641
                        $element->setOptions(['label' => 'LABEL_STATUS']);
572
                    $element->setOptions(['label' => 'LABEL_STATUS']);
642
                        echo $this->formLabel($element);
573
                    echo $this->formLabel($element);
643
                        echo $this->formSelect($element);
574
                    echo $this->formSelect($element);
644
                    ?>
575
                    ?>
645
				</div>
576
                </div>
646
          	</div>          	
577
            </div>
647
         	<div class="modal-footer">
578
            <div class="modal-footer">
648
    			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
579
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
649
    			<button type="email" class="btn btn-email">LABEL_CHECK_EMAIL</button>
580
                <button id="check-email" type="button" class="btn btn-primary">LABEL_CHECK_EMAIL</button>
650
    			<button type="button" class="btn btn-default btn-add-cancel">LABEL_CANCEL</button>
581
                <button type="button" class="btn btn-default btn-add-cancel">LABEL_CANCEL</button>
Línea 651... Línea 582...
651
          	</div>
582
            </div>
652
      	<?php echo $this->form()->closeTag($form); ?>	
583
            <?php echo $this->form()->closeTag($form); ?>
653
    	</div>
584
        </div>
654
	</div>
585
    </div>
655
</div>
586
</div>
656
 
587
 
657
<!-- The Edit Modal -->
588
<!-- The Edit Modal -->
658
<div class="modal" tabindex="-1" role="dialog" id="edit-candidate-box">
589
<div class="modal" tabindex="-1" role="dialog" id="edit-candidate-box">
659
	<div class="modal-dialog" role="document">
590
    <div class="modal-dialog" role="document">
660
		<?php 
591
        <?php
661
	    $form->setAttributes([
592
        $form->setAttributes([
662
	       'method'    => 'post',
593
            'method' => 'post',
663
	        'name'      => 'form-edit',
594
            'name' => 'form-edit',
664
	        'id'        => 'form-edit'
595
            'id' => 'form-edit'
665
	    ]);  
596
        ]);
666
	    $form->prepare();
597
        $form->prepare();
667
	    echo $this->form()->openTag($form);
598
        echo $this->form()->openTag($form);
668
	    
599
 
669
	    ?>
600
        ?>
670
    	<div class="modal-content">
601
        <div class="modal-content">
671
      		<div class="modal-header">
602
            <div class="modal-header">
672
        		<h3 class="modal-title">LABEL_CANDIDATE</h3>
603
                <h3 class="modal-title">LABEL_CANDIDATE</h3>
673
      		</div>
604
            </div>
674
      		<div class="modal-body">
605
            <div class="modal-body">
675
      			<div class="form-group">
606
                <div class="form-group">
676
    				<?php 
607
                    <?php
677
                        $element = $form->get('first_name');
608
                    $element = $form->get('first_name');
678
                        $element->setOptions(['label' => 'LABEL_FIRST_NAME']);
609
                    $element->setOptions(['label' => 'LABEL_FIRST_NAME']);
679
                        $element->setAttributes(['class' => 'form-control']); 
610
                    $element->setAttributes(['class' => 'form-control']);
680
                        echo $this->formLabel($element);
611
                    echo $this->formLabel($element);
681
                        echo $this->formText($element);
612
                    echo $this->formText($element);
682
                    ?>
613
                    ?>
683
				</div>
614
                </div>
684
				<div class="form-group">
615
                <div class="form-group">
685
    				<?php 
616
                    <?php
686
                        $element = $form->get('last_name');
617
                    $element = $form->get('last_name');
687
                        $element->setOptions(['label' => 'LABEL_LAST_NAME']);
618
                    $element->setOptions(['label' => 'LABEL_LAST_NAME']);
688
                        $element->setAttributes(['class' => 'form-control']); 
619
                    $element->setAttributes(['class' => 'form-control']);
689
                        echo $this->formLabel($element);
620
                    echo $this->formLabel($element);
690
                        echo $this->formText($element);
621
                    echo $this->formText($element);
691
                    ?>
622
                    ?>
692
				</div>
623
                </div>
693
      			<div class="form-group">
624
                <div class="form-group">
694
    				<?php 
625
                    <?php
695
                        $element = $form->get('email');
626
                    $element = $form->get('email');
696
                        $element->setOptions(['label' => 'LABEL_EMAIL']);
627
                    $element->setOptions(['label' => 'LABEL_EMAIL']);
697
                        $element->setAttributes(['class' => 'form-control']); 
628
                    $element->setAttributes(['class' => 'form-control']);
698
                        echo $this->formLabel($element);
629
                    echo $this->formLabel($element);
699
                        echo $this->formText($element);
630
                    echo $this->formText($element);
700
                    ?>
631
                    ?>
701
				</div>
632
                </div>
702
				
633
 
703
				<div class="form-group">
634
                <div class="form-group">
704
    				<?php 
635
                    <?php
705
                    $element = $form->get('file');
636
                    $element = $form->get('file');
706
                        
637
 
707
                    $element->setAttributes(['class' => 'form-control',  'accept' => 'pdf/docx']);
638
                    $element->setAttributes(['class' => 'form-control', 'accept' => 'pdf/docx']);
708
                    $element->setOptions(['label' => 'LABEL_CURRICULUM']);
639
                    $element->setOptions(['label' => 'LABEL_CURRICULUM']);
Línea 709... Línea 640...
709
                    echo $this->formLabel($element);
640
                    echo $this->formLabel($element);
710
                    ?>
641
                    ?>
711
                    <div class="file-loading">
642
                    <div class="file-loading">
712
                    	<?php echo $this->formFile($element); ?>
643
                        <?php echo $this->formFile($element); ?>
713
                    </div>
644
                    </div>
714
				</div>
645
                </div>
715
 
646
 
716
          		<div class="form-group">
647
                <div class="form-group">
717
    				<?php 
648
                    <?php
718
                        $element = $form->get('status');
649
                    $element = $form->get('status');
719
                        $element->setAttributes(['class' => 'form-control']);
650
                    $element->setAttributes(['class' => 'form-control']);
720
                        $element->setOptions(['label' => 'LABEL_STATUS']);
651
                    $element->setOptions(['label' => 'LABEL_STATUS']);
721
                        echo $this->formLabel($element);
652
                    echo $this->formLabel($element);
722
                        echo $this->formSelect($element);
653
                    echo $this->formSelect($element);
723
                    ?>
654
                    ?>
724
				</div>
655
                </div>
725
          	</div>          	
656
            </div>
726
         	<div class="modal-footer">
657
            <div class="modal-footer">