Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16841 | Rev 16845 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
16843 efrain 1
<?php
1 www 2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser    = $this->currentUserHelper();
4
$roleName       = $currentUser->getUserTypeId();
5
 
6
$routeAdd           = $this->url('jobs/add');
7
 
8
$routeDatatable   = $this->url('jobs');
9
 
10
$allowAdd = $acl->isAllowed($roleName, 'jobs/add') ? 1 : 0;
11
$allowDelete = $acl->isAllowed($roleName, 'jobs/delete') ? 1 : 0;
12
$allowEdit = $acl->isAllowed($roleName, 'jobs/edit') ? 1 : 0;
13
$allowUsersWhoApplied = $acl->isAllowed($roleName, 'jobs/users-who-applied') ? 1 : 0;
14
 
16822 efrain 15
 
16
 
17
$this->inlineScript()->appendFile('https://maps.googleapis.com/maps/api/js?key=' . $google_map_key . '&libraries=places');
18
 
16841 efrain 19
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));
20
$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.js'));
16822 efrain 21
 
16841 efrain 22
$this->inlineScript()->appendFile($this->basePath('assets/vendors/ckeditor/ckeditor.js'));
16822 efrain 23
 
24
 
16841 efrain 25
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-fileinput/css/fileinput.min.css'));
26
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fas/theme.css'));
16822 efrain 27
 
16843 efrain 28
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/piexif.js'));
29
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/sortable.js'));
16841 efrain 30
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/fileinput.js'));
31
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/locales/es.js'));
32
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/fas/theme.js'));
33
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fas/theme.js'));
16822 efrain 34
 
35
 
16841 efrain 36
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/jquery.validate.js'));
37
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/additional-methods.js'));
38
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/localization/messages_es.js'));
16822 efrain 39
 
16843 efrain 40
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.css'));
41
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.css'));
16822 efrain 42
 
16843 efrain 43
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net/jquery.dataTables.js'));
44
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.js'));
45
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/dataTables.responsive.min.js'));
46
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.min.js'));
16822 efrain 47
 
48
 
49
 
16841 efrain 50
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/select2/css/select2.min.css'));
51
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/select2-bootstrap4-theme/select2-bootstrap4.min.css'));
52
$this->inlineScript()->appendFile($this->basePath('assets/vendors/select2/js/select2.min.js'));
16822 efrain 53
 
54
 
16841 efrain 55
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-input-number/input-number-format.jquery.min.js'));
16822 efrain 56
 
57
 
58
 
16841 efrain 59
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
60
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
11128 stevensc 61
 
16841 efrain 62
$this->inlineScript()->appendFile($this->basePath('assets/vendors/moment/moment-with-locales.min.js'));
63
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css'));
64
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js'));
16822 efrain 65
 
66
 
11128 stevensc 67
$this->headStyle()->captureStart();
68
echo <<<CSS
69
 
16822 efrain 70
 
11128 stevensc 71
#gridTableUsersWhoApplied {
72
    display: flex;
73
    flex-flow: column;
74
    width: 100%;
75
}
76
 
77
#gridTableUsersWhoApplied thead {
78
    flex: 0 0 auto;
79
}
80
 
81
#gridTableUsersWhoApplied tbody {
82
    flex: 1 1 auto;
83
    display: block;
84
    overflow-y: auto;
85
    overflow-x: hidden;
86
}
87
 
88
#gridTableUsersWhoApplied tr {
89
    width: 100%;
90
    display: table;
91
    table-layout: fixed;
92
}
93
CSS;
94
$this->headStyle()->captureEnd();
95
 
16822 efrain 96
$this->inlineScript()->captureStart();
97
echo <<<JS
98
jQuery( document ).ready(function( $ ) {
99
       var route_status = '';
100
       var route_title =  '';
101
       var route_extended =  '';
102
       var route_location =  '';
103
       var route_job_category =  '';
104
       var route_employment_type =  '';
105
       var route_salary =  '';
106
       var route_experience = '';
107
       var route_languages =  '';
108
       var route_degrees = '';
109
       var route_skills =  '';
110
       var route_last_date_of_application =  '';
111
 
11139 stevensc 112
 
14162 stevensc 113
 
16822 efrain 114
        var allowDelete = $allowDelete;
115
        var allowEdit = $allowEdit;
116
        var allowUsersWhoApplied = $allowUsersWhoApplied;
117
 
118
        var gridTable = $('#gridTable').dataTable( {
119
            'processing': true,
120
            'serverSide': true,
121
            'searching': true,
122
            'order': [[ 0, 'desc' ]],
123
            'ordering':  true,
124
            'ordenable' : true,
125
            'responsive': true,
126
            'select' : false,
127
        	'paging': true,
128
            'pagingType': 'simple_numbers',
1 www 129
 
16822 efrain 130
    		'ajax': {
131
    			'url' : '$routeDatatable',
132
    			'type' : 'get',
133
                'beforeSend': function (request) {
134
                  NProgress.start();
135
                },
136
                'dataFilter': function(response) {
137
                    var response = jQuery.parseJSON( response );
138
 
139
                    var json                = {};
140
                    json.recordsTotal       = 0;
141
                    json.recordsFiltered    = 0;
142
                    json.data               = [];
143
 
144
                    if(response.success) {
145
                        json.recordsTotal       = response.data.total;
146
                        json.recordsFiltered    = response.data.total;
147
                        json.data               = response.data.items;
148
                    } else {
149
                        $.fn.showError(response.data)
150
                    }
151
 
152
                    return JSON.stringify( json );
153
                }
154
    		},
155
            'language' : {
156
                'sProcessing':     'LABEL_DATATABLE_SPROCESSING',
157
                'sLengthMenu':     'LABEL_DATATABLE_SLENGTHMENU',
158
                'sZeroRecords':    'LABEL_DATATABLE_SZERORECORDS',
159
                'sEmptyTable':     'LABEL_DATATABLE_SEMPTYTABLE',
160
                'sInfo':           'LABEL_DATATABLE_SINFO',
161
                'sInfoEmpty':      'LABEL_DATATABLE_SINFOEMPTY',
162
                'sInfoFiltered':   'LABEL_DATATABLE_SINFOFILTERED',
163
                'sInfoPostFix':    '',
164
                'sSearch':         'LABEL_DATATABLE_SSEARCH',
165
                'sUrl':            '',
166
                'sInfoThousands':  ',',
167
                'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
168
                'oPaginate': {
169
                    'sFirst':    'LABEL_DATATABLE_SFIRST',
170
                    'sLast':     'LABEL_DATATABLE_SLAST',
171
                    'sNext':     'LABEL_DATATABLE_SNEXT',
172
                    'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
173
                },
174
                'oAria': {
175
                    'sSortAscending':  ': LABEL_DATATABLE_SSORTASCENDING',
176
                    'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
177
                },
178
            },
179
            'drawCallback': function( settings ) {
180
                NProgress.done();
181
 
182
            },
183
            'aoColumns': [
184
                { 'mDataProp': 'last_date_of_application' },
185
                { 'mDataProp': 'title' },
186
                { 'mDataProp': 'details' },
187
                { 'mDataProp': 'actions' },
188
    	    ],
189
            'columnDefs': [
14162 stevensc 190
 
16822 efrain 191
                {
192
                    'targets': -2,
193
                    'orderable': false,
194
                    'render' : function ( data, type, row ) {
195
                        var s = 'LABEL_STATUS : ' + row['details']['status'] + '<br>';
196
                        s = s + 'LABEL_EMPLOYMENT_TYPE : <br>' + row['details']['employment_type'] + '<br>';
197
                        s = s +  'LABEL_QTY_USERS_WHO_APPLIED : ' + row['details']['users_who_applied'] + '<br>';
198
 
199
                        return s;
200
                    }
201
                },
202
 
203
                {
204
                    'targets': -1,
205
                    'orderable': false,
206
                    'render' : function ( data, type, row ) {
207
                        s = '';
208
 
209
                        if(allowEdit && data['link_edit']  ) {
210
                            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-pencil"></i> LABEL_EDIT </button><br>';
211
                        }
212
                        if(allowDelete && data['link_delete']  ) {
213
                            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>';
214
                        }
215
                        if(allowUsersWhoApplied && data['link_users_who_applied']  ) {
216
                            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>';
217
                        }
218
 
219
                        return s;
220
                    }
221
                }
222
              ],
223
        });
224
 
225
    $.validator.addMethod('greaterThanFloat', function (value, element, param) {
226
        var otherElement = $(param);
227
        return parseFloat(value) > parseFloat(otherElement.val());
228
    }, 'ERROR_INVALID_MINIMUM');
229
 
230
 
231
 
232
    $.validator.addMethod('greaterThan', function (value, element, param) {
233
        var otherElement = $(param);
234
        return parseInt(value, 10) > parseInt(otherElement.val(), 10);
235
    }, 'ERROR_INVALID_MINIMUM');
236
 
237
 
238
    $.validator.addMethod('checkLocation', function (value, element, param) {
239
        var otherElement = $(param);
240
 
241
        return $.trim(otherElement.val()).length > 0;
242
    }, 'ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY');
243
 
244
    var autocompleteLocation = new google.maps.places.Autocomplete(
245
        (document.getElementById('location_search')),
246
        {types: ['(cities)']}
247
    );
248
 
249
    $.fn.fillInAddressLocation = function() {
250
 
251
        var place = autocompleteLocation.getPlace();
252
        if (!place.geometry) {
253
            $.fn.showError('ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY')
254
            return;
255
        } else {
256
            address1 = '';
257
            address2 = '';
258
            city1 = '';
259
            city2 = '';
260
            state = '';
261
            country = '';
262
            postal_code = '';
263
 
264
            formatted_address = place.formatted_address;
265
            latitude = place.geometry.location.lat();
266
            longitude = place.geometry.location.lng();
267
            var arrAddress = place.address_components;
268
 
269
            $.each(arrAddress, function(i, address_component) {
270
                if (address_component.types[0] == "route") {
271
                    address1 = address_component.long_name;
272
                }
273
                if (address_component.types[0] == "sublocality") {
274
                    address2 = address_component.long_name;
275
                }
276
                if (address_component.types[0] == "locality") {
277
                    city1 = address_component.long_name;
278
                }
279
                if (address_component.types[0] == "administrative_area_level_2") {
280
                    city2 = address_component.long_name;
281
                }
282
                if (address_component.types[0] == "administrative_area_level_1") {
283
                    state = address_component.long_name;
284
                }
285
                if (address_component.types[0] == "country") {
286
                    country = address_component.long_name;
287
                }
288
                if (address_component.types[0] == "postal_code") {
289
                    postal_code = address_component.long_name;
290
                }
291
            });
292
 
293
            $('#form-location #formatted_address').val(formatted_address);
294
            $('#form-location #address1').val(address1);
295
            $('#form-location #address2').val(address2);
296
            $('#form-location #city1').val(city1);
297
            $('#form-location #city2').val(city2);
298
            $('#form-location #state').val(state);
299
            $('#form-location #country').val(country);
300
            $('#form-location #postal_code').val(postal_code);
301
            $('#form-location #latitude').val(latitude);
302
            $('#form-location #longitude').val(longitude);
303
        }
304
    }
305
 
306
 
307
    var autocompleteLocationNew = new google.maps.places.Autocomplete(
308
        (document.getElementById('add_location_search')),
309
        {types: ['(cities)']}
310
    );
311
 
312
    $.fn.fillInAddressNewLocation = function() {
313
 
314
 
315
        var place = autocompleteLocationNew.getPlace();
316
        if (!place.geometry) {
317
            $.fn.showError('ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY')
318
            return;
319
        } else {
320
            address1 = '';
321
            address2 = '';
322
            city1 = '';
323
            city2 = '';
324
            state = '';
325
            country = '';
326
            postal_code = '';
327
 
328
            formatted_address = place.formatted_address;
329
            latitude = place.geometry.location.lat();
330
            longitude = place.geometry.location.lng();
331
            var arrAddress = place.address_components;
332
 
333
            $.each(arrAddress, function(i, address_component) {
334
                if (address_component.types[0] == "route") {
335
                    address1 = address_component.long_name;
336
                }
337
                if (address_component.types[0] == "sublocality") {
338
                    address2 = address_component.long_name;
339
                }
340
                if (address_component.types[0] == "locality") {
341
                    city1 = address_component.long_name;
342
                }
343
                if (address_component.types[0] == "administrative_area_level_2") {
344
                    city2 = address_component.long_name;
345
                }
346
                if (address_component.types[0] == "administrative_area_level_1") {
347
                    state = address_component.long_name;
348
                }
349
                if (address_component.types[0] == "country") {
350
                    country = address_component.long_name;
351
                }
352
                if (address_component.types[0] == "postal_code") {
353
                    postal_code = address_component.long_name;
354
                }
355
            });
356
 
357
            $('#form-add #formatted_address').val(formatted_address);
358
            $('#form-add #address1').val(address1);
359
            $('#form-add #address2').val(address2);
360
            $('#form-add #city1').val(city1);
361
            $('#form-add #city2').val(city2);
362
            $('#form-add #state').val(state);
363
            $('#form-add #country').val(country);
364
            $('#form-add #postal_code').val(postal_code);
365
            $('#form-add #latitude').val(latitude);
366
            $('#form-add #longitude').val(longitude);
367
        }
368
    }
369
 
370
 
371
    $.validator.setDefaults({
372
        debug: true,
373
        highlight: function(element) {
374
            $(element).addClass('is-invalid');
375
        },
376
        unhighlight: function(element) {
377
            $(element).removeClass('is-invalid');
378
        },
379
        errorElement: 'span',
380
        errorClass: 'error invalid-feedback',
381
        errorPlacement: function(error, element) {
382
            if(element.parent('.form-group').length) {
383
                error.insertAfter(element);
384
            } else if(element.parent('.toggle').length) {
385
                error.insertAfter(element.parent().parent());
386
            } else {
387
                error.insertAfter(element.parent());
388
            }
389
        }
390
    });
391
 
392
 
393
 
394
    $.fn.showFormErrorValidator = function(fieldname, errors) {
395
        var field = $(fieldname);
396
        if(field) {
397
            $(field).addClass('form-group-has-error');
398
 
399
            var error = $('<div id="' + fieldname +'-error" class="form-group-invalid-feedback">' + errors + '</div>');
400
            if(field.parent('.form-group').length) {
401
                error.insertAfter(field.parent());
402
            } else {
403
                error.insertAfter(field);
404
            }
405
        }
406
    };
407
 
408
    var validatorAdd = $('#form-add').validate({
409
        debug: true,
410
        onclick: false,
411
        onkeyup: false,
412
        onfocusout: false,
413
        ignore: [],
414
        rules: {
415
            'name': {
416
                required: true,
417
                maxlength: 128,
418
            },
419
            'title': {
420
                required: true,
421
            },
422
            'last_date_of_application': {
423
                required: true,
424
            },
425
            'job_category_id' :  {
426
                required: true,
427
            },
428
            'employment_type' : {
429
                required: true,
430
            },
431
            'add_location_search': {
432
                required: true,
433
                checkLocation: '#form-add #latitude'
434
            }
435
        },
436
        submitHandler: function(form)
437
        {
438
            NProgress.start();
439
            $.ajax({
440
                'dataType'  : 'json',
441
                'accept'    : 'application/json',
442
                'method'    : 'post',
443
                'url'       :  '$routeAdd',
444
                'data'      :  $('#form-add').serialize(),
445
            }).done(function(response) {
446
                if(response['success']) {
447
                    $('#add-job-box').modal('hide');
448
                    gridTable.api().ajax.reload(null, false);
449
 
450
                    $('#overview-title').html(response['data']['title']);
451
                    $('#overview-job-category').html(response['data']['job_category']);
452
					$('#overview-last-date-of-application').html(response['data']['last_date_of_application']);
453
					$('#overview-employment-type').html(response['data']['employment_type']);
454
                    $('#overview-location').html(response['data']['location']);
455
 
456
                    $('#overview-status').html(response['data']['status']);
457
                    $('#overview-description').html(response['data']['description']);
458
 
459
                    $('#overview-salary').html(response['data']['salary']);
460
                    $('#overview-experience').html('')
461
 
462
 
463
 
464
 
465
 
466
                    $('list-skills').empty();
467
                    $('list-languages').empty();
468
                    $('list-degrees').empty();
469
 
470
 
471
                    route_status = response['data']['route_status'];
472
                    route_title =  response['data']['route_title'];
473
                    route_extended =  response['data']['route_extended'];
474
                    route_location =  response['data']['route_location'];
475
                    route_job_category =  response['data']['route_job_category'];
476
                    route_employment_type =  response['data']['route_employment_type'];
477
                    route_salary =  response['data']['route_salary'];
478
                    route_experience = response['data']['route_experience'];
479
                    route_languages =  response['data']['route_languages'];
480
                    route_degrees = response['data']['route_degrees'];
481
                    route_skills =  response['data']['route_skills'];
482
                    route_last_date_of_application =  response['data']['route_last_date_of_application'];
483
 
484
                    $('#divListing').hide();
485
                    $('#divEdit').show();
486
 
487
                } else {
488
                    validatorAdd.resetForm();
489
                    if(jQuery.type(response['data']) == 'string') {
490
                        $.fn.showError(response['data']);
491
                    } else  {
492
                        $.each(response['data'], function( fieldname, errors ) {
493
                            $.fn.showFormErrorValidator('#form-add #' + fieldname, errors);
494
                        });
495
                    }
496
                }
497
            }).fail(function( jqXHR, textStatus, errorThrown) {
498
                $.fn.showError(textStatus);
499
            }).always(function() {
500
                NProgress.done();
501
            });
502
            return false;
503
        },
504
        invalidHandler: function(form, validator) {
505
 
506
        }
507
    });
508
 
509
    $('body').on('click', 'button.btn-edit', function(e) {
510
        e.preventDefault();
511
 
512
        var href = $(this).data('href');
513
 
514
        NProgress.start();
515
            $.ajax({
516
                'dataType'  : 'json',
517
                'accept'    : 'application/json',
518
                'method'    : 'get',
519
                'url'       :  href,
520
            }).done(function(response) {
521
                if(response['success']) {
522
                    $('#add-job-box').modal('hide');
523
                    gridTable.api().ajax.reload(null, false);
524
 
525
                    $('#overview-title').html(response['data']['title']);
526
                    $('#overview-job-category').html(response['data']['job_category']);
527
					$('#overview-last-date-of-application').html(response['data']['last_date_of_application']);
528
					$('#overview-employment-type').html(response['data']['employment_type']);
529
                    $('#overview-location').html(response['data']['location']);
530
 
531
                    $('#overview-status').html(response['data']['status']);
532
                    $('#overview-description').html(response['data']['description']);
533
 
534
 
535
                    if(response['data']['salary']) {
536
					   $('#overview-salary').html(response['data']['salary']);
537
                    } else {
538
                       $('#overview-salary').html('')
539
                    }
540
 
541
                    if(response['data']['experience']) {
542
					   $('#overview-experience').html(response['data']['experience'] + ' LABEL_YEARS');
543
                    } else {
544
                       $('#overview-experience').html('')
545
                    }
546
 
547
 
548
 
549
                    $('#list-skills').empty();
550
                    $.each(response['data']['skills'], function(i, name) {
551
                        $('#list-skills').append('<li>' + name + '</li>');
552
                    });
553
 
554
                    $('#list-languages').empty();
555
                    $.each(response['data']['languages'], function(i, name) {
556
                        $('#list-languages').append('<li>' + name + '</li>');
557
                    });
558
 
559
                    $('#list-degrees').empty();
560
                    $.each(response['data']['degrees'], function(i, name) {
561
                        $('#list-degrees').append('<li>' + name + '</li>');
562
                    });
563
 
564
 
565
                    route_status =  response['data']['route_status'];
566
                    route_title =   response['data']['route_title'];
567
                    route_extended =   response['data']['route_extended'];
568
                    route_location =   response['data']['route_location'];
569
                    route_job_category =   response['data']['route_job_category'];
570
                    route_employment_type =   response['data']['route_employment_type'];
571
                    route_salary =   response['data']['route_salary'];
572
                    route_experience =  response['data']['route_experience'];
573
                    route_languages =   response['data']['route_languages'];
574
                    route_degrees =  response['data']['route_degrees'];
575
                    route_skills =   response['data']['route_skills'];
576
                    route_last_date_of_application =   response['data']['route_last_date_of_application'];
577
 
578
 
579
                    $('#divListing').hide();
580
                    $('#divEdit').show();
581
 
582
                } else {
583
                    validatorAdd.resetForm();
584
                    if(jQuery.type(response['data']) == 'string') {
585
                        $.fn.showError(response['data']);
586
                    } else  {
587
                        $.each(response['data'], function( fieldname, errors ) {
588
                            $.fn.showFormErrorValidator('#form-add #' + fieldname, errors);
589
                        });
590
                    }
591
                }
592
            }).fail(function( jqXHR, textStatus, errorThrown) {
593
                $.fn.showError(textStatus);
594
            }).always(function() {
595
                NProgress.done();
596
            });
597
            return false;
598
    });
599
 
600
 
601
 
602
    $(".close-box, .btn-add-job-cancel").on("click", function(e){
603
        e.preventDefault();
604
        $('#add-job-box').modal('hide');
605
        return false;
606
    });
607
 
608
    $('body').on('click', 'button.btn-add', function(e) {
609
        e.preventDefault();
610
 
611
 
612
        $('#form-add #title').val('');
613
        $('#form-add #last_date_of_application').val('');
614
        $('#form-add #employment_type').val('').trigger('change');
615
        $('#form-add #job_category_id').val('').trigger('change');
616
        $('#form-add #formatted_address').val('');
617
        $('#form-add #address1').val('');
618
        $('#form-add #address2').val('');
619
        $('#form-add #country').val('');
620
        $('#form-add #state').val('');
621
        $('#form-add #city1').val('');
622
        $('#form-add #city2').val('');
623
        $('#form-add #postal_code').val('');
624
        $('#form-add #latitude').val('');
625
        $('#form-add #longitude').val('');
626
        $('#form-add #add_location_search').val('');
627
        validatorAdd.resetForm();
628
 
629
        $('#add-job-box').modal('show');
630
        return false;
631
    });
632
 
633
    $('#form-add #last_date_of_application').datetimepicker({
634
        //viewMode: 'years',
635
        locale: 'es',
636
        format: 'DD/MM/YYYY'
637
    });
638
 
639
 
640
    $('body').on('click', 'button.btn-view-profile', function(e) {
641
        e.preventDefault();
642
 
643
        var href = $(this).data('href');
644
        window.open(href, '_blank');
645
 
646
    });
647
 
648
    $('body').on('click', 'button.btn-users-who-applied', function(e) {
649
        e.preventDefault();
650
 
651
        var href = $(this).data('href');
652
        NProgress.start();
653
        $.ajax({
654
            'dataType'  : 'json',
655
            'accept'    : 'application/json',
656
            'method'    : 'get',
657
            'url'       :  href
658
        }).done(function(response) {
659
            if(response['success']) {
660
                $('#gridTableUsersWhoApplied tbody').empty();
661
                $.each(response['data'], function(i, record) {
662
                    var s = '<tr>';
663
                    s = s + '<td>' + record['first_name'] + '</td>';
664
                    s = s + '<td>' + record['last_name'] + '</td>';
665
                    s = s + '<td>' + record['email'] + '</td>';
666
                    s = s + '<td><button class="btn btn-default btn-view-profile" data-href="' + record['link_view']+ '"><i class="fa fa-external-link"></i></button></td>';
667
                    s = s + '<tr>';
668
 
669
                    $('#gridTableUsersWhoApplied tbody').append(s);
670
 
671
                });
672
 
673
 
674
                $('#modalUsersWhoApplied').modal('show');
675
            } else {
676
                $.fn.showError(response['data']);
677
 
678
            }
679
        }).fail(function( jqXHR, textStatus, errorThrown) {
680
            $.fn.showError(textStatus);
681
        }).always(function() {
682
            NProgress.done();
683
        });
684
        return false;
685
 
686
    });
687
 
688
 var validatorLocation = $('#form-location').validate({
689
        debug: true,
690
        onclick: false,
691
        onkeyup: false,
692
        onfocusout: false,
693
        ignore: [],
694
        rules: {
695
            'location_search': {
696
                required: true,
697
                checkLocation: '#form-location #latitude'
698
            }
699
        },
700
        submitHandler: function(form)
701
        {
702
            NProgress.start();
703
            $.ajax({
704
                'dataType'  : 'json',
705
                'accept'    : 'application/json',
706
                'method'    : 'post',
707
                'url'       :  route_location,
708
                'data'      :  $('#form-location').serialize(),
709
            }).done(function(response) {
710
 
711
 
712
 
713
                if(response['success']) {
714
                    $('#overview-location').html(response.data);
715
                    $("#location-box").modal('hide');
716
                } else {
717
                    validatorLocation.resetForm();
718
                    $.fn.showError(response['data']);
719
                }
720
            }).fail(function( jqXHR, textStatus, errorThrown) {
721
                $.fn.showError(textStatus);
722
            }).always(function() {
723
                NProgress.done();
724
            });
725
            return false;
726
        },
727
        invalidHandler: function(form, validator) {
728
 
729
        }
730
    });
731
 
732
 
733
    $('body').on('click', 'a.btn-location-edit', function(e) {
734
        e.preventDefault();
735
 
736
        $('#form-location #location_search').val('');
737
        $('#form-location #formatted_address').val('');
738
        $('#form-location #address1').val('');
739
        $('#form-location #address2').val('');
740
        $('#form-location #country').val('');
741
        $('#form-location #state').val('');
742
        $('#form-location #city1').val('');
743
        $('#form-location #city2').val('');
744
        $('#form-location #postal_code').val('');
745
        $('#form-location #latitude').val('');
746
        $('#form-location #longitude').val('');
747
        validatorLocation.resetForm();
748
 
749
        $("#location-box").modal('show');
750
    });
751
 
752
    $('.btn-location-close').on("click", function(e){
753
        e.preventDefault();
754
 
755
        $("#location-box").modal('hide');
756
        return false;
757
    });
758
 
759
 
760
 
761
 
762
    var validatorLastDateOfApplication = $('#form-last-date-of-application').validate({
763
        debug: true,
764
        onclick: false,
765
        onkeyup: false,
766
        onfocusout: false,
767
        ignore: [],
768
        rules: {
769
            'last_date_of_application': {
770
                required: true,
771
            },
772
        },
773
 
774
        submitHandler: function(form)
775
        {
776
            NProgress.start();
777
            $.ajax({
778
                'dataType'  : 'json',
779
                'accept'    : 'application/json',
780
                'method'    : 'post',
781
                'url'       :  route_last_date_of_application,
782
                'data'      :  $('#form-last-date-of-application').serialize()
783
            }).done(function(response) {
784
                if(response['success']) {
785
 
786
                    $('#overview-last-date-of-application').html(response['data']);
787
                    $("#last-date-of-application-box").modal('hide');
788
                } else {
789
                    validatorLastDateOfApplication.resetForm();
790
                    if(jQuery.type(response['data']) == 'string') {
791
                        $.fn.showError(response['data']);
792
                    } else  {
793
                        $.each(response['data'], function( fieldname, errors ) {
794
                            $.fn.showFormErrorValidator('#form-last-date-of-application #' + fieldname, errors);
795
                        });
796
                    }
797
                }
798
            }).fail(function( jqXHR, textStatus, errorThrown) {
799
                $.fn.showError(textStatus);
800
            }).always(function() {
801
                NProgress.done();
802
            });
803
            return false;
804
        },
805
        invalidHandler: function(form, validator) {
806
 
807
        }
808
    });
809
 
810
 
811
    $('.btn-last-date-of-application-edit').on("click", function(e){
812
        e.preventDefault();
813
 
814
        NProgress.start();
815
        $.ajax({
816
            'dataType'  : 'json',
817
            'accept'    : 'application/json',
818
            'method'    : 'get',
819
            'url'       : route_last_date_of_application,
820
        }).done(function(response) {
821
           if(response['success']) {
822
                $('#form-last-date-of-application #last_date_of_application').val(response['data']);
823
                validatorLastDateOfApplication.resetForm();
824
 
825
                $("#last-date-of-application-box").modal('show');
826
            } else {
827
                $.fn.showError(response['data']);
828
            }
829
        }).fail(function( jqXHR, textStatus, errorThrown) {
830
            $.fn.showError(textStatus);
831
        }).always(function() {
832
            NProgress.done();
833
        });
834
        return false;
835
 
836
    });
837
 
838
    $('.btn-last-date-of-application-close').on("click", function(e){
839
        e.preventDefault();
840
 
841
        $("#last-date-of-application-box").modal('hide');
842
        return false;
843
    });
844
 
845
 
846
    var validatorExtended = $('#form-extended').validate({
847
        debug: true,
848
        onclick: false,
849
        onkeyup: false,
850
        onfocusout: false,
851
        ignore: [],
852
        rules: {
853
            'description': {
854
                updateCkeditor:function() {
855
                        CKEDITOR.instances.description.updateElement();
856
                },
857
                required: false,
858
            },
859
        },
860
 
861
        submitHandler: function(form)
862
        {
863
            NProgress.start();
864
            $.ajax({
865
                'dataType'  : 'json',
866
                'accept'    : 'application/json',
867
                'method'    : 'post',
868
                'url'       :  route_extended,
869
                'data'      :  $('#form-extended').serialize()
870
            }).done(function(response) {
871
                if(response['success']) {
872
 
873
                    $('#overview-description').html(response['data']['description']);
874
                    $("#extended-box").modal('hide');
875
                } else {
876
                    validatorExtended.resetForm();
877
                    if(jQuery.type(response['data']) == 'string') {
878
                        $.fn.showError(response['data']);
879
                    } else  {
880
                        $.each(response['data'], function( fieldname, errors ) {
881
                            $.fn.showFormErrorValidator('#form-extended #' + fieldname, errors);
882
                        });
883
                    }
884
                }
885
            }).fail(function( jqXHR, textStatus, errorThrown) {
886
                $.fn.showError(textStatus);
887
            }).always(function() {
888
                NProgress.done();
889
            });
890
            return false;
891
        },
892
        invalidHandler: function(form, validator) {
893
 
894
        }
895
    });
896
 
897
 
898
    $('.btn-extended-edit').on("click", function(e){
899
        e.preventDefault();
900
 
901
        NProgress.start();
902
        $.ajax({
903
            'dataType'  : 'json',
904
            'accept'    : 'application/json',
905
            'method'    : 'get',
906
            'url'       : route_extended,
907
        }).done(function(response) {
908
           if(response['success']) {
909
                CKEDITOR.instances.description.setData(response['data']['description']);
910
                validatorExtended.resetForm();
911
 
912
                $("#extended-box").modal('show');
913
            } else {
914
                $.fn.showError(response['data']);
915
            }
916
        }).fail(function( jqXHR, textStatus, errorThrown) {
917
            $.fn.showError(textStatus);
918
        }).always(function() {
919
            NProgress.done();
920
        });
921
        return false;
922
 
923
    });
924
 
925
    $('.btn-extended-close').on("click", function(e){
926
        e.preventDefault();
927
 
928
        $("#extended-box").modal('hide');
929
        return false;
930
    });
931
 
932
 
933
    var validatorJobCategory = $('#form-job-category').validate({
934
        debug: true,
935
        onclick: false,
936
        onkeyup: false,
937
        ignore: [],
938
        rules: {
939
            'job-category_id': {
940
                required: false,
941
                digits: true
942
            },
943
        },
944
        submitHandler: function(form)
945
        {
946
            NProgress.start();
947
            $.ajax({
948
                'dataType'  : 'json',
949
                'accept'    : 'application/json',
950
                'method'    : 'post',
951
                'url'       :  route_job_category,
952
                'data'      :  $('#form-job-category').serialize()
953
            }).done(function(response) {
954
                if(response['success']) {
955
					$('#overview-job-category').html(response['data']);
956
                    $("#job-category-box").modal('hide');
957
                } else {
958
                    validatorJobCategory.resetForm();
959
                    if(jQuery.type(response['data']) == 'string') {
960
                        $.fn.showError(response['data']);
961
                    } else  {
962
                        $.each(response['data'], function( fieldname, errors ) {
963
                            $.fn.showFormErrorValidator('#form-job-category #' + fieldname, errors);
964
                        });
965
                    }
966
                }
967
            }).fail(function( jqXHR, textStatus, errorThrown) {
968
                $.fn.showError(textStatus);
969
            }).always(function() {
970
                NProgress.done();
971
            });
972
            return false;
973
        },
974
        invalidHandler: function(form, validator) {
975
 
976
        }
977
    });
978
 
979
    $('.btn-job-category-edit').on("click", function(e){
980
        e.preventDefault();
981
 
982
        NProgress.start();
983
        $.ajax({
984
            'dataType'  : 'json',
985
            'accept'    : 'application/json',
986
            'method'    : 'get',
987
            'url'       : route_job_category,
988
        }).done(function(response) {
989
           if(response['success']) {
990
                $('#form-job-category #job_category_id').val(response['data']).trigger('change');
991
                validatorJobCategory.resetForm();
992
                $("#job-category-box").modal('show');
993
            } else {
994
                $.fn.showError(response['data']);
995
            }
996
        }).fail(function( jqXHR, textStatus, errorThrown) {
997
            $.fn.showError(textStatus);
998
        }).always(function() {
999
            NProgress.done();
1000
        });
1001
        return false;
1002
 
1003
    });
1004
 
1005
    $('.btn-job-category-close').on("click", function(e){
1006
        e.preventDefault();
1007
 
1008
        $("#job-category-box").modal('hide');
1009
        return false;
1010
    });
1011
 
1012
 
1013
 
1014
    var validatorEmploymentType = $('#form-employment-type').validate({
1015
        debug: true,
1016
        onclick: false,
1017
        onkeyup: false,
1018
        ignore: [],
1019
        rules: {
1020
            'employment_type': {
1021
                required: false,
1022
            },
1023
        },
1024
        submitHandler: function(form)
1025
        {
1026
            NProgress.start();
1027
            $.ajax({
1028
                'dataType'  : 'json',
1029
                'accept'    : 'application/json',
1030
                'method'    : 'post',
1031
                'url'       :  route_employment_type,
1032
                'data'      :  $('#form-employment-type').serialize()
1033
            }).done(function(response) {
1034
                if(response['success']) {
1035
					$('#overview-employment-type').html(response['data']);
1036
                    $("#employment-type-box").modal('hide');
1037
                } else {
1038
                    validatorEmploymentType.resetForm();
1039
                    if(jQuery.type(response['data']) == 'string') {
1040
                        $.fn.showError(response['data']);
1041
                    } else  {
1042
                        $.each(response['data'], function( fieldname, errors ) {
1043
                            $.fn.showFormErrorValidator('#form-employment-type #' + fieldname, errors);
1044
                        });
1045
                    }
1046
                }
1047
            }).fail(function( jqXHR, textStatus, errorThrown) {
1048
                $.fn.showError(textStatus);
1049
            }).always(function() {
1050
                NProgress.done();
1051
            });
1052
            return false;
1053
        },
1054
        invalidHandler: function(form, validator) {
1055
 
1056
        }
1057
    });
1058
 
1059
    $('.btn-employment-type-edit').on("click", function(e){
1060
        e.preventDefault();
1061
 
1062
        NProgress.start();
1063
        $.ajax({
1064
            'dataType'  : 'json',
1065
            'accept'    : 'application/json',
1066
            'method'    : 'get',
1067
            'url'       : route_employment_type,
1068
        }).done(function(response) {
1069
           if(response['success']) {
1070
                $('#form-employment-type #employment_type').val(response['data']).trigger('change');
1071
                validatorEmploymentType.resetForm();
1072
                $("#employment-type-box").modal('show');
1073
            } else {
1074
                $.fn.showError(response['data']);
1075
            }
1076
        }).fail(function( jqXHR, textStatus, errorThrown) {
1077
            $.fn.showError(textStatus);
1078
        }).always(function() {
1079
            NProgress.done();
1080
        });
1081
        return false;
1082
 
1083
    });
1084
 
1085
    $('.btn-employment-type-close').on("click", function(e){
1086
        e.preventDefault();
1087
 
1088
        $("#employment-type-box").modal('hide');
1089
        return false;
1090
    });
1091
 
1092
    var validatorSalary = $('#form-salary').validate({
1093
        debug: true,
1094
        onclick: false,
1095
        onkeyup: false,
1096
        ignore: [],
1097
        rules: {
1098
            'salary_visible': {
1099
                required: false,
1100
            },
1101
            'salary_min': {
1102
                required:  '#form-salary #salary_visible:checked',
1103
                number: true,
1104
                maxlength: 10,
1105
            },
1106
            'salary currency': {
1107
                required:  '#form-salary #salary_visible:checked',
1108
                maxlength: 5,
1109
            },
1110
            'salary_max': {
1111
                required:  '#form-salary #salary_visible:checked',
1112
                number: true,
1113
                maxlength: 10,
1114
                greaterThanFloat : '#form-salary #salary_min',
1115
            },
1116
        },
1117
        submitHandler: function(form)
1118
        {
1119
            NProgress.start();
1120
            $.ajax({
1121
                'dataType'  : 'json',
1122
                'accept'    : 'application/json',
1123
                'method'    : 'post',
1124
                'url'       :  route_salary,
1125
                'data'      :  $('#form-salary').serialize()
1126
            }).done(function(response) {
1127
                if(response['success']) {
1128
					$('#overview-salary').html(response['data']);
1129
                    $("#salary-box").modal('hide');
1130
                } else {
1131
                    validatorSalary.resetForm();
1132
                    if(jQuery.type(response['data']) == 'string') {
1133
                        $.fn.showError(response['data']);
1134
                    } else  {
1135
                        $.each(response['data'], function( fieldname, errors ) {
1136
                            $.fn.showFormErrorValidator('#form-salary #' + fieldname, errors);
1137
                        });
1138
                    }
1139
                }
1140
            }).fail(function( jqXHR, textStatus, errorThrown) {
1141
                $.fn.showError(textStatus);
1142
            }).always(function() {
1143
                NProgress.done();
1144
            });
1145
            return false;
1146
        },
1147
        invalidHandler: function(form, validator) {
1148
 
1149
        }
1150
    });
1151
 
1152
    $('.btn-salary-edit').on("click", function(e){
1153
        e.preventDefault();
1154
 
1155
        NProgress.start();
1156
        $.ajax({
1157
            'dataType'  : 'json',
1158
            'accept'    : 'application/json',
1159
            'method'    : 'get',
1160
            'url'       : route_salary,
1161
        }).done(function(response) {
1162
           if(response['success']) {
1163
                if(response['data']['salary_visible'] == 'y') {
1164
                    $('#form-salary #salary_visible').bootstrapToggle('on')
1165
                    $('#form-salary #salary_min').val(response['data']['salary_min']);
1166
                    $('#form-salary #salary_min').prop('readonly', false);
1167
                    $('#form-salary #salary_max').val(response['data']['salary_max']);
1168
                    $('#form-salary #salary_max').prop('readonly', false);
1169
                    $('#form-salary #salary_currency').val(response['data']['salary_currency']);
1170
                    $('#form-salary #salary_currency').prop('disable',false);
1171
                } else {
1172
                    $('#form-salary #salary_visible').bootstrapToggle('off')
1173
                    $('#form-salary #salary_min').val('1');
1174
                    $('#form-salary #salary_min').prop('readonly', true);
1175
                    $('#form-salary #salary_max').val('99');
1176
                    $('#form-salary #salary_max').prop('readonly', true);
1177
                    $('#form-salary #salary_currency').val('USD');
1178
                    $('#form-salary #salary_currency').prop('disable',true);
1179
                }
1180
                validatorSalary.resetForm();
1181
                $("#salary-box").modal('show');
1182
            } else {
1183
                $.fn.showError(response['data']);
1184
            }
1185
        }).fail(function( jqXHR, textStatus, errorThrown) {
1186
            $.fn.showError(textStatus);
1187
        }).always(function() {
1188
            NProgress.done();
1189
        });
1190
        return false;
1191
 
1192
    });
1193
 
1194
    $('.btn-salary-close').on("click", function(e){
1195
        e.preventDefault();
1196
 
1197
        $("#salary-box").modal('hide');
1198
        return false;
1199
    });
1200
 
1201
    var validatorExperience = $('#form-experience').validate({
1202
        debug: true,
1203
        onclick: false,
1204
        onkeyup: false,
1205
        ignore: [],
1206
        rules: {
1207
            'experience_visible': {
1208
                required: false,
1209
            },
1210
            'experience_min': {
1211
                required:  '#form-experience #experience_visible:checked',
1212
                digits: true,
1213
                maxlength: 2,
1214
            },
1215
            'experience_max': {
1216
                required:  '#form-experience #experience_visible:checked',
1217
                digits: true,
1218
                maxlength: 4,
1219
                greaterThan : '#form-experience #experience_min',
1220
            },
1221
        },
1222
        submitHandler: function(form)
1223
        {
1224
            NProgress.start();
1225
            $.ajax({
1226
                'dataType'  : 'json',
1227
                'accept'    : 'application/json',
1228
                'method'    : 'post',
1229
                'url'       :  route_experience,
1230
                'data'      :  $('#form-experience').serialize()
1231
            }).done(function(response) {
1232
                if(response['success']) {
1233
					$('#overview-experience').html(response['data']);
1234
                    $("#experience-box").modal('hide');
1235
                } else {
1236
                    validatorExperience.resetForm();
1237
                    if(jQuery.type(response['data']) == 'string') {
1238
                        $.fn.showError(response['data']);
1239
                    } else  {
1240
                        $.each(response['data'], function( fieldname, errors ) {
1241
                            $.fn.showFormErrorValidator('#form-experience #' + fieldname, errors);
1242
                        });
1243
                    }
1244
                }
1245
            }).fail(function( jqXHR, textStatus, errorThrown) {
1246
                $.fn.showError(textStatus);
1247
            }).always(function() {
1248
                NProgress.done();
1249
            });
1250
            return false;
1251
        },
1252
        invalidHandler: function(form, validator) {
1253
 
1254
        }
1255
    });
1256
 
1257
    $('.btn-experience-edit').on("click", function(e){
1258
        e.preventDefault();
1259
 
1260
        NProgress.start();
1261
        $.ajax({
1262
            'dataType'  : 'json',
1263
            'accept'    : 'application/json',
1264
            'method'    : 'get',
1265
            'url'       : route_experience,
1266
        }).done(function(response) {
1267
           if(response['success']) {
1268
                if(response['data']['experience_visible'] == 'y') {
1269
                    $('#form-experience #experience_visible').bootstrapToggle('on')
1270
                    $('#form-experience #experience_min').val(response['data']['experience_min']);
1271
                    $('#form-experience #experience_min').prop('readonly', false);
1272
                    $('#form-experience #experience_max').val(response['data']['experience_max']);
1273
                    $('#form-experience #experience_max').prop('readonly', false);
1274
                } else {
1275
                    $('#form-experience #experience_visible').bootstrapToggle('off')
1276
                    $('#form-experience #experience_min').val('1');
1277
                    $('#form-experience #experience_min').prop('readonly', true);
1278
                    $('#form-experience #experience_max').val('5');
1279
                    $('#form-experience #experience_max').prop('readonly', true);
1280
                }
1281
 
1282
                validatorExperience.resetForm();
1283
                $("#experience-box").modal('show');
1284
            } else {
1285
                $.fn.showError(response['data']);
1286
            }
1287
        }).fail(function( jqXHR, textStatus, errorThrown) {
1288
            $.fn.showError(textStatus);
1289
        }).always(function() {
1290
            NProgress.done();
1291
        });
1292
        return false;
1293
 
1294
    });
1295
 
1296
    $('.btn-experience-close').on("click", function(e){
1297
        e.preventDefault();
1298
 
1299
        $("#experience-box").modal('hide');
1300
        return false;
1301
    });
1302
 
1303
 
1304
    $('.btn-skills-edit').on("click", function(e){
1305
        e.preventDefault();
1306
 
1307
        NProgress.start();
1308
        $.ajax({
1309
            'dataType'  : 'json',
1310
            'accept'    : 'application/json',
1311
            'method'    : 'get',
1312
            'url'       : route_skills,
1313
        }).done(function(response) {
1314
           if(response['success']) {
1315
                $('#form-skill #skills').val(response['data']).trigger('change');
1316
                validatorSkills.resetForm();
1317
 
1318
                $('#skills-box').modal('show');
1319
            } else {
1320
                $.fn.showError(response['data']);
1321
            }
1322
        }).fail(function( jqXHR, textStatus, errorThrown) {
1323
            $.fn.showError(textStatus);
1324
        }).always(function() {
1325
            NProgress.done();
1326
        });
1327
        return false;
1328
 
1329
    });
1330
 
1331
    $('.btn-skills-close').on("click", function(e){
1332
        e.preventDefault();
1333
 
1334
        $('#skills-box').modal('hide');
1335
        return false;
1336
    });
1337
 
1338
    var validatorSkills = $('#form-skill').validate({
1339
        debug: true,
1340
        onclick: false,
1341
        onkeyup: false,
1342
         onfocusout: false,
1343
        ignore: [],
1344
        rules: {
1345
            'skills[]': {
1346
                required: true,
1347
            }
1348
        },
1349
        submitHandler: function(form)
1350
        {
1351
            NProgress.start();
1352
            $.ajax({
1353
                'dataType'  : 'json',
1354
                'accept'    : 'application/json',
1355
                'method'    : 'post',
1356
                'url'       :  route_skills,
1357
                'data'      :  {
1358
                    'skills[]' : $('#form-skill #skills').val()
1359
                },
1360
            }).done(function(response) {
1361
                if(response['success']) {
1362
 
1363
					$('#list-skills').empty();
1364
                    $.each(response['data'], function(index, item) {
1365
                        $('#list-skills').append('<li><a href="#" title="">' + item.label + '</a></li>');
1366
                    });
1367
 
1368
                    $("#skills-box").modal('hide');
1369
                } else {
1370
                    validatorSkills.resetForm();
1371
                    if(jQuery.type(response['data']) == 'string') {
1372
                        $.fn.showError(response['data']);
1373
                    } else  {
1374
                        $.each(response['data'], function( fieldname, errors ) {
1375
                            $.fn.showFormErrorValidator('#form-skill #' + fieldname, errors);
1376
                        });
1377
                    }
1378
                }
1379
            }).fail(function( jqXHR, textStatus, errorThrown) {
1380
                $.fn.showError(textStatus);
1381
            }).always(function() {
1382
                NProgress.done();
1383
            });
1384
            return false;
1385
        },
1386
        invalidHandler: function(form, validator) {
1387
 
1388
        }
1389
    });
1390
 
1391
 
1392
 
1393
    var validatorLanguages = $('#form-language').validate({
1394
        debug: true,
1395
        onclick: false,
1396
        onkeyup: false,
1397
         onfocusout: false,
1398
        ignore: [],
1399
        rules: {
1400
            'languages[]': {
1401
                required: true,
1402
            }
1403
        },
1404
        submitHandler: function(form)
1405
        {
1406
            NProgress.start();
1407
            $.ajax({
1408
                'dataType'  : 'json',
1409
                'accept'    : 'application/json',
1410
                'method'    : 'post',
1411
                'url'       :  route_languages,
1412
                'data'      :  {
1413
                    'languages[]' : $('#form-language #languages').val()
1414
                },
1415
            }).done(function(response) {
1416
                if(response['success']) {
1417
 
1418
					$('#list-languages').empty();
1419
                    $.each(response['data'], function(index, item) {
1420
                        $('#list-languages').append('<li><a href="#" title="">' + item.label + '</a></li>');
1421
                    });
1422
 
1423
                    $("#languages-box").modal('hide');
1424
                } else {
1425
                    validatorLanguages.resetForm();
1426
                    if(jQuery.type(response['data']) == 'string') {
1427
                        $.fn.showError(response['data']);
1428
                    } else  {
1429
                        $.each(response['data'], function( fieldname, errors ) {
1430
                            $.fn.showFormErrorValidator('#form-language #' + fieldname, errors);
1431
                        });
1432
                    }
1433
                }
1434
            }).fail(function( jqXHR, textStatus, errorThrown) {
1435
                $.fn.showError(textStatus);
1436
            }).always(function() {
1437
                NProgress.done();
1438
            });
1439
            return false;
1440
        },
1441
        invalidHandler: function(form, validator) {
1442
 
1443
        }
1444
    });
1445
 
1446
    $('.btn-languages-edit').on("click", function(e){
1447
        e.preventDefault();
1448
 
1449
        NProgress.start();
1450
        $.ajax({
1451
            'dataType'  : 'json',
1452
            'accept'    : 'application/json',
1453
            'method'    : 'get',
1454
            'url'       : route_languages,
1455
        }).done(function(response) {
1456
           if(response['success']) {
1457
                $('#form-language #languages').val(response['data']).trigger('change');
1458
                validatorLanguages.resetForm();
1459
 
1460
                $("#languages-box").modal('show');
1461
            } else {
1462
                $.fn.showError(response['data']);
1463
            }
1464
        }).fail(function( jqXHR, textStatus, errorThrown) {
1465
            $.fn.showError(textStatus);
1466
        }).always(function() {
1467
            NProgress.done();
1468
        });
1469
        return false;
1470
 
1471
    });
1472
 
1473
    $('.btn-languages-close').on("click", function(e){
1474
        e.preventDefault();
1475
 
1476
        $("#languages-box").modal('hide');
1477
        return false;
1478
    });
1479
 
1480
 
1481
    var validatorDegrees = $('#form-degree').validate({
1482
        debug: true,
1483
        onclick: false,
1484
        onkeyup: false,
1485
         onfocusout: false,
1486
        ignore: [],
1487
        rules: {
1488
            'degrees[]': {
1489
                required: true,
1490
            }
1491
        },
1492
        submitHandler: function(form)
1493
        {
1494
            NProgress.start();
1495
            $.ajax({
1496
                'dataType'  : 'json',
1497
                'accept'    : 'application/json',
1498
                'method'    : 'post',
1499
                'url'       :  route_degrees,
1500
                'data'      :  {
1501
                    'degrees[]' : $('#form-degree #degrees').val()
1502
                },
1503
            }).done(function(response) {
1504
                if(response['success']) {
1505
 
1506
					$('#list-degrees').empty();
1507
                    $.each(response['data'], function(index, item) {
1508
                        $('#list-degrees').append('<li><a href="#" title="">' + item.label + '</a></li>');
1509
                    });
1510
 
1511
                    $("#degrees-box").modal('hide');
1512
                } else {
1513
                    validatorDegrees.resetForm();
1514
                    if(jQuery.type(response['data']) == 'string') {
1515
                        $.fn.showError(response['data']);
1516
                    } else  {
1517
                        $.each(response['data'], function( fieldname, errors ) {
1518
                            $.fn.showFormErrorValidator('#form-degree #' + fieldname, errors);
1519
                        });
1520
                    }
1521
                }
1522
            }).fail(function( jqXHR, textStatus, errorThrown) {
1523
                $.fn.showError(textStatus);
1524
            }).always(function() {
1525
                NProgress.done();
1526
            });
1527
            return false;
1528
        },
1529
        invalidHandler: function(form, validator) {
1530
 
1531
        }
1532
    });
1533
 
1534
    $('.btn-degrees-edit').on("click", function(e){
1535
        e.preventDefault();
1536
 
1537
        NProgress.start();
1538
        $.ajax({
1539
            'dataType'  : 'json',
1540
            'accept'    : 'application/json',
1541
            'method'    : 'get',
1542
            'url'       : route_degrees,
1543
        }).done(function(response) {
1544
           if(response['success']) {
1545
                $('#form-degree #degrees').val(response['data']).trigger('change');
1546
                validatorDegrees.resetForm();
1547
 
1548
                $("#degrees-box").modal('show');
1549
            } else {
1550
                $.fn.showError(response['data']);
1551
            }
1552
        }).fail(function( jqXHR, textStatus, errorThrown) {
1553
            $.fn.showError(textStatus);
1554
        }).always(function() {
1555
            NProgress.done();
1556
        });
1557
        return false;
1558
 
1559
    });
1560
 
1561
    $('.btn-degrees-close').on("click", function(e){
1562
        e.preventDefault();
1563
 
1564
        $("#degrees-box").modal('hide');
1565
        return false;
1566
    });
1567
 
1568
 
1569
    $('#form-degree #degrees').select2({
1570
        theme: 'bootstrap4',
1571
        width: '100%',
1572
        placeholder: 'LABEL_SELECT_DEGREE'
1573
    });
1574
 
1575
    $('#form-skill #skills').select2({
1576
        theme: 'bootstrap4',
1577
        width: '100%',
1578
        placeholder: 'LABEL_SELECT_ONE_SKILLS'
1579
    });
1580
 
1581
    $('#form-language #languages').select2({
1582
        theme: 'bootstrap4',
1583
        width: '100%',
1584
        placeholder: 'LABEL_SELECT_ONE_LANGUAGE'
1585
    });
1586
 
1587
 
1588
 
1589
    $('#form-last-date-of-application #last_date_of_application').datetimepicker({
1590
        locale: 'es',
1591
        format: 'DD/MM/YYYY'
1592
    });
1593
 
1594
    $('#form-salary #salary_visible').bootstrapToggle({'on' : 'LABEL_SHOW',  'off' : 'LABEL_NO_SHOW', 'width' : '160px', 'height' : '40px'});
1595
    $('#form-salary #salary_min').inputNumberFormat({ 'decimal': 2 });
1596
    $('#form-salary #salary_max').inputNumberFormat({ 'decimal': 2 });
1597
 
1598
    $('#form-salary #salary_visible').change(function(e) {
1599
        e.preventDefault();
1600
 
1601
        if($(this).prop('checked')) {
1602
            $('#form-salary #salary_min').prop('readonly', false);
1603
            $('#form-salary #salary_max').prop('readonly', false);
1604
            $('#form-salary #salary_currency').prop('disabled', false);
1605
        } else {
1606
            $('#form-salary #salary_min').val('1');
1607
            $('#form-salary #salary_max').val('99');
1608
            $('#form-salary #salary_min').prop('readonly', true);
1609
            $('#form-salary #salary_max').prop('readonly', true);
1610
            $('#form-salary #salary_currency').prop('disabled', true);
1611
        }
1612
    });
1613
 
1614
    $('#form-experience #experience_visible').bootstrapToggle({'on' : 'LABEL_SHOW',  'off' : 'LABEL_NO_SHOW', 'width' : '160px', 'height' : '40px'});
1615
    $('#form-experience #experience_min').inputNumberFormat({ 'decimal': 0 });
1616
    $('#form-experience #experience_max').inputNumberFormat({ 'decimal': 0 });
1617
 
1618
    $('#form-experience #experience_visible').change(function(e) {
1619
        e.preventDefault();
1620
 
1621
        if($(this).prop('checked')) {
1622
            $('#form-experience #experience_min').prop('readonly', false);
1623
            $('#form-experience #experience_max').prop('readonly', false);
1624
        } else {
1625
            $('#form-experience #experience_min').val('1');
1626
            $('#form-experience #experience_max').val('5');
1627
            $('#form-experience #experience_min').prop('readonly', true);
1628
            $('#form-experience #experience_max').prop('readonly', true);
1629
       }
1630
    });
1631
 
1632
 
1633
    var validatorStatus = $('#form-status').validate({
1634
        debug: true,
1635
        onclick: false,
1636
        onkeyup: false,
1637
        ignore: [],
1638
        rules: {
1639
            'status': {
1640
                required: false,
1641
            },
1642
        },
1643
        submitHandler: function(form)
1644
        {
1645
            NProgress.start();
1646
            $.ajax({
1647
                'dataType'  : 'json',
1648
                'accept'    : 'application/json',
1649
                'method'    : 'post',
1650
                'url'       :  route_status,
1651
                'data'      :  $('#form-status').serialize()
1652
            }).done(function(response) {
1653
                if(response['success']) {
1654
					$('#overview-status').html(response['data']['status']);
1655
                    $("#status-box").modal('hide');
1656
                } else {
1657
                    validatorStatus.resetForm();
1658
                    if(jQuery.type(response['data']) == 'string') {
1659
                        $.fn.showError(response['data']);
1660
                    } else  {
1661
                        $.each(response['data'], function( fieldname, errors ) {
1662
                            $.fn.showFormErrorValidator('#form-status #' + fieldname, errors);
1663
                        });
1664
                    }
1665
                }
1666
            }).fail(function( jqXHR, textStatus, errorThrown) {
1667
                $.fn.showError(textStatus);
1668
            }).always(function() {
1669
                NProgress.done();
1670
            });
1671
            return false;
1672
        },
1673
        invalidHandler: function(form, validator) {
1674
 
1675
        }
1676
    });
1677
 
1678
    $('.btn-status-edit').on("click", function(e){
1679
        e.preventDefault();
1680
 
1681
        NProgress.start();
1682
        $.ajax({
1683
            'dataType'  : 'json',
1684
            'accept'    : 'application/json',
1685
            'method'    : 'get',
1686
            'url'       : route_status,
1687
        }).done(function(response) {
1688
           if(response['success']) {
1689
                $('#form-status #status').val(response['data']['status']);
1690
                validatorStatus.resetForm();
1691
                $("#status-box").modal('show');
1692
            } else {
1693
                $.fn.showError(response['data']);
1694
            }
1695
        }).fail(function( jqXHR, textStatus, errorThrown) {
1696
            $.fn.showError(textStatus);
1697
        }).always(function() {
1698
            NProgress.done();
1699
        });
1700
        return false;
1701
 
1702
    });
1703
 
1704
    $('.btn-status-close').on("click", function(e){
1705
        e.preventDefault();
1706
 
1707
        $("#status-box").modal('hide');
1708
        return false;
1709
    });
1710
 
1711
 
1712
    var validatorTitle = $('#form-title').validate({
1713
        debug: true,
1714
        onclick: false,
1715
        onkeyup: false,
1716
        ignore: [],
1717
        rules: {
1718
            'title': {
1719
                required: true,
1720
                maxlength: 128,
1721
            },
1722
        },
1723
        submitHandler: function(form)
1724
        {
1725
            NProgress.start();
1726
            $.ajax({
1727
                'dataType'  : 'json',
1728
                'accept'    : 'application/json',
1729
                'method'    : 'post',
1730
                'url'       :  route_title,
1731
                'data'      :  $('#form-title').serialize()
1732
            }).done(function(response) {
1733
                if(response['success']) {
1734
					$('#overview-title').html(response['data']['title']);
1735
                    $("#title-box").modal('hide');
1736
                } else {
1737
                    validatorTitle.resetForm();
1738
                    if(jQuery.type(response['data']) == 'string') {
1739
                        $.fn.showError(response['data']);
1740
                    } else  {
1741
                        $.each(response['data'], function( fieldname, errors ) {
1742
                            $.fn.showFormErrorValidator('#form-title #' + fieldname, errors);
1743
                        });
1744
                    }
1745
                }
1746
            }).fail(function( jqXHR, textTitle, errorThrown) {
1747
                $.fn.showError(textTitle);
1748
            }).always(function() {
1749
                NProgress.done();
1750
            });
1751
            return false;
1752
        },
1753
        invalidHandler: function(form, validator) {
1754
 
1755
        }
1756
    });
1757
 
1758
    $('.btn-title-edit').on("click", function(e){
1759
        e.preventDefault();
1760
 
1761
        NProgress.start();
1762
        $.ajax({
1763
            'dataType'  : 'json',
1764
            'accept'    : 'application/json',
1765
            'method'    : 'get',
1766
            'url'       : route_title,
1767
        }).done(function(response) {
1768
           if(response['success']) {
1769
                $('#form-title #title').val(response['data']['title'] );
1770
                validatorTitle.resetForm();
1771
                $("#title-box").modal('show');
1772
            } else {
1773
                $.fn.showError(response['data']);
1774
            }
1775
        }).fail(function( jqXHR, textTitle, errorThrown) {
1776
            $.fn.showError(textTitle);
1777
        }).always(function() {
1778
            NProgress.done();
1779
        });
1780
        return false;
1781
 
1782
    });
1783
 
1784
    $('body').on('click', 'button.btn-delete', function(e) {
1785
        e.preventDefault();
1786
        var action = $(this).data('href');
1787
 
1788
 
1789
          swal.fire({
1790
            title: 'LABEL_ARE_YOU_SURE',
1791
            icon: 'question',
1792
            cancelButtonText: 'LABEL_NO',
1793
            showCancelButton: true,
1794
            confirmButtonText: 'LABEL_YES'
1795
          }).then((result) => {
1796
            if (result.isConfirmed) {
1797
 
1798
                    NProgress.start();
1799
                    $.ajax({
1800
                        'dataType'  : 'json',
1801
                        'accept'    : 'application/json',
1802
                        'method'    : 'post',
1803
                        'url'       :  action,
1804
                    }).done(function(response) {
1805
                        if(response['success']) {
1806
                            $.fn.showSuccess(response['data']);
1807
                            gridTable.api().ajax.reload(null, false);
1808
                        } else {
1809
                            $.fn.showError(response['data']);
1810
                        }
1811
                    }).fail(function( jqXHR, textStatus, errorThrown) {
1812
                        $.fn.showError(textStatus);
1813
                    }).always(function() {
1814
                        NProgress.done();
1815
                    });
1816
            }
1817
       });
1818
    });
1819
 
1820
    $('.btn-title-close').on("click", function(e){
1821
        e.preventDefault();
1822
 
1823
        $("#title-box").modal('hide');
1824
        return false;
1825
    });
1826
 
1827
    $('h1.btn-edit-back').on("click", function(e){
1828
        e.preventDefault();
1829
 
1830
 
1831
 
1832
        $('#divEdit').hide();
1833
        $('#divListing').show();
1834
        return false;
1835
    });
1836
 
1837
 
1838
    CKEDITOR.replace('description');
1839
 
1840
    autocompleteLocation.addListener('place_changed', $.fn.fillInAddressLocation);
1841
    autocompleteLocationNew.addListener('place_changed', $.fn.fillInAddressNewLocation);
1842
});
1843
JS;
1844
$this->inlineScript()->captureEnd();
1 www 1845
?>
16822 efrain 1846
 
16843 efrain 1847
<div class="container">
1848
	<div class="card" id="divListing">
1849
		<div class="card-body">
1850
       		<h6 class="card-title">LABEL_JOBS</h6>
1851
	    	<div class="row" >
1852
            	<div class="col-12 mt-3">
1853
    				<table id="gridTable" class="table   table-hover">
16822 efrain 1854
                          		<thead>
1855
            						<tr>
1856
 
1857
                                      	<th>LABEL_LAST_DATE_OF_APPLICATION</th>
1858
                                      	<th>LABEL_TITLE</th>
1859
                                      	<th>LABEL_DETAILS</th>
1860
                                    	<th>LABEL_ACTIONS</th>
1861
                                    </tr>
1862
                           		</thead>
1863
                             	<tbody>
1864
                             	</tbody>
16843 efrain 1865
                        </table>
1866
                 </div>
1867
           	</div>
1868
         </div>
1869
     	<div class="card-footer text-right">
1870
         	<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
1871
    		<?php if($allowAdd) : ?>
1872
    		<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
1873
			<?php  endif; ?>
1874
  		</div>
1875
  	</div>
1876
 
1877
  	<div class="card" id="divEdit" style="display: none">
16822 efrain 1878
 
16843 efrain 1879
    	<div class="card-body">
1880
    		<h6 class="card-title btn-edit-back" ><i class="fa fa-chevron-left" aria-hidden="true"></i> LABEL_EDIT_JOB</h6>
16822 efrain 1881
 
1882
    			</div>
1883
    		</div>
1884
    	</div><!-- /.container-fluid -->
1885
    </section>
1886
 
1887
    <section class="content">
1888
    	<div class="container-fluid">
1889
 
1890
        	<div class="row">
1891
        		<div class="col-lg-3">
1892
        		</div>
1893
           		<div class="col-lg-6">
1894
						<div class="main-ws-sec">
1895
 
1896
							<!--user-profile-ov end -->
1897
							<div class="user-profile-ov">
1898
								<h3>
1899
									LABEL_STATUS  <a href="#" title="" class="btn-status-edit"> <i
1900
										class="fa fa-pencil"></i></a>
1901
								</h3>
1902
								<p id="overview-status"></p>
1903
							</div>
1904
 
1905
                        	<div class="user-profile-ov">
1906
                        		<h3>LABEL_TITLE
1907
                            	<a href="#" title="" class="btn-title-edit"><i class="fa fa-pencil"></i></a>
1908
                            	</h3>
1909
                            	<p id="overview-title"></p>
1910
                            </div>
1911
							<div class="user-profile-ov">
1912
								<h3>LABEL_OVERVIEW
1913
								<a href="#" title="" class="btn-extended-edit"><i class="fa fa-pencil"></i></a>
1914
								</h3>
1915
								<p id="overview-description"></p>
1916
							</div>
1917
							<!--user-profile-ov end-->
1918
							<div class="user-profile-ov st2">
1919
								<h3>LABEL_LAST_DATE_OF_APPLICATION
1920
									<a href="#" title="" class="btn-last-date-of-application-edit"><i class="fa fa-pencil"></i></a> <a href="#" title="" class="esp-bx-open"></a>
1921
								</h3>
1922
								<span id="overview-last-date-of-application"></span>
1923
							</div>
1924
							<!--user-profile-ov end-->
1925
							<div class="user-profile-ov">
1926
								<h3>LABEL_EMPLOYMENT_TYPE
1927
								<a href="#" title="" class="btn-employment-type-edit"><i class="fa fa-pencil"></i></a>
1928
								</h3>
1929
								<span id="overview-employment-type"></span>
1930
							</div>
1931
							<!--user-profile-ov end-->
1932
							<div class="user-profile-ov">
1933
								<h3>
1934
									<a href="#" title="">LABEL_LOCATION</a>
1935
									<a href="#" title="" class="btn-location-edit"><i class="fa fa-pencil"></i></a>
1936
								</h3>
1937
								<span id="overview-location"></span>
1938
							</div>
1939
							<!--user-profile-ov end-->
1940
							<div class="user-profile-ov">
1941
								<h3>
1942
									LABEL_EXPERIENCE
1943
									<a href="#" title="" class="btn-experience-edit"><i class="fa fa-pencil"></i></a>
1944
								</h3>
1945
								<span id="overview-experience" > </span>
1946
							</div>
1947
							<!--user-profile-ov end-->
1948
							<div class="user-profile-ov">
1949
								<h3>
1950
									LABEL_SALARY
1951
									<a href="#" title="" class="btn-salary-edit"><i class="fa fa-pencil"></i></a>
1952
								</h3>
1953
								<span id="overview-salary" ></span>
1954
							</div>
1955
							<!--user-profile-ov end-->
1956
							<div class="user-profile-ov">
1957
								<h3>
1958
									LABEL_CATEGORIE
1959
									<a href="#" title="" class="btn-job-category-edit"><i class="fa fa-pencil"></i></a>
1960
								</h3>
1961
								<span id="overview-job-category"></span>
1962
							</div>
1963
							<!--user-profile-ov end-->
1964
							<div class="user-profile-ov">
1965
								<h3>
1966
									LABEL_SKILLS  <a href="#" title="" class="btn-skills-edit"> <i
1967
										class="fa fa-pencil"></i></a>
1968
								</h3>
1969
								<ul id="list-skills">
1970
 
1971
 
1972
        						</ul>
1973
							</div>
1974
							<!--user-profile-ov end -->
1975
							<div class="user-profile-ov">
1976
								<h3>
1977
									LABEL_LANGUAGES  <a href="#" title="" class="btn-languages-edit"> <i
1978
										class="fa fa-pencil"></i></a>
1979
								</h3>
1980
								<ul id="list-languages">
1981
 
1982
 
1983
        						</ul>
1984
							</div>
1985
							<!--user-profile-ov end -->
1986
							<div class="user-profile-ov">
1987
								<h3>
1988
									LABEL_DEGREES  <a href="#" title="" class="btn-degrees-edit"> <i
1989
										class="fa fa-pencil"></i></a>
1990
								</h3>
1991
								<ul id="list-degrees">
1992
 
1993
 
1994
        						</ul>
1995
							</div>
1996
 
1997
 
1998
 
1999
					</div>
2000
				</div>
2001
				<div class="col-lg-3">
2002
				</div>
2003
 			</div>
2004
     	</div>
2005
    </section>
2006
</div>
2007
 
2008
<div class="modal" tabindex="-1" role="dialog" id="add-job-box">
2009
	<div class="modal-dialog" role="document">
2010
		<?php
2011
	    $form = $this->formAdd;
2012
	    $form->setAttributes([
2013
	       'method'    => 'post',
2014
	        'name'      => 'form-add',
2015
	        'id'        => 'form-add'
2016
	    ]);
2017
	    $form->prepare();
2018
	    echo $this->form()->openTag($form);
2019
 
2020
	    $fieldnames = [
2021
	        'formatted_address',
2022
	        'address1',
2023
	        'address2',
2024
	        'country',
2025
	        'state',
2026
	        'city1',
2027
	        'city2',
2028
	        'postal_code',
2029
	        'latitude',
2030
	        'longitude',
2031
	    ];
2032
 
2033
	    foreach($fieldnames as $fieldname) {
2034
 
2035
	        $element = $form->get($fieldname);
2036
	        echo $this->formHidden($element);
2037
	    }
2038
	    ?>
2039
    	<div class="modal-content">
2040
      		<div class="modal-header">
2041
        		<h3 class="modal-title">LABEL_NEW_JOB</h3>
2042
      		</div>
2043
      		<div class="modal-body">
2044
      			<div class="form-group">
2045
    				<?php
2046
                        $element = $form->get('title');
2047
                        $element->setOptions(['label' => 'LABEL_TITLE']);
2048
                        $element->setAttributes(['class' => 'form-control']);
2049
                        echo $this->formLabel($element);
2050
                        echo $this->formText($element);
2051
                    ?>
2052
				</div>
2053
				<div class="form-group">
2054
    				<?php
2055
                        $element = $form->get('employment_type');
2056
                        $element->setAttributes(['class' => 'form-control']);
2057
                        $element->setOptions(['empty_option' => 'LABEL_SELECT_EMPLOYMENT_TYPE', 'label' => 'LABEL_EMPLOYMENT_TYPE']);
2058
                        echo $this->formLabel($element);
2059
                        echo $this->formSelect($element);
2060
                    ?>
2061
				</div>
2062
      			<div class="form-group">
2063
    				<?php
2064
                        $element = $form->get('last_date_of_application');
2065
                        $element->setAttributes(['class' => 'form-control']);
2066
                        $element->setOptions(['label' => 'LABEL_LAST_DATE_OF_APPLICATION']);
2067
                        echo $this->formLabel($element);
2068
                        echo $this->formText($element);
2069
                    ?>
2070
				</div>
2071
 
2072
				<div class="form-group">
2073
    				<?php
2074
                        $element = $form->get('job_category_id');
2075
                        $element->setOptions(['empty_option' => 'LABEL_SELECT_JOB_CATEGORY', 'label' => 'LABEL_JOB_CATEGORY']);
2076
                        $element->setAttributes(['class' => 'form-control']);
2077
                        echo $this->formLabel($element);
2078
                        echo $this->formSelect($element);
2079
                    ?>
2080
				</div>
2081
				<div class="form-group">
2082
    				<?php
2083
                        $element = $form->get('location_search');
2084
                        $element->setAttributes(['name' => 'add_location_search',  'id' => 'add_location_search', 'class' => 'form-control']);
2085
                        $element->setOptions(['label' => 'LABEL_LOCATION']);
2086
                        echo $this->formLabel($element);
2087
                        echo $this->formText($element);
2088
                    ?>
2089
				</div>
2090
          	</div>
2091
 
2092
         	<div class="modal-footer">
2093
    			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
2094
    			<button type="button" class="btn btn-default btn-add-job-cancel">LABEL_CANCEL</button>
2095
          	</div>
2096
      	<?php echo $this->form()->closeTag($form); ?>
2097
    	</div>
2098
	</div>
2099
</div>
2100
 
2101
 
2102
<!-- The Modal -->
2103
<div class="modal" id="modalUsersWhoApplied">
2104
	<div class="modal-dialog modal-xl">
2105
    	<div class="modal-content">
2106
 
2107
            <!-- Modal Header -->
2108
      		<div class="modal-header">
2109
        		<h4 class="modal-title">LABEL_USERS_WHO_APPLIED</h4>
2110
        		<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
2111
      		</div>
2112
 
2113
            <!-- Modal body -->
2114
      		<div class="modal-body">
2115
      			<div style="height: 300px;overflow: scroll;">
2116
    				<table id="gridTableUsersWhoApplied" style="width: 100%" class="table table-bordered">
2117
                		<thead>
2118
                			<tr>
2119
                          		<th>LABEL_FIRST_NAME</th>
2120
                         		<th>LABEL_LAST_NAME</th>
2121
                             	<th>LABEL_EMAIL</th>
2122
                             	<th>LABEL_ACTIONS</th>
2123
                 			</tr>
2124
                      	</thead>
2125
                   		<tbody>
2126
                   		</tbody>
2127
             		</table>
2128
         		</div>
2129
 
2130
      		</div>
2131
 
2132
            <!-- Modal footer -->
2133
      		<div class="modal-footer">
2134
      			<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
2135
      		</div>
2136
 
2137
    	</div>
2138
	</div>
2139
</div>
2140
 
2141
<div class="modal" tabindex="-1" role="dialog" id="extended-box">
2142
	<div class="modal-dialog" role="document">
2143
		<?php
2144
        $form = $this->formExtended;
2145
        $form->setAttributes([
2146
            'method' => 'post',
2147
            'name' => 'form-extended',
2148
            'id' => 'form-extended'
2149
        ]);
2150
        $form->prepare();
2151
        echo $this->form()->openTag($form);
2152
        ?>
2153
    	<div class="modal-content">
2154
      		<div class="modal-header">
2155
        		<h3 class="modal-title">LABEL_OVERVIEW</h3>
2156
      		</div>
2157
          	<div class="modal-body">
2158
                <div class="form-group">
2159
    			<?php
2160
                $element = $form->get('description');
2161
                $element->setOptions(['label' => 'LABEL_OVERVIEW']);
2162
                $element->setAttributes(['class' => 'form-control']);
2163
                echo $this->formLabel($element);
2164
                echo $this->formTextArea($element);
2165
                ?>
2166
                </div>
2167
          	</div>
2168
         	<div class="modal-footer">
2169
    			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
2170
    			<button type="button" class="btn btn-default btn-extended-close">LABEL_CANCEL</button>
2171
          	</div>
2172
      	<?php echo $this->form()->closeTag($form); ?>
2173
    	</div>
2174
	</div>
2175
</div>
2176
 
2177
<div class="modal" tabindex="-1" role="dialog" id="location-box">
2178
	<div class="modal-dialog" role="document">
2179
		<?php
2180
        $form = $this->formLocation;
2181
        $form->setAttributes([
2182
            'method' => 'post',
2183
            'name' => 'form-location',
2184
            'id' => 'form-location'
2185
        ]);
2186
        $form->prepare();
2187
        echo $this->form()->openTag($form);
2188
 
2189
        $fieldnames = [
2190
            'formatted_address',
2191
            'address1',
2192
            'address2',
2193
            'country',
2194
            'state',
2195
            'city1',
2196
            'city2',
2197
            'postal_code',
2198
            'latitude',
2199
            'longitude',
2200
        ];
2201
 
2202
        foreach($fieldnames as $fieldname) {
2203
 
2204
            $element = $form->get($fieldname);
2205
            echo $this->formHidden($element);
2206
        }
2207
        ?>
2208
    	<div class="modal-content">
2209
      		<div class="modal-header">
2210
        		<h3 class="modal-title">LABEL_LOCATION</h3>
2211
      		</div>
2212
          	<div class="modal-body">
2213
    			<div class="form-group datefm">
2214
    				<?php
2215
                        $element = $form->get('location_search');
2216
                        $element->setOptions(['label' => 'LABEL_LOCATION']);
2217
                        $element->setAttributes(['class' => 'form-control']);
2218
                        echo $this->formLabel($element);
2219
                        echo $this->formText($element);
2220
                    ?>
2221
    				<i class="fa fa-map-marker"></i>
2222
    			</div>
2223
          	</div>
2224
         	<div class="modal-footer">
2225
    			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
2226
    			<button type="button" class="btn btn-default btn-location-close">LABEL_CANCEL</button>
2227
          	</div>
2228
      	<?php echo $this->form()->closeTag($form); ?>
2229
    	</div>
2230
	</div>
2231
</div>
2232
 
2233
<div class="modal" tabindex="-1" role="dialog" id="employment-type-box">
2234
	<div class="modal-dialog" role="document">
2235
		<?php
2236
        $form = $this->formEmploymentType;
2237
        $form->setAttributes([
2238
            'method' => 'post',
2239
            'name' => 'form-employment-type',
2240
            'id' => 'form-employment-type'
2241
        ]);
2242
        $form->prepare();
2243
        echo $this->form()->openTag($form);
2244
        ?>
2245
    	<div class="modal-content">
2246
      		<div class="modal-header">
2247
        		<h3 class="modal-title">LABEL_EMPLOYMENT_TYPE</h3>
2248
      		</div>
2249
          	<div class="modal-body">
2250
                <div class="form-group">
2251
    			<?php
2252
                $element = $form->get('employment_type');
2253
                $element->setOptions(['label' => 'LABEL_EMPLOYMENT_TYPE']);
2254
                $element->setAttributes(['class' => 'form-control']);
2255
                echo $this->formLabel($element);
2256
                echo $this->formSelect($element);
2257
                ?>
2258
                </div>
2259
          	</div>
2260
         	<div class="modal-footer">
2261
    			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
2262
    			<button type="button" class="btn btn-default btn-employment-type-close">LABEL_CANCEL</button>
2263
          	</div>
2264
      	<?php echo $this->form()->closeTag($form); ?>
2265
    	</div>
2266
	</div>
2267
</div>
2268
 
2269
<div class="modal" tabindex="-1" role="dialog" id="job-category-box">
2270
	<div class="modal-dialog" role="document">
2271
		<?php
2272
        $form = $this->formJobCategory;
2273
        $form->setAttributes([
2274
            'method' => 'post',
2275
            'name' => 'form-job-category',
2276
            'id' => 'form-job-category'
2277
        ]);
2278
        $form->prepare();
2279
        echo $this->form()->openTag($form);
2280
        ?>
2281
    	<div class="modal-content">
2282
      		<div class="modal-header">
2283
        		<h3 class="modal-title">LABEL_JOB_CATEGORY</h3>
2284
      		</div>
2285
          	<div class="modal-body">
2286
                <div class="form-group">
2287
    			<?php
2288
                $element = $form->get('job_category_id');
2289
                $element->setOptions(['label' => 'LABEL_JOB_CATEGORY']);
2290
                $element->setAttributes(['class' => 'form-control']);
2291
                echo $this->formLabel($element);
2292
                echo $this->formSelect($element);
2293
                ?>
2294
                </div>
2295
          	</div>
2296
         	<div class="modal-footer">
2297
    			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
2298
    			<button type="button" class="btn btn-default btn-job-category-close">LABEL_CANCEL</button>
2299
          	</div>
2300
      	<?php echo $this->form()->closeTag($form); ?>
2301
    	</div>
2302
 	</div>
2303
</div>
2304
 
2305
<div class="modal" tabindex="-1" role="dialog" id="salary-box">
2306
	<div class="modal-dialog" role="document">
2307
		<?php
2308
        $form = $this->formSalary;
2309
        $form->setAttributes([
2310
            'method' => 'post',
2311
            'name' => 'form-salary',
2312
            'id' => 'form-salary'
2313
        ]);
2314
        $form->prepare();
2315
        echo $this->form()->openTag($form);
2316
        ?>
2317
    	<div class="modal-content">
2318
      		<div class="modal-header">
2319
        		<h3 class="modal-title">LABEL_SALARY</h3>
2320
      		</div>
2321
          	<div class="modal-body">
2322
                <div class="form-group">
2323
    			<?php
2324
                $element = $form->get('salary_visible');
2325
                echo $this->formCheckbox($element);
2326
                ?>
2327
                </div>
2328
                <div class="form-group">
2329
    			<?php
2330
                $element = $form->get('salary_currency');
2331
                $element->setAttributes(['class' => 'form-control']);
2332
                $element->setOptions(['label' => 'LABEL_CURRENCY']);
2333
                echo $this->formLabel($element);
2334
                echo $this->formSelect($element);
2335
                ?>
2336
                </div>
2337
               	<div class="form-group">
2338
    			<?php
2339
                $element = $form->get('salary_min');
2340
                $element->setOptions(['label' => 'LABEL_MINIMUM']);
2341
                $element->setAttributes(['class' => 'form-control']);
2342
                echo $this->formLabel($element);
2343
                echo $this->formText($element);
2344
                ?>
2345
                </div>
2346
                <div class="form-group">
2347
    			<?php
2348
                $element = $form->get('salary_max');
2349
                $element->setOptions(['label' => 'LABEL_MAXIMUM']);
2350
                $element->setAttributes(['class' => 'form-control']);
2351
                echo $this->formLabel($element);
2352
                echo $this->formText($element);
2353
                ?>
2354
                </div>
2355
          	</div>
2356
         	<div class="modal-footer">
2357
    			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
2358
    			<button type="button" class="btn btn-default btn-salary-close">LABEL_CANCEL</button>
2359
          	</div>
2360
      	<?php echo $this->form()->closeTag($form); ?>
2361
    	</div>
2362
	</div>
2363
</div>
2364
 
2365
<div class="modal" tabindex="-1" role="dialog" id="experience-box">
2366
	<div class="modal-dialog" role="document">
2367
		<?php
2368
        $form = $this->formExperience;
2369
        $form->setAttributes([
2370
            'method' => 'post',
2371
            'name' => 'form-experience',
2372
            'id' => 'form-experience'
2373
        ]);
2374
        $form->prepare();
2375
        echo $this->form()->openTag($form);
2376
        ?>
2377
    	<div class="modal-content">
2378
      		<div class="modal-header">
2379
        		<h3 class="modal-title">LABEL_EXPERIENCE</h3>
2380
      		</div>
2381
          	<div class="modal-body">
2382
                <div class="form-group">
2383
    			<?php
2384
                $element = $form->get('experience_visible');
2385
 
2386
                echo $this->formCheckbox($element);
2387
                ?>
2388
                </div>
2389
               	<div class="form-group">
2390
    			<?php
2391
                $element = $form->get('experience_min');
2392
                $element->setOptions(['label' => 'LABEL_MINIMUM']);
2393
                $element->setAttributes(['class' => 'form-control']);
2394
                echo $this->formLabel($element);
2395
                echo $this->formText($element);
2396
                ?>
2397
                </div>
2398
                <div class="form-group">
2399
    			<?php
2400
                $element = $form->get('experience_max');
2401
                $element->setOptions(['label' => 'LABEL_MAXIMUM']);
2402
                $element->setAttributes(['class' => 'form-control']);
2403
                echo $this->formLabel($element);
2404
                echo $this->formText($element);
2405
                ?>
2406
                </div>
2407
          	</div>
2408
         	<div class="modal-footer">
2409
    			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
2410
    			<button type="button" class="btn btn-default btn-experience-close">LABEL_CANCEL</button>
2411
          	</div>
2412
      	<?php echo $this->form()->closeTag($form); ?>
2413
    	</div>
2414
	</div>
2415
</div>
2416
 
2417
 
2418
<div class="modal" tabindex="-1" role="dialog" id="skills-box">
2419
	<div class="modal-dialog" role="document">
2420
	      		<?php
2421
			$form = $this->formSkill;
2422
            $form->setAttributes([
2423
                'method' => 'post',
2424
                'name' => 'form-skill',
2425
                'id' => 'form-skill'
2426
            ]);
2427
            $form->prepare();
2428
            echo $this->form()->openTag($form);
2429
            ?>
2430
    	<div class="modal-content">
2431
      		<div class="modal-header">
2432
        		<h3 class="modal-title">LABEL_SKILLS</h3>
2433
      		</div>
2434
          	<div class="modal-body">
2435
                <div class="form-group">
2436
        			<?php
2437
                    $element = $form->get('skills');
2438
                    $element->setOptions(['label' => 'LABEL_SKILLS']);
2439
                    $element->setAttributes(['class' => 'form-control']);
2440
                    echo $this->formLabel($element);
2441
                    echo $this->formSelect($element);
2442
                ?>
2443
                </div>
2444
          	</div>
2445
 
2446
 
2447
         	<div class="modal-footer">
2448
    			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
2449
    			<button type="button" class="btn btn-default btn-skills-close">LABEL_CANCEL</button>
2450
          	</div>
2451
      	<?php echo $this->form()->closeTag($form); ?>
2452
    	</div>
2453
	</div>
2454
</div>
2455
 
2456
<div class="modal" tabindex="-1" role="dialog" id="languages-box">
2457
	<div class="modal-dialog" role="document">
2458
		<?php
2459
        $form = $this->formLanguage;
2460
        $form->setAttributes([
2461
            'method' => 'post',
2462
            'name' => 'form-language',
2463
            'id' => 'form-language'
2464
        ]);
2465
        $form->prepare();
2466
        echo $this->form()->openTag($form);
2467
        ?>
2468
    	<div class="modal-content">
2469
      		<div class="modal-header">
2470
        		<h3 class="modal-title">LABEL_LANGUAGES</h3>
2471
      		</div>
2472
          	<div class="modal-body">
2473
                <div class="form-group">
2474
        			<?php
2475
                    $element = $form->get('languages');
2476
                    $element->setOptions(['label' => 'LABEL_LANGUAGES']);
2477
                    $element->setAttributes(['class' => 'form-control']);
2478
                    echo $this->formLabel($element);
2479
                    echo $this->formSelect($element);
2480
                ?>
2481
                </div>
2482
          	</div>
2483
         	<div class="modal-footer">
2484
    			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
2485
    			<button type="button" class="btn btn-default btn-languages-close">LABEL_CANCEL</button>
2486
          	</div>
2487
      	<?php echo $this->form()->closeTag($form); ?>
2488
    	</div>
2489
	</div>
2490
</div>
2491
 
2492
<div class="modal" tabindex="-1" role="dialog" id="last-date-of-application-box">
2493
	<div class="modal-dialog" role="document">
2494
		<?php
2495
		$form = $this->fromLastDateOfApplication;
2496
        $form->setAttributes([
2497
            'method' => 'post',
2498
            'name' => 'form-last-date-of-application',
2499
            'id' => 'form-last-date-of-application'
2500
        ]);
2501
        $form->prepare();
2502
        echo $this->form()->openTag($form);
2503
        ?>
2504
    	<div class="modal-content">
2505
      		<div class="modal-header">
2506
        		<h3 class="modal-title">LABEL_LAST_DATE_OF_APPLICATION</h3>
2507
      		</div>
2508
          	<div class="modal-body">
2509
                <div class="form-group">
2510
        			<?php
2511
                    $element = $form->get('last_date_of_application');
2512
                    $element->setOptions(['label' => 'LABEL_LAST_DATE_OF_APPLICATION']);
2513
                    $element->setAttributes(['class' => 'form-control']);
2514
                    echo $this->formLabel($element);
2515
                    echo $this->formText($element);
2516
                ?>
2517
                </div>
2518
          	</div>
2519
         	<div class="modal-footer">
2520
    			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
2521
    			<button type="button" class="btn btn-default btn-last-date-of-application-close">LABEL_CANCEL</button>
2522
          	</div>
2523
      	<?php echo $this->form()->closeTag($form); ?>
2524
    	</div>
2525
	</div>
2526
</div>
2527
 
2528
<div class="modal" tabindex="-1" role="dialog" id="degrees-box">
2529
	<div class="modal-dialog" role="document">
2530
		<?php
2531
        $form = $this->formDegree;
2532
        $form->setAttributes([
2533
            'method' => 'post',
2534
            'name' => 'form-degree',
2535
            'id' => 'form-degree'
2536
        ]);
2537
        $form->prepare();
2538
        echo $this->form()->openTag($form);
2539
        ?>
2540
    	<div class="modal-content">
2541
      		<div class="modal-header">
2542
        		<h3 class="modal-title">LABEL_DEGREES</h3>
2543
      		</div>
2544
          	<div class="modal-body">
2545
                <div class="form-group">
2546
        			<?php
2547
                    $element = $form->get('degrees');
2548
                    $element->setOptions(['label' => 'LABEL_DEGREES']);
2549
                    $element->setAttributes(['class' => 'form-control']);
2550
                    echo $this->formLabel($element);
2551
                    echo $this->formSelect($element);
2552
                ?>
2553
                </div>
2554
          	</div>
2555
         	<div class="modal-footer">
2556
    			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
2557
    			<button type="button" class="btn btn-default btn-degrees-close">LABEL_CANCEL</button>
2558
          	</div>
2559
      	<?php echo $this->form()->closeTag($form); ?>
2560
    	</div>
2561
	</div>
2562
</div>
2563
 
2564
<div class="modal" tabindex="-1" role="dialog" id="status-box">
2565
	<div class="modal-dialog" role="document">
2566
	      		<?php
2567
			$form = $this->formStatus;
2568
            $form->setAttributes([
2569
                'method' => 'post',
2570
                'name' => 'form-status',
2571
                'id' => 'form-status'
2572
            ]);
2573
            $form->prepare();
2574
            echo $this->form()->openTag($form);
2575
            ?>
2576
    	<div class="modal-content">
2577
      		<div class="modal-header">
2578
        		<h3 class="modal-title">LABEL_STATUS</h3>
2579
      		</div>
2580
          	<div class="modal-body">
2581
                <div class="form-group">
2582
        			<?php
2583
                    $element = $form->get('status');
2584
                    $element->setOptions(['label' => 'LABEL_STATUS']);
2585
                    $element->setAttributes(['class' => 'form-control']);
2586
                    echo $this->formLabel($element);
2587
                    echo $this->formSelect($element);
2588
                ?>
2589
                </div>
2590
          	</div>
2591
 
2592
 
2593
         	<div class="modal-footer">
2594
    			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
2595
    			<button type="button" class="btn btn-default btn-status-close">LABEL_CANCEL</button>
2596
          	</div>
2597
      	<?php echo $this->form()->closeTag($form); ?>
2598
    	</div>
2599
	</div>
2600
</div>
2601
 
2602
<div class="modal" tabindex="-1" role="dialog" id="title-box">
2603
	<div class="modal-dialog" role="document">
2604
	      		<?php
2605
			$form = $this->formTitle;
2606
            $form->setAttributes([
2607
                'method' => 'post',
2608
                'name' => 'form-title',
2609
                'id' => 'form-title'
2610
            ]);
2611
            $form->prepare();
2612
            echo $this->form()->openTag($form);
2613
            ?>
2614
    	<div class="modal-content">
2615
      		<div class="modal-header">
2616
        		<h3 class="modal-title">LABEL_TITLE</h3>
2617
      		</div>
2618
          	<div class="modal-body">
2619
                <div class="form-group">
2620
        			<?php
2621
                    $element = $form->get('title');
2622
                    $element->setOptions(['label' => 'LABEL_TITLE']);
2623
                    $element->setAttributes(['class' => 'form-control']);
2624
                    echo $this->formLabel($element);
2625
                    echo $this->formText($element);
2626
                ?>
2627
                </div>
2628
          	</div>
2629
 
2630
 
2631
         	<div class="modal-footer">
2632
    			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
2633
    			<button type="button" class="btn btn-default btn-title-close">LABEL_CANCEL</button>
2634
          	</div>
2635
      	<?php echo $this->form()->closeTag($form); ?>
2636
    	</div>
2637
	</div>
15045 stevensc 2638
</div>