1384 |
efrain |
1 |
<?php
|
|
|
2 |
$acl = $this->viewModel()->getRoot()->getVariable('acl');
|
|
|
3 |
$currentUser = $this->currentUserHelper();
|
|
|
4 |
|
|
|
5 |
$roleName = $currentUser->getUserTypeId();
|
|
|
6 |
|
|
|
7 |
$routeDashboard = $this->url('dashboard');
|
1477 |
efrain |
8 |
$routeDatatable = $this->url('recruitment-and-selection/vacancies');
|
|
|
9 |
$routeAdd = $this->url('recruitment-and-selection/vacancies/add');
|
1384 |
efrain |
10 |
|
15457 |
efrain |
11 |
|
1477 |
efrain |
12 |
$allowAdd = $acl->isAllowed($roleName, 'recruitment-and-selection/vacancies/add') ? 1 : 0;
|
|
|
13 |
$allowEdit = $acl->isAllowed($roleName, 'recruitment-and-selection/vacancies/edit') ? 1 : 0;
|
|
|
14 |
$allowDelete = $acl->isAllowed($roleName, 'recruitment-and-selection/vacancies/delete') ? 1 : 0;
|
|
|
15 |
|
|
|
16 |
|
15457 |
efrain |
17 |
$this->inlineScript()->appendFile('https://maps.googleapis.com/maps/api/js?key=' . $google_map_key . '&libraries=places');
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
|
|
|
24 |
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
|
|
|
28 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
|
|
|
29 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
|
|
|
30 |
|
|
|
31 |
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
|
|
|
32 |
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
|
|
|
33 |
|
|
|
34 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
|
|
|
35 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
|
|
|
36 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
|
|
|
37 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
|
|
|
38 |
|
|
|
39 |
|
1384 |
efrain |
40 |
$this->headLink()->appendStylesheet($this->basePath('plugins/select2/css/select2.min.css'));
|
|
|
41 |
$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css'));
|
|
|
42 |
|
|
|
43 |
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/select2.full.min.js'));
|
|
|
44 |
|
15457 |
efrain |
45 |
$this->inlineScript()->appendFile($this->basePath('plugins/moment/moment-with-locales.min.js'));
|
|
|
46 |
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css'));
|
|
|
47 |
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js'));
|
|
|
48 |
|
|
|
49 |
|
1384 |
efrain |
50 |
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
|
|
|
51 |
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
|
|
|
52 |
|
15457 |
efrain |
53 |
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
|
|
|
54 |
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
|
|
|
55 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-input-number/input-number-format.jquery.js'));
|
12264 |
stevensc |
56 |
|
15457 |
efrain |
57 |
// bootbox Alert //
|
|
|
58 |
$this->inlineScript()->appendFile($this->basePath('plugins/bootbox/bootbox.min.js'));
|
|
|
59 |
|
|
|
60 |
// JsRender //
|
|
|
61 |
$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.min.js'));
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
// Page Styles
|
|
|
65 |
$this->headLink()->appendStylesheet($this->basePath('css/pages/self-evaluation.css'));
|
|
|
66 |
|
|
|
67 |
|
|
|
68 |
$status_active = \LeadersLinked\Model\RecruitmentSelectionVacancy::STATUS_ACTIVE;
|
|
|
69 |
$status_inactive = \LeadersLinked\Model\RecruitmentSelectionVacancy::STATUS_INACTIVE;
|
|
|
70 |
|
|
|
71 |
$this->inlineScript()->captureStart();
|
|
|
72 |
echo <<<JS
|
|
|
73 |
jQuery(document).ready(function($) {
|
15461 |
efrain |
74 |
|
|
|
75 |
|
|
|
76 |
|
15457 |
efrain |
77 |
var allowEdit = $allowEdit;
|
|
|
78 |
var allowDelete = $allowDelete;
|
|
|
79 |
|
15461 |
efrain |
80 |
$.validator.setDefaults({
|
|
|
81 |
debug: true,
|
|
|
82 |
highlight: function(element) {
|
|
|
83 |
$(element).addClass('is-invalid');
|
|
|
84 |
},
|
|
|
85 |
unhighlight: function(element) {
|
|
|
86 |
$(element).removeClass('is-invalid');
|
|
|
87 |
},
|
|
|
88 |
errorElement: 'span',
|
|
|
89 |
errorClass: 'error invalid-feedback',
|
|
|
90 |
errorPlacement: function(error, element) {
|
|
|
91 |
if(element.parent('.form-group').length) {
|
|
|
92 |
error.insertAfter(element);
|
|
|
93 |
} else if(element.parent('.toggle').length) {
|
|
|
94 |
error.insertAfter(element.parent().parent());
|
|
|
95 |
} else {
|
|
|
96 |
error.insertAfter(element.parent());
|
|
|
97 |
}
|
|
|
98 |
}
|
|
|
99 |
});
|
|
|
100 |
|
|
|
101 |
|
|
|
102 |
$.fn.showFormErrorValidator = function(fieldname, errors) {
|
|
|
103 |
var field = $(fieldname);
|
|
|
104 |
if(field) {
|
|
|
105 |
$(field).addClass('is-invalid');
|
|
|
106 |
|
|
|
107 |
|
|
|
108 |
var error = $('<span id="' + fieldname +'-error" class="error invalid-feedback">' + errors + '</div>');
|
|
|
109 |
if(field.parent('.form-group').length) {
|
|
|
110 |
error.insertAfter(field);
|
|
|
111 |
} else if(field.parent('.toggle').length) {
|
|
|
112 |
error.insertAfter(field.parent().parent());
|
|
|
113 |
} else {
|
|
|
114 |
error.insertAfter(field.parent());
|
|
|
115 |
}
|
|
|
116 |
}
|
|
|
117 |
};
|
|
|
118 |
|
|
|
119 |
|
|
|
120 |
|
15457 |
efrain |
121 |
var gridTable = $('#gridTable').dataTable({
|
|
|
122 |
'processing': true,
|
|
|
123 |
'serverSide': true,
|
|
|
124 |
'searching': true,
|
|
|
125 |
'order': [
|
|
|
126 |
[0, 'asc']
|
|
|
127 |
],
|
|
|
128 |
'ordering': true,
|
|
|
129 |
'ordenable': true,
|
|
|
130 |
'responsive': true,
|
|
|
131 |
'select': false,
|
|
|
132 |
'paging': true,
|
|
|
133 |
'pagingType': 'simple_numbers',
|
|
|
134 |
'ajax': {
|
|
|
135 |
'url': '$routeDatatable',
|
|
|
136 |
'type': 'get',
|
|
|
137 |
'beforeSend': function(request) {
|
|
|
138 |
NProgress.start();
|
|
|
139 |
},
|
|
|
140 |
'dataFilter': function(response) {
|
|
|
141 |
var response = jQuery.parseJSON(response);
|
|
|
142 |
var json = {};
|
|
|
143 |
json.recordsTotal = 0;
|
|
|
144 |
json.recordsFiltered = 0;
|
|
|
145 |
json.data = [];
|
|
|
146 |
if (response.success) {
|
|
|
147 |
json.recordsTotal = response.data.total;
|
|
|
148 |
json.recordsFiltered = response.data.total;
|
|
|
149 |
json.data = response.data.items;
|
|
|
150 |
} else {
|
|
|
151 |
$.fn.showError(response.data)
|
|
|
152 |
}
|
|
|
153 |
return JSON.stringify(json);
|
|
|
154 |
}
|
|
|
155 |
},
|
|
|
156 |
'language': {
|
|
|
157 |
'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
|
|
|
158 |
'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
|
|
|
159 |
'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
|
|
|
160 |
'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
|
|
|
161 |
'sInfo': 'LABEL_DATATABLE_SINFO',
|
|
|
162 |
'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
|
|
|
163 |
'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
|
|
|
164 |
'sInfoPostFix': '',
|
|
|
165 |
'sSearch': 'LABEL_DATATABLE_SSEARCH',
|
|
|
166 |
'sUrl': '',
|
|
|
167 |
'sInfoThousands': ',',
|
|
|
168 |
'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
|
|
|
169 |
'oPaginate': {
|
|
|
170 |
'sFirst': 'LABEL_DATATABLE_SFIRST',
|
|
|
171 |
'sLast': 'LABEL_DATATABLE_SLAST',
|
|
|
172 |
'sNext': 'LABEL_DATATABLE_SNEXT',
|
|
|
173 |
'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
|
|
|
174 |
},
|
|
|
175 |
'oAria': {
|
|
|
176 |
'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
|
|
|
177 |
'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
|
|
|
178 |
},
|
|
|
179 |
},
|
|
|
180 |
'drawCallback': function(settings) {
|
|
|
181 |
NProgress.done();
|
|
|
182 |
$('button.btn-delete').confirmation({
|
|
|
183 |
rootSelector: 'button.btn-delete',
|
|
|
184 |
title: 'LABEL_ARE_YOU_SURE',
|
|
|
185 |
singleton: true,
|
|
|
186 |
btnOkLabel: 'LABEL_YES',
|
|
|
187 |
btnCancelLabel: 'LABEL_NO',
|
|
|
188 |
onConfirm: function(value) {
|
|
|
189 |
action = $(this).data('href');
|
|
|
190 |
NProgress.start();
|
|
|
191 |
$.ajax({
|
|
|
192 |
'dataType': 'json',
|
|
|
193 |
'accept': 'application/json',
|
|
|
194 |
'method': 'post',
|
|
|
195 |
'url': action,
|
|
|
196 |
}).done(function(response) {
|
|
|
197 |
if (response['success']) {
|
|
|
198 |
$.fn.showSuccess(response['data']);
|
|
|
199 |
gridTable.api().ajax.reload(null, false);
|
|
|
200 |
} else {
|
|
|
201 |
$.fn.showError(response['data']);
|
|
|
202 |
}
|
|
|
203 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
204 |
$.fn.showError(textStatus);
|
|
|
205 |
}).always(function() {
|
|
|
206 |
NProgress.done();
|
|
|
207 |
});
|
|
|
208 |
},
|
|
|
209 |
});
|
|
|
210 |
},
|
|
|
211 |
'aoColumns': [
|
|
|
212 |
{ 'mDataProp': 'name' },
|
|
|
213 |
{ 'mDataProp': 'job_description' },
|
|
|
214 |
{ 'mDataProp': 'last_date' },
|
|
|
215 |
{ 'mDataProp': 'status' },
|
|
|
216 |
{ 'mDataProp': 'actions' },
|
|
|
217 |
],
|
|
|
218 |
'columnDefs': [
|
|
|
219 |
{
|
|
|
220 |
'targets': 0,
|
|
|
221 |
'className': 'text-vertical-middle',
|
|
|
222 |
},
|
|
|
223 |
{
|
|
|
224 |
'targets': 1,
|
|
|
225 |
'className': 'text-vertical-middle',
|
|
|
226 |
},
|
|
|
227 |
{
|
|
|
228 |
'targets': 2,
|
|
|
229 |
'className': 'text-vertical-middle',
|
|
|
230 |
},
|
|
|
231 |
{
|
|
|
232 |
'targets': 3,
|
|
|
233 |
'className': 'text-vertical-middle',
|
|
|
234 |
},
|
|
|
235 |
{
|
|
|
236 |
'targets': -1,
|
|
|
237 |
'orderable': false,
|
|
|
238 |
'render': function(data, type, row) {
|
|
|
239 |
s = '';
|
|
|
240 |
if (allowEdit) {
|
|
|
241 |
s = s + '<button class="btn btn-primary btn-edit" data-href="' + data['link_edit'] + '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button> ';
|
|
|
242 |
}
|
|
|
243 |
if (allowDelete) {
|
|
|
244 |
s = s + '<button class="btn btn-danger btn-delete" data-href="' + data['link_delete'] + '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button> ';
|
|
|
245 |
}
|
|
|
246 |
return s;
|
|
|
247 |
}
|
|
|
248 |
}
|
|
|
249 |
],
|
|
|
250 |
});
|
|
|
251 |
|
|
|
252 |
$.validator.addMethod('checkLocation', function (value, element, param) {
|
|
|
253 |
var otherElement = $(param);
|
|
|
254 |
return $.trim(otherElement.val()).length > 0;
|
|
|
255 |
}, 'ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY');
|
|
|
256 |
|
15461 |
efrain |
257 |
|
15457 |
efrain |
258 |
var autocompleteLocation = new google.maps.places.Autocomplete(
|
|
|
259 |
(document.getElementById('location_search')),
|
|
|
260 |
{types: ['(cities)']}
|
|
|
261 |
);
|
|
|
262 |
|
15461 |
efrain |
263 |
|
15457 |
efrain |
264 |
$.fn.fillInAddressLocation = function() {
|
15461 |
efrain |
265 |
|
|
|
266 |
|
15457 |
efrain |
267 |
var place = autocompleteLocation.getPlace();
|
|
|
268 |
if (!place.geometry) {
|
|
|
269 |
$.fn.showError('ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY')
|
|
|
270 |
return;
|
|
|
271 |
} else {
|
15461 |
efrain |
272 |
|
15457 |
efrain |
273 |
address1 = '';
|
|
|
274 |
address2 = '';
|
|
|
275 |
city1 = '';
|
|
|
276 |
city2 = '';
|
|
|
277 |
state = '';
|
|
|
278 |
country = '';
|
|
|
279 |
postal_code = '';
|
|
|
280 |
|
|
|
281 |
formatted_address = place.formatted_address;
|
|
|
282 |
latitude = place.geometry.location.lat();
|
|
|
283 |
longitude = place.geometry.location.lng();
|
|
|
284 |
var arrAddress = place.address_components;
|
15461 |
efrain |
285 |
|
|
|
286 |
|
15457 |
efrain |
287 |
$.each(arrAddress, function(i, address_component) {
|
|
|
288 |
if (address_component.types[0] == "route") {
|
|
|
289 |
address1 = address_component.long_name;
|
|
|
290 |
}
|
|
|
291 |
if (address_component.types[0] == "sublocality") {
|
|
|
292 |
address2 = address_component.long_name;
|
|
|
293 |
}
|
|
|
294 |
if (address_component.types[0] == "locality") {
|
|
|
295 |
city1 = address_component.long_name;
|
|
|
296 |
}
|
|
|
297 |
if (address_component.types[0] == "administrative_area_level_2") {
|
|
|
298 |
city2 = address_component.long_name;
|
|
|
299 |
}
|
|
|
300 |
if (address_component.types[0] == "administrative_area_level_1") {
|
|
|
301 |
state = address_component.long_name;
|
|
|
302 |
}
|
|
|
303 |
if (address_component.types[0] == "country") {
|
|
|
304 |
country = address_component.long_name;
|
|
|
305 |
}
|
|
|
306 |
if (address_component.types[0] == "postal_code") {
|
|
|
307 |
postal_code = address_component.long_name;
|
|
|
308 |
}
|
|
|
309 |
});
|
|
|
310 |
|
15461 |
efrain |
311 |
|
|
|
312 |
$('#form #formatted_address').val(formatted_address);
|
|
|
313 |
$('#form #address1').val(address1);
|
|
|
314 |
$('#form #address2').val(address2);
|
|
|
315 |
$('#form #city1').val(city1);
|
|
|
316 |
$('#form #city2').val(city2);
|
|
|
317 |
$('#form #state').val(state);
|
|
|
318 |
$('#form #country').val(country);
|
|
|
319 |
$('#form #postal_code').val(postal_code);
|
|
|
320 |
$('#form #latitude').val(latitude);
|
|
|
321 |
$('#form #longitude').val(longitude);
|
|
|
322 |
|
9427 |
stevensc |
323 |
}
|
15457 |
efrain |
324 |
}
|
|
|
325 |
|
15461 |
efrain |
326 |
|
|
|
327 |
|
|
|
328 |
autocompleteLocation.addListener('place_changed', $.fn.fillInAddressLocation);
|
|
|
329 |
|
|
|
330 |
var validator = $('#form').validate({
|
|
|
331 |
debug: true,
|
|
|
332 |
onclick: true,
|
|
|
333 |
onkeyup: false,
|
|
|
334 |
ignore: [],
|
|
|
335 |
rules: {
|
|
|
336 |
'name': {
|
|
|
337 |
required: true,
|
|
|
338 |
maxlength: 128,
|
|
|
339 |
},
|
|
|
340 |
'job_description_id': {
|
|
|
341 |
required: true,
|
|
|
342 |
|
|
|
343 |
},
|
|
|
344 |
'job_category_id' : {
|
|
|
345 |
required: true,
|
|
|
346 |
|
|
|
347 |
},
|
|
|
348 |
'industry_id' : {
|
|
|
349 |
required: true,
|
|
|
350 |
|
|
|
351 |
},
|
|
|
352 |
'description': {
|
|
|
353 |
updateCkeditor:function() {
|
|
|
354 |
CKEDITOR.instances.description.updateElement();
|
|
|
355 |
},
|
|
|
356 |
required: true
|
|
|
357 |
},
|
|
|
358 |
'location_search': {
|
|
|
359 |
required: true,
|
15462 |
efrain |
360 |
//checkLocation: '#form #latitude',
|
15461 |
efrain |
361 |
},
|
|
|
362 |
'last_date' : {
|
|
|
363 |
required: true,
|
|
|
364 |
|
|
|
365 |
},
|
|
|
366 |
'status': {
|
|
|
367 |
required: false,
|
|
|
368 |
|
|
|
369 |
},
|
|
|
370 |
},
|
|
|
371 |
submitHandler: function(form)
|
|
|
372 |
{
|
|
|
373 |
|
|
|
374 |
$.ajax({
|
|
|
375 |
'dataType' : 'json',
|
|
|
376 |
'accept' : 'application/json',
|
|
|
377 |
'method' : 'post',
|
|
|
378 |
'url' : $('#form').attr('action'),
|
|
|
379 |
'data' : $('#form').serialize()
|
|
|
380 |
}).done(function(response) {
|
|
|
381 |
NProgress.start();
|
|
|
382 |
if(response['success']) {
|
|
|
383 |
$.fn.showSuccess(response['data']);
|
|
|
384 |
|
|
|
385 |
$('#section-title').html('LABEL_VACANCIES');
|
|
|
386 |
$('#row-form').hide();
|
|
|
387 |
$('#row-list').show();
|
|
|
388 |
|
|
|
389 |
|
|
|
390 |
gridTable.api().ajax.reload(null, false);
|
|
|
391 |
} else {
|
|
|
392 |
validator.resetForm();
|
|
|
393 |
if(jQuery.type(response['data']) == 'string') {
|
|
|
394 |
$.fn.showError(response['data']);
|
|
|
395 |
} else {
|
|
|
396 |
$.each(response['data'], function( fieldname, errors ) {
|
|
|
397 |
$.fn.showFormErrorValidator('#form #' + fieldname, errors);
|
|
|
398 |
});
|
|
|
399 |
}
|
|
|
400 |
}
|
|
|
401 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
402 |
$.fn.showError(textStatus);
|
|
|
403 |
}).always(function() {
|
|
|
404 |
NProgress.done();
|
|
|
405 |
|
|
|
406 |
});
|
|
|
407 |
return false;
|
|
|
408 |
},
|
|
|
409 |
invalidHandler: function(form, validator) {
|
|
|
410 |
|
|
|
411 |
}
|
|
|
412 |
});
|
|
|
413 |
|
|
|
414 |
|
|
|
415 |
|
|
|
416 |
|
|
|
417 |
|
|
|
418 |
|
15457 |
efrain |
419 |
|
15461 |
efrain |
420 |
|
|
|
421 |
$('body').on('click', 'button.btn-edit', function(e) {
|
|
|
422 |
e.preventDefault();
|
|
|
423 |
form_id = $(this).data('id')
|
|
|
424 |
var action = $(this).data('href');
|
|
|
425 |
$.ajax({
|
|
|
426 |
'dataType': 'json',
|
|
|
427 |
'accept': 'application/json',
|
|
|
428 |
'method': 'get',
|
|
|
429 |
'url': action,
|
|
|
430 |
}).done(function(response) {
|
|
|
431 |
if (response['success']) {
|
|
|
432 |
$('#section-title').html('LABEL_EDIT_VACANCY');
|
|
|
433 |
|
|
|
434 |
$('#form').attr('action', action);
|
|
|
435 |
$('#form #name').val(response['data']['name']);
|
|
|
436 |
$('#form #job_description_id').val(response['data']['job_description_id']).trigger('change');
|
|
|
437 |
$('#form #job_category_id').val(response['data']['job_category_id']).trigger('change');
|
|
|
438 |
$('#form #industry_id').val(response['data']['industry_id']).trigger('change');
|
|
|
439 |
$('#form #location_search').val(response['data']['location_search']);
|
|
|
440 |
$('#form #formatted_address').val(response['data']['formatted_address']);
|
|
|
441 |
$('#form #address1').val(response['data']['address1']);
|
|
|
442 |
$('#form #address2').val(response['data']['address2']);
|
|
|
443 |
$('#form #city1').val(response['data']['city1']);
|
|
|
444 |
$('#form #city2').val(response['data']['city2']);
|
|
|
445 |
$('#form #state').val(response['data']['state']);
|
|
|
446 |
$('#form #country').val(response['data']['country']);
|
|
|
447 |
$('#form #postal_code').val(response['data']['postal_code']);
|
|
|
448 |
$('#form #latitude').val(response['data']['latitude']);
|
|
|
449 |
$('#form #longitude').val(response['data']['longitude']);
|
|
|
450 |
$('#form #last_date').val(response['data']['last_date']);
|
|
|
451 |
$('#form #status').bootstrapToggle(response['data']['status'] == '$status_active' ? 'on' : 'off')
|
|
|
452 |
CKEDITOR.instances['description'].setData(response['data']['description']);
|
|
|
453 |
$('#row-list').hide();
|
|
|
454 |
$('#row-form').show();
|
|
|
455 |
|
|
|
456 |
} else {
|
|
|
457 |
$.fn.showError(response['message']);
|
|
|
458 |
}
|
|
|
459 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
460 |
$.fn.showError(textStatus);
|
|
|
461 |
});
|
|
|
462 |
});
|
|
|
463 |
|
|
|
464 |
$('#form #last_date').datetimepicker({
|
|
|
465 |
locale: 'es',
|
|
|
466 |
format: 'DD/MM/YYYY'
|
|
|
467 |
});
|
|
|
468 |
|
|
|
469 |
$('button.btn-add').click(function(e) {
|
|
|
470 |
$('#section-title').html('LABEL_NEW_VACANCY');
|
|
|
471 |
|
|
|
472 |
|
|
|
473 |
$('#form').attr('action', '$routeAdd');
|
|
|
474 |
$('#form #name').val('');
|
|
|
475 |
$('#form #job_description_id').val('').trigger('change');
|
|
|
476 |
$('#form #job_category_id').val('').trigger('change');
|
|
|
477 |
$('#form #industry_id').val('').trigger('change');
|
|
|
478 |
|
|
|
479 |
$('#form #location_search').val('');
|
|
|
480 |
$('#form #address1').val('');
|
|
|
481 |
$('#form #address2').val('');
|
|
|
482 |
$('#form #city1').val('');
|
|
|
483 |
$('#form #city2').val('');
|
|
|
484 |
$('#form #state').val('');
|
|
|
485 |
$('#form #country').val('');
|
|
|
486 |
$('#form #postal_code').val('');
|
|
|
487 |
$('#form #latitude').val('');
|
|
|
488 |
$('#form #longitude').val('');
|
|
|
489 |
|
|
|
490 |
$('#form #last_date').val('');
|
|
|
491 |
$('#form #status').bootstrapToggle('on')
|
|
|
492 |
|
|
|
493 |
CKEDITOR.instances['description'].setData('');
|
|
|
494 |
|
|
|
495 |
$('#row-list').hide();
|
|
|
496 |
$('#row-form').show();
|
|
|
497 |
$('#form #name').focus();
|
|
|
498 |
return;
|
|
|
499 |
});
|
|
|
500 |
|
|
|
501 |
|
|
|
502 |
|
|
|
503 |
|
15457 |
efrain |
504 |
$('button.btn-edit-cancel').click(function(e) {
|
|
|
505 |
$('#row-form').hide();
|
|
|
506 |
$('#row-list').show();
|
15461 |
efrain |
507 |
|
|
|
508 |
$('#section-title').html('LABEL_VACANCIES');
|
15457 |
efrain |
509 |
return;
|
|
|
510 |
});
|
|
|
511 |
|
|
|
512 |
$('body').on('click', 'button.btn-refresh', function (e) {
|
|
|
513 |
e.preventDefault();
|
|
|
514 |
gridTable.api().ajax.reload(null, false);
|
|
|
515 |
|
|
|
516 |
});
|
|
|
517 |
|
|
|
518 |
$('#job_description_id').select2({
|
|
|
519 |
theme: 'bootstrap4',
|
|
|
520 |
width: '100%',
|
|
|
521 |
});
|
|
|
522 |
|
|
|
523 |
|
|
|
524 |
$('#job_category_id').select2({
|
|
|
525 |
theme: 'bootstrap4',
|
|
|
526 |
width: '100%',
|
|
|
527 |
});
|
|
|
528 |
|
|
|
529 |
|
|
|
530 |
$('#industry_id').select2({
|
|
|
531 |
theme: 'bootstrap4',
|
|
|
532 |
width: '100%',
|
|
|
533 |
});
|
|
|
534 |
|
|
|
535 |
|
|
|
536 |
$('#status').bootstrapToggle({
|
|
|
537 |
'on': 'LABEL_ACTIVE',
|
|
|
538 |
'off': 'LABEL_INACTIVE',
|
|
|
539 |
'width': '160px',
|
|
|
540 |
'height': '40px'
|
|
|
541 |
});
|
|
|
542 |
|
|
|
543 |
|
15461 |
efrain |
544 |
|
15457 |
efrain |
545 |
|
|
|
546 |
|
|
|
547 |
|
|
|
548 |
|
|
|
549 |
CKEDITOR.replace('description', {
|
|
|
550 |
toolbar: [
|
|
|
551 |
{ name: 'editing', items: ['Scayt'] },
|
|
|
552 |
{ name: 'links', items: ['Link', 'Unlink'] },
|
|
|
553 |
{ name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
|
|
|
554 |
{ name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
|
|
|
555 |
'/',
|
|
|
556 |
{ name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
|
|
|
557 |
{ name: 'styles', items: ['Styles', 'Format'] },
|
|
|
558 |
{ name: 'tools', items: ['Maximize'] }
|
|
|
559 |
],
|
|
|
560 |
removePlugins: 'elementspath,Anchor',
|
|
|
561 |
heigth: 100
|
|
|
562 |
});
|
|
|
563 |
});
|
9427 |
stevensc |
564 |
JS;
|
9469 |
stevensc |
565 |
|
15457 |
efrain |
566 |
$this->inlineScript()->captureEnd();
|
9469 |
stevensc |
567 |
|
1384 |
efrain |
568 |
?>
|
|
|
569 |
<!-- Content Header (Page header) -->
|
9427 |
stevensc |
570 |
|
15461 |
efrain |
571 |
|
15457 |
efrain |
572 |
<section class="content-header">
|
|
|
573 |
<div class="container-fluid">
|
|
|
574 |
<div class="row mb-2">
|
|
|
575 |
<div class="col-sm-12">
|
15461 |
efrain |
576 |
<h1 id="section-title"></h1>
|
15457 |
efrain |
577 |
</div>
|
|
|
578 |
</div>
|
|
|
579 |
</div>
|
|
|
580 |
<!-- /.container-fluid -->
|
|
|
581 |
</section>
|
|
|
582 |
<section class="content">
|
15461 |
efrain |
583 |
<div class="container-fluid">
|
|
|
584 |
<div class="row" id="row-list">
|
15457 |
efrain |
585 |
<div class="col-12">
|
|
|
586 |
<div class="card">
|
|
|
587 |
<div class="card-body">
|
|
|
588 |
<table id="gridTable" class="table table-hover">
|
|
|
589 |
<thead>
|
|
|
590 |
<tr>
|
|
|
591 |
<th>LABEL_NAME</th>
|
|
|
592 |
<th>LABEL_JOB_DESCRIPTION</th>
|
|
|
593 |
<th>LABEL_LAST_DATE</th>
|
|
|
594 |
<th>LABEL_STATUS</th>
|
|
|
595 |
<th>LABEL_ACTIONS</th>
|
|
|
596 |
</tr>
|
|
|
597 |
</thead>
|
|
|
598 |
<tbody>
|
|
|
599 |
</tbody>
|
|
|
600 |
</table>
|
|
|
601 |
</div>
|
|
|
602 |
<div class="card-footer clearfix">
|
|
|
603 |
<div style="float:right;">
|
|
|
604 |
<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
|
|
|
605 |
<?php if ($allowAdd) : ?>
|
|
|
606 |
<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
|
|
|
607 |
<?php endif; ?>
|
|
|
608 |
</div>
|
|
|
609 |
</div>
|
|
|
610 |
</div>
|
|
|
611 |
</div>
|
|
|
612 |
</div>
|
|
|
613 |
</div>
|
|
|
614 |
|
|
|
615 |
|
|
|
616 |
<!-- Create/Edit Form -->
|
|
|
617 |
<div class="row" id="row-form" style="display: none; padding: 16px;">
|
|
|
618 |
<div class="col-xs-12 col-md-12">
|
|
|
619 |
<?php
|
|
|
620 |
$form = $this->form;
|
|
|
621 |
$form->setAttributes([
|
|
|
622 |
'method' => 'post',
|
15461 |
efrain |
623 |
'name' => 'form',
|
|
|
624 |
'id' => 'form'
|
15457 |
efrain |
625 |
]);
|
|
|
626 |
|
|
|
627 |
$form->prepare();
|
|
|
628 |
echo $this->form()->openTag($form);
|
|
|
629 |
|
|
|
630 |
$fields = ['formatted_address',
|
|
|
631 |
'address1',
|
|
|
632 |
'address2',
|
|
|
633 |
'country',
|
|
|
634 |
'state',
|
|
|
635 |
'city1',
|
|
|
636 |
'city2',
|
|
|
637 |
'postal_code',
|
|
|
638 |
'latitude',
|
|
|
639 |
'longitude',
|
|
|
640 |
];
|
|
|
641 |
|
|
|
642 |
foreach($fields as $field)
|
|
|
643 |
{
|
|
|
644 |
$element = $form->get($field);
|
|
|
645 |
echo $this->formHidden($element);
|
|
|
646 |
}
|
|
|
647 |
|
|
|
648 |
?>
|
|
|
649 |
<div class="form-group">
|
|
|
650 |
<?php
|
|
|
651 |
$element = $form->get('name');
|
|
|
652 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
653 |
$element->setOptions(['label' => 'LABEL_NAME']);
|
|
|
654 |
|
|
|
655 |
echo $this->formLabel($element);
|
|
|
656 |
echo $this->formText($element);
|
|
|
657 |
?>
|
|
|
658 |
</div>
|
|
|
659 |
<div class="form-group">
|
|
|
660 |
<?php
|
|
|
661 |
$element = $form->get('job_description_id');
|
|
|
662 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
663 |
$element->setOptions(['label' => 'LABEL_POSITION_EVALUATED']);
|
|
|
664 |
|
|
|
665 |
echo $this->formLabel($element);
|
|
|
666 |
echo $this->formSelect($element);
|
|
|
667 |
?>
|
|
|
668 |
</div>
|
|
|
669 |
<div class="form-group">
|
|
|
670 |
<?php
|
|
|
671 |
$element = $form->get('job_category_id');
|
|
|
672 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
673 |
$element->setOptions(['label' => 'LABEL_JOB_CATEGORY']);
|
|
|
674 |
|
|
|
675 |
echo $this->formLabel($element);
|
|
|
676 |
echo $this->formSelect($element);
|
|
|
677 |
?>
|
|
|
678 |
</div>
|
|
|
679 |
<div class="form-group">
|
|
|
680 |
<?php
|
|
|
681 |
$element = $form->get('location_search');
|
|
|
682 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
683 |
$element->setOptions(['label' => 'LABEL_LOCATION']);
|
|
|
684 |
|
|
|
685 |
echo $this->formLabel($element);
|
|
|
686 |
echo $this->formText($element);
|
|
|
687 |
?>
|
|
|
688 |
</div>
|
|
|
689 |
<div class="form-group">
|
|
|
690 |
<?php
|
|
|
691 |
$element = $form->get('industry_id');
|
|
|
692 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
693 |
$element->setOptions(['label' => 'LABEL_INDUSTRY']);
|
|
|
694 |
|
|
|
695 |
echo $this->formLabel($element);
|
|
|
696 |
echo $this->formSelect($element);
|
|
|
697 |
?>
|
|
|
698 |
</div>
|
|
|
699 |
<div class="form-group">
|
|
|
700 |
<?php
|
|
|
701 |
$element = $form->get('last_date');
|
|
|
702 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
703 |
$element->setOptions(['label' => 'LABEL_LAST_DATE_OF_APPLICATION']);
|
|
|
704 |
|
|
|
705 |
echo $this->formLabel($element);
|
|
|
706 |
echo $this->formText($element);
|
|
|
707 |
?>
|
|
|
708 |
</div>
|
|
|
709 |
<div class="form-group">
|
|
|
710 |
<?php
|
|
|
711 |
$element = $form->get('description');
|
|
|
712 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
713 |
$element->setOptions(['label' => 'LABEL_DESCRIPTION']);
|
|
|
714 |
|
|
|
715 |
echo $this->formLabel($element);
|
|
|
716 |
echo $this->formTextArea($element);
|
|
|
717 |
?>
|
|
|
718 |
</div>
|
15461 |
efrain |
719 |
<div class="form-group">
|
15457 |
efrain |
720 |
<?php
|
|
|
721 |
$element = $form->get('status');
|
|
|
722 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
723 |
$element->setOptions(['label' => 'LABEL_STATUS']);
|
|
|
724 |
echo $this->formLabel($element);
|
15461 |
efrain |
725 |
?>
|
|
|
726 |
<br/>
|
|
|
727 |
<?php
|
|
|
728 |
|
15457 |
efrain |
729 |
echo $this->formCheckbox($element);
|
|
|
730 |
?>
|
15461 |
efrain |
731 |
|
15457 |
efrain |
732 |
</div>
|
|
|
733 |
|
|
|
734 |
|
|
|
735 |
|
|
|
736 |
<div class="form-group">
|
15461 |
efrain |
737 |
<button type="submit" class="btn btn-primary btn-form-save-close">LABEL_SAVE</button>
|
15457 |
efrain |
738 |
<button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
|
|
|
739 |
</div>
|
|
|
740 |
<?php echo $this->form()->closeTag($form); ?>
|
|
|
741 |
</div>
|
|
|
742 |
</div>
|
|
|
743 |
<!-- Create/Edit Form-->
|
|
|
744 |
|
|
|
745 |
</section>
|