Proyectos de Subversion LeadersLinked - Backend

Rev

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

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