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 |
|
|
|
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 |
|
1384 |
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 |
|
|
|
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 |
|
|
|
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 |
|
|
|
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 |
|
|
|
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'));
|
|
|
56 |
|
|
|
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 |
|
1388 |
eleazar |
68 |
$status_active = \LeadersLinked\Model\RecruitmentSelectionVacancy::STATUS_ACTIVE;
|
|
|
69 |
$status_inactive = \LeadersLinked\Model\RecruitmentSelectionVacancy::STATUS_INACTIVE;
|
1384 |
efrain |
70 |
|
|
|
71 |
$this->inlineScript()->captureStart();
|
|
|
72 |
echo <<<JS
|
|
|
73 |
jQuery(document).ready(function($) {
|
|
|
74 |
var allowEdit = $allowEdit;
|
|
|
75 |
var allowDelete = $allowDelete;
|
|
|
76 |
var sections = [];
|
|
|
77 |
/**
|
|
|
78 |
* Get rows and set data table
|
|
|
79 |
*/
|
1414 |
eleazar |
80 |
|
1435 |
eleazar |
81 |
|
1384 |
efrain |
82 |
var tableForm = $('#gridTable').dataTable({
|
|
|
83 |
'processing': true,
|
|
|
84 |
'serverSide': true,
|
|
|
85 |
'searching': true,
|
|
|
86 |
'order': [
|
|
|
87 |
[0, 'asc']
|
|
|
88 |
],
|
|
|
89 |
'ordering': true,
|
|
|
90 |
'ordenable': true,
|
|
|
91 |
'responsive': true,
|
|
|
92 |
'select': false,
|
|
|
93 |
'paging': true,
|
|
|
94 |
'pagingType': 'simple_numbers',
|
|
|
95 |
'ajax': {
|
|
|
96 |
'url': '$routeDatatable',
|
|
|
97 |
'type': 'get',
|
|
|
98 |
'beforeSend': function(request) {
|
|
|
99 |
NProgress.start();
|
|
|
100 |
},
|
|
|
101 |
'dataFilter': function(response) {
|
|
|
102 |
var response = jQuery.parseJSON(response);
|
|
|
103 |
var json = {};
|
|
|
104 |
json.recordsTotal = 0;
|
|
|
105 |
json.recordsFiltered = 0;
|
|
|
106 |
json.data = [];
|
|
|
107 |
if (response.success) {
|
|
|
108 |
json.recordsTotal = response.data.total;
|
|
|
109 |
json.recordsFiltered = response.data.total;
|
|
|
110 |
json.data = response.data.items;
|
|
|
111 |
} else {
|
|
|
112 |
$.fn.showError(response.data)
|
|
|
113 |
}
|
|
|
114 |
return JSON.stringify(json);
|
|
|
115 |
}
|
|
|
116 |
},
|
|
|
117 |
'language': {
|
|
|
118 |
'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
|
|
|
119 |
'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
|
|
|
120 |
'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
|
|
|
121 |
'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
|
|
|
122 |
'sInfo': 'LABEL_DATATABLE_SINFO',
|
|
|
123 |
'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
|
|
|
124 |
'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
|
|
|
125 |
'sInfoPostFix': '',
|
|
|
126 |
'sSearch': 'LABEL_DATATABLE_SSEARCH',
|
|
|
127 |
'sUrl': '',
|
|
|
128 |
'sInfoThousands': ',',
|
|
|
129 |
'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
|
|
|
130 |
'oPaginate': {
|
|
|
131 |
'sFirst': 'LABEL_DATATABLE_SFIRST',
|
|
|
132 |
'sLast': 'LABEL_DATATABLE_SLAST',
|
|
|
133 |
'sNext': 'LABEL_DATATABLE_SNEXT',
|
|
|
134 |
'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
|
|
|
135 |
},
|
|
|
136 |
'oAria': {
|
|
|
137 |
'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
|
|
|
138 |
'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
|
|
|
139 |
},
|
|
|
140 |
},
|
|
|
141 |
'drawCallback': function(settings) {
|
|
|
142 |
NProgress.done();
|
|
|
143 |
$('button.btn-delete').confirmation({
|
|
|
144 |
rootSelector: 'button.btn-delete',
|
|
|
145 |
title: 'LABEL_ARE_YOU_SURE',
|
|
|
146 |
singleton: true,
|
|
|
147 |
btnOkLabel: 'LABEL_YES',
|
|
|
148 |
btnCancelLabel: 'LABEL_NO',
|
|
|
149 |
onConfirm: function(value) {
|
|
|
150 |
action = $(this).data('href');
|
|
|
151 |
NProgress.start();
|
|
|
152 |
$.ajax({
|
|
|
153 |
'dataType': 'json',
|
|
|
154 |
'accept': 'application/json',
|
|
|
155 |
'method': 'post',
|
|
|
156 |
'url': action,
|
|
|
157 |
}).done(function(response) {
|
|
|
158 |
if (response['success']) {
|
|
|
159 |
$.fn.showSuccess(response['data']);
|
3009 |
eleazar |
160 |
tableForm.api().ajax.reload(null, false);
|
1384 |
efrain |
161 |
} else {
|
|
|
162 |
$.fn.showError(response['data']);
|
|
|
163 |
}
|
|
|
164 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
165 |
$.fn.showError(textStatus);
|
|
|
166 |
}).always(function() {
|
|
|
167 |
NProgress.done();
|
|
|
168 |
});
|
|
|
169 |
},
|
|
|
170 |
});
|
|
|
171 |
},
|
|
|
172 |
'aoColumns': [{
|
|
|
173 |
'mDataProp': 'name'
|
|
|
174 |
},
|
|
|
175 |
{
|
|
|
176 |
'mDataProp': 'job_description'
|
|
|
177 |
},
|
|
|
178 |
{
|
|
|
179 |
'mDataProp': 'actions'
|
|
|
180 |
},
|
|
|
181 |
],
|
|
|
182 |
'columnDefs': [{
|
|
|
183 |
'targets': 0,
|
|
|
184 |
'className': 'text-vertical-middle',
|
|
|
185 |
},
|
|
|
186 |
{
|
|
|
187 |
'targets': 1,
|
|
|
188 |
'className': 'text-vertical-middle',
|
|
|
189 |
},
|
1449 |
eleazar |
190 |
// {
|
|
|
191 |
// 'targets': -2,
|
|
|
192 |
// 'orderable': false,
|
|
|
193 |
// 'className': 'text-center',
|
|
|
194 |
// 'render': function(data, type, row) {
|
|
|
195 |
// checked = data == 'a' ? ' checked="checked" ' : '';
|
|
|
196 |
// return '<div class="checkbox checkbox-success">' +
|
|
|
197 |
// '<input class="styled" type="checkbox" ' + checked + ' disabled="disabled">' +
|
|
|
198 |
// '<label ></label></div>';
|
|
|
199 |
// }
|
|
|
200 |
// },
|
1384 |
efrain |
201 |
{
|
|
|
202 |
'targets': -1,
|
|
|
203 |
'orderable': false,
|
|
|
204 |
'render': function(data, type, row) {
|
|
|
205 |
s = '';
|
|
|
206 |
if (allowEdit) {
|
|
|
207 |
s = s + '<button class="btn btn-primary btn-edit-form" data-href="' + data['link_edit'] + '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button> ';
|
|
|
208 |
}
|
|
|
209 |
if (allowDelete) {
|
|
|
210 |
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> ';
|
|
|
211 |
}
|
|
|
212 |
return s;
|
|
|
213 |
}
|
|
|
214 |
}
|
|
|
215 |
],
|
|
|
216 |
});
|
|
|
217 |
|
|
|
218 |
|
|
|
219 |
|
|
|
220 |
/**
|
|
|
221 |
* Clicked on edit form
|
|
|
222 |
*/
|
|
|
223 |
$('body').on('click', 'button.btn-edit-form', function(e) {
|
|
|
224 |
e.preventDefault();
|
|
|
225 |
form_id = $(this).data('id')
|
|
|
226 |
var action = $(this).data('href');
|
|
|
227 |
$.ajax({
|
|
|
228 |
'dataType': 'json',
|
|
|
229 |
'accept': 'application/json',
|
|
|
230 |
'method': 'get',
|
|
|
231 |
'url': action,
|
|
|
232 |
}).done(function(response) {
|
|
|
233 |
if (response['success']) {
|
1441 |
eleazar |
234 |
const lastDate = new Date(Date.parse(response['data']['last_date'] + " 00:00:00"));
|
|
|
235 |
|
1384 |
efrain |
236 |
$("#rows").html('');
|
|
|
237 |
sections = [];
|
|
|
238 |
$('#form-main').attr('action', action);
|
1565 |
efrain |
239 |
$('#form-main #name').val(response['data']['name']);
|
1398 |
eleazar |
240 |
$('#form-main #job_description_id').val(response['data']['job_description_id']).trigger('change');
|
1410 |
eleazar |
241 |
$('#form-main #location_search').val(response['data']['location_search']);
|
1567 |
eleazar |
242 |
$('#form-main #formatted_address').val(response['data']['formatted_address']);
|
|
|
243 |
$('#form-main #address1').val(response['data']['address1']);
|
|
|
244 |
$('#form-main #address2').val(response['data']['address2']);
|
|
|
245 |
$('#form-main #city1').val(response['data']['city1']);
|
|
|
246 |
$('#form-main #city2').val(response['data']['city2']);
|
|
|
247 |
$('#form-main #state').val(response['data']['state']);
|
|
|
248 |
$('#form-main #country').val(response['data']['country']);
|
|
|
249 |
$('#form-main #postal_code').val(response['data']['postal_code']);
|
|
|
250 |
$('#form-main #latitude').val(response['data']['latitude']);
|
|
|
251 |
$('#form-main #longitude').val(response['data']['longitude']);
|
1384 |
efrain |
252 |
$('#form-main #job_category_id').val(response['data']['job_category_id']).trigger('change');
|
|
|
253 |
$('#form-main #industry_id').val(response['data']['industry_id']).trigger('change');
|
1441 |
eleazar |
254 |
$('#form-main #last_date').val(
|
1442 |
eleazar |
255 |
lastDate.getDate() + "/" + String(lastDate.getMonth() + 1).padStart(2, '0') + "/" + lastDate.getFullYear()
|
1441 |
eleazar |
256 |
).trigger('change');
|
1565 |
efrain |
257 |
$('#form-main #status').val(response['data']['status']);
|
1416 |
eleazar |
258 |
CKEDITOR.instances['description'].setData(response['data']['description']);
|
1438 |
eleazar |
259 |
$('#row-lists').hide();
|
|
|
260 |
$('#row-form').show();
|
1389 |
eleazar |
261 |
|
1384 |
efrain |
262 |
} else {
|
|
|
263 |
$.fn.showError(response['message'] || 'ERROR_UNKNOWN');
|
|
|
264 |
}
|
|
|
265 |
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
|
266 |
$.fn.showError(textStatus);
|
|
|
267 |
});
|
|
|
268 |
});
|
1389 |
eleazar |
269 |
|
1417 |
eleazar |
270 |
$('#form-main #last_date').datetimepicker({
|
|
|
271 |
locale: 'es',
|
|
|
272 |
format: 'DD/MM/YYYY'
|
1418 |
eleazar |
273 |
});
|
1384 |
efrain |
274 |
/**
|
|
|
275 |
* Clicked new Form
|
|
|
276 |
*/
|
|
|
277 |
$('button.btn-add-form').click(function(e) {
|
|
|
278 |
$("#rows").html('');
|
|
|
279 |
sections = [];
|
|
|
280 |
$('#form-main').attr('action', '$routeAdd');
|
1565 |
efrain |
281 |
$('#form-main #name').val('');
|
1398 |
eleazar |
282 |
$('#form-main #job_description_id').val('').trigger('change');
|
1410 |
eleazar |
283 |
$('#form-main #location_search').val('');
|
1384 |
efrain |
284 |
$('#form-main #job_category_id').val('').trigger('change');
|
|
|
285 |
$('#form-main #industry_id').val('').trigger('change');
|
1417 |
eleazar |
286 |
$('#form-main #last_date').val('');
|
1565 |
efrain |
287 |
$('#form-main #status').val('$status_active');
|
1416 |
eleazar |
288 |
CKEDITOR.instances['description'].setData('');
|
1397 |
eleazar |
289 |
$('#row-lists').hide();
|
|
|
290 |
$('#row-form').show();
|
1565 |
efrain |
291 |
$('#form-main #name').focus();
|
1384 |
efrain |
292 |
return;
|
|
|
293 |
});
|
|
|
294 |
|
|
|
295 |
|
|
|
296 |
$.validator.addMethod('checkLocation', function (value, element, param) {
|
|
|
297 |
var otherElement = $(param);
|
|
|
298 |
|
|
|
299 |
return $.trim(otherElement.val()).length > 0;
|
|
|
300 |
}, 'ERROR_PLACED_AUTOCOMPLETE_DOES_NOT_CONTAIN_GEOMETRY');
|
|
|
301 |
|
|
|
302 |
var autocompleteLocation = new google.maps.places.Autocomplete(
|
|
|
303 |
(document.getElementById('location_search')),
|
|
|
304 |
{types: ['(cities)']}
|
|
|
305 |
);
|
|
|
306 |
|
1403 |
eleazar |
307 |
$.fn.fillInAddressLocation = function() {
|
1410 |
eleazar |
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 = '';
|
1403 |
eleazar |
320 |
|
1410 |
eleazar |
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-main #formatted_address').val(formatted_address);
|
|
|
351 |
$('#form-main #address1').val(address1);
|
|
|
352 |
$('#form-main #address2').val(address2);
|
|
|
353 |
$('#form-main #city1').val(city1);
|
|
|
354 |
$('#form-main #city2').val(city2);
|
|
|
355 |
$('#form-main #state').val(state);
|
|
|
356 |
$('#form-main #country').val(country);
|
|
|
357 |
$('#form-main #postal_code').val(postal_code);
|
|
|
358 |
$('#form-main #latitude').val(latitude);
|
|
|
359 |
$('#form-main #longitude').val(longitude);
|
|
|
360 |
}
|
1403 |
eleazar |
361 |
}
|
|
|
362 |
|
1384 |
efrain |
363 |
/**
|
|
|
364 |
* Clicked cancel new/edit Form
|
|
|
365 |
*/
|
|
|
366 |
$('button.btn-edit-cancel').click(function(e) {
|
|
|
367 |
$('#row-form').hide();
|
|
|
368 |
$('#row-lists').show();
|
|
|
369 |
return;
|
|
|
370 |
});
|
|
|
371 |
/**
|
|
|
372 |
* Clicked save and close new/edit Form
|
|
|
373 |
*/
|
|
|
374 |
$('button.btn-form-save-close').click(function(e) {
|
|
|
375 |
for (var instanceName in CKEDITOR.instances) {
|
|
|
376 |
CKEDITOR.instances[instanceName].updateElement();
|
|
|
377 |
}
|
|
|
378 |
saveData(0);
|
|
|
379 |
});
|
|
|
380 |
/**
|
|
|
381 |
* Save Form Data
|
|
|
382 |
*/
|
1581 |
eleazar |
383 |
const saveData = (action) => {
|
|
|
384 |
if ($('#name').val() == '') {
|
|
|
385 |
$.fn.showError('ERROR_ENTER_NAME');
|
|
|
386 |
} else if ($('#description').val() == '') {
|
|
|
387 |
$.fn.showError('ERROR_ENTER_DESCRIPTION');
|
|
|
388 |
} else if ($('#form-category').val() == '') {
|
|
|
389 |
$.fn.showError('ERROR_ENTER_CATEGORY');
|
|
|
390 |
} else if ($('#form-industry').val() == '') {
|
|
|
391 |
$.fn.showError('ERROR_ENTER_INDUSTRY');
|
|
|
392 |
} else if ($('#form-text').val() == '') {
|
|
|
393 |
$.fn.showError('ERROR_ENTER_TEXT');
|
|
|
394 |
} else if ($('#status').val() == '') {
|
|
|
395 |
$.fn.showError('ERROR_SELECT_STATUS');
|
|
|
396 |
} else if ($('#job_description_id').val() == '') {
|
|
|
397 |
$.fn.showError('ERROR_SELECT_JOB_DESCRIPTION');
|
|
|
398 |
} else {
|
1384 |
efrain |
399 |
$.ajax({
|
|
|
400 |
'dataType': 'json',
|
|
|
401 |
'method': 'post',
|
|
|
402 |
'url': $('#form-main').attr('action'),
|
1581 |
eleazar |
403 |
'data': {
|
|
|
404 |
'name': $('#form-main #name').val(),
|
|
|
405 |
'job_description_id': $('#form-main #job_description_id').val(),
|
|
|
406 |
'location_search' :$('#form-main #location_search').val(),
|
|
|
407 |
'formatted_address': $('#form-main #formatted_address').val(),
|
|
|
408 |
'address1': $('#form-main #address1').val(),
|
|
|
409 |
'address2': $('#form-main #address2').val(),
|
|
|
410 |
'country': $('#form-main #country').val(),
|
|
|
411 |
'state': $('#form-main #state').val(),
|
|
|
412 |
'city1': $('#form-main #city1').val(),
|
|
|
413 |
'city2': $('#form-main #city2').val(),
|
|
|
414 |
'postal_code': $('#form-main #postal_code').val(),
|
|
|
415 |
'latitude': $('#form-main #latitude').val(),
|
|
|
416 |
'longitude': $('#form-main #longitude').val(),
|
|
|
417 |
'job_category_id' :$('#form-main #job_category_id').val(),
|
|
|
418 |
'industry_id' :$('#form-main #industry_id').val(),
|
|
|
419 |
'last_date': $('#form-main #last_date').val(),
|
|
|
420 |
'status': $('#form-main #status').val(),
|
|
|
421 |
'description': $('#form-main #description').val(),
|
|
|
422 |
'content': JSON.stringify(sections)
|
|
|
423 |
},
|
1384 |
efrain |
424 |
}).done(function(response) {
|
|
|
425 |
if (response['success']) {
|
|
|
426 |
$.fn.showSuccess(response['data']);
|
1581 |
eleazar |
427 |
if (action == 1) {
|
|
|
428 |
$('#form-main').attr('action', response['action_edit']);
|
1384 |
efrain |
429 |
} else {
|
1581 |
eleazar |
430 |
$('#row-form').hide();
|
|
|
431 |
$('#row-lists').show();
|
|
|
432 |
/*---------- Reset Form -------- */
|
|
|
433 |
$('#form-main')[0].reset();
|
3009 |
eleazar |
434 |
tableForm.api().ajax.reload(null, false);
|
1384 |
efrain |
435 |
}
|
1581 |
eleazar |
436 |
return;
|
|
|
437 |
} else {
|
|
|
438 |
$.fn.showError(response['message'] || 'ERROR_UNKNOWN');
|
|
|
439 |
return;
|
1384 |
efrain |
440 |
}
|
|
|
441 |
});
|
1581 |
eleazar |
442 |
}
|
|
|
443 |
}
|
1384 |
efrain |
444 |
/**
|
|
|
445 |
* Remove Html Tags
|
|
|
446 |
*/
|
|
|
447 |
const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
|
1389 |
eleazar |
448 |
|
|
|
449 |
|
1384 |
efrain |
450 |
/**
|
|
|
451 |
* Remove Option
|
|
|
452 |
*/
|
|
|
453 |
const removeOption = (id_section, id) => {
|
|
|
454 |
sections.map((item) => {
|
|
|
455 |
if (item.id_section == id_section) {
|
|
|
456 |
item.options = item.options.filter((opt) => opt.id_option != id) || []
|
|
|
457 |
}
|
|
|
458 |
});
|
|
|
459 |
return renderData(sections);
|
|
|
460 |
}
|
|
|
461 |
/**
|
|
|
462 |
* Clicked refresh button
|
|
|
463 |
*/
|
3006 |
eleazar |
464 |
$('body').on('click', 'button.btn-refresh', function (e) {
|
|
|
465 |
e.preventDefault();
|
3007 |
eleazar |
466 |
tableForm.api().ajax.reload(null, false);
|
3009 |
eleazar |
467 |
|
1384 |
efrain |
468 |
});
|
|
|
469 |
/**
|
|
|
470 |
* Initialize select Jobdescription
|
|
|
471 |
*/
|
|
|
472 |
$('#job_description_id').select2({
|
|
|
473 |
theme: 'bootstrap4',
|
|
|
474 |
width: '100%',
|
|
|
475 |
});
|
|
|
476 |
|
|
|
477 |
/**
|
|
|
478 |
* Initialize select Jobcategory
|
|
|
479 |
*/
|
|
|
480 |
$('#job_category_id').select2({
|
|
|
481 |
theme: 'bootstrap4',
|
|
|
482 |
width: '100%',
|
|
|
483 |
});
|
|
|
484 |
|
|
|
485 |
/**
|
|
|
486 |
* Initialize select industry
|
|
|
487 |
*/
|
|
|
488 |
$('#industry_id').select2({
|
|
|
489 |
theme: 'bootstrap4',
|
|
|
490 |
width: '100%',
|
|
|
491 |
});
|
1566 |
eleazar |
492 |
|
|
|
493 |
/**
|
|
|
494 |
* Initialize status toogle
|
|
|
495 |
*/
|
|
|
496 |
$('#status').bootstrapToggle({
|
|
|
497 |
'on': 'LABEL_ACTIVE',
|
|
|
498 |
'off': 'LABEL_INACTIVE',
|
|
|
499 |
'width': '160px',
|
|
|
500 |
'height': '40px'
|
|
|
501 |
});
|
1400 |
eleazar |
502 |
|
1384 |
efrain |
503 |
/**
|
|
|
504 |
* Initialize select Location
|
|
|
505 |
*/
|
|
|
506 |
|
1410 |
eleazar |
507 |
var validatorLocation = $('#location_search').validate({
|
1384 |
efrain |
508 |
debug: true,
|
|
|
509 |
onclick: false,
|
|
|
510 |
onkeyup: false,
|
|
|
511 |
onfocusout: false,
|
|
|
512 |
ignore: [],
|
|
|
513 |
rules: {
|
|
|
514 |
'location_search': {
|
|
|
515 |
required: true,
|
1410 |
eleazar |
516 |
checkLocation: '#location_search #latitude'
|
1384 |
efrain |
517 |
}
|
|
|
518 |
},
|
|
|
519 |
submitHandler: function(form)
|
|
|
520 |
{
|
|
|
521 |
NProgress.start();
|
|
|
522 |
$.ajax({
|
|
|
523 |
'dataType' : 'json',
|
|
|
524 |
'accept' : 'application/json',
|
|
|
525 |
'method' : 'post',
|
|
|
526 |
'url' : route_location,
|
1410 |
eleazar |
527 |
'data' : $('#location_search').serialize(),
|
1384 |
efrain |
528 |
}).done(function(response) {
|
|
|
529 |
|
|
|
530 |
|
|
|
531 |
|
|
|
532 |
if(response['success']) {
|
|
|
533 |
$('#overview-location').html(response.data);
|
|
|
534 |
$("#location-box").modal('hide');
|
|
|
535 |
} else {
|
|
|
536 |
validatorLocation.resetForm();
|
|
|
537 |
$.fn.showError(response['data']);
|
|
|
538 |
}
|
|
|
539 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
540 |
$.fn.showError(textStatus);
|
|
|
541 |
}).always(function() {
|
|
|
542 |
NProgress.done();
|
|
|
543 |
});
|
|
|
544 |
return false;
|
|
|
545 |
},
|
|
|
546 |
invalidHandler: function(form, validator) {
|
|
|
547 |
|
|
|
548 |
}
|
|
|
549 |
});
|
|
|
550 |
|
|
|
551 |
$('body').on('click', 'a.btn-location-edit', function(e) {
|
|
|
552 |
e.preventDefault();
|
|
|
553 |
|
1410 |
eleazar |
554 |
$('#form-main #location_search').val('');
|
|
|
555 |
$('#form-main #formatted_address').val('');
|
|
|
556 |
$('#form-main #address1').val('');
|
|
|
557 |
$('#form-main #address2').val('');
|
|
|
558 |
$('#form-main #country').val('');
|
|
|
559 |
$('#form-main #state').val('');
|
|
|
560 |
$('#form-main #city1').val('');
|
|
|
561 |
$('#form-main #city2').val('');
|
|
|
562 |
$('#form-main #postal_code').val('');
|
|
|
563 |
$('#form-main #latitude').val('');
|
|
|
564 |
$('#form-main #longitude').val('');
|
1384 |
efrain |
565 |
validatorLocation.resetForm();
|
|
|
566 |
|
|
|
567 |
$("#location-box").modal('show');
|
|
|
568 |
});
|
|
|
569 |
|
|
|
570 |
$('.btn-location-close').on("click", function(e){
|
|
|
571 |
e.preventDefault();
|
|
|
572 |
|
|
|
573 |
$("#location-box").modal('hide');
|
|
|
574 |
return false;
|
|
|
575 |
});
|
1407 |
eleazar |
576 |
|
|
|
577 |
autocompleteLocation.addListener('place_changed', $.fn.fillInAddressLocation);
|
1565 |
efrain |
578 |
|
|
|
579 |
|
8767 |
stevensc |
580 |
CKEDITOR.replace('description', {
|
|
|
581 |
toolbar: [
|
|
|
582 |
{ name: 'editing', items: ['Scayt'] },
|
|
|
583 |
{ name: 'links', items: ['Link', 'Unlink'] },
|
|
|
584 |
{ name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
|
|
|
585 |
{ name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
|
|
|
586 |
'/',
|
|
|
587 |
{ name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
|
|
|
588 |
{ name: 'styles', items: ['Styles', 'Format'] },
|
|
|
589 |
{ name: 'tools', items: ['Maximize'] }
|
|
|
590 |
],
|
|
|
591 |
removePlugins: 'elementspath,Anchor',
|
|
|
592 |
heigth: 100
|
|
|
593 |
});
|
1435 |
eleazar |
594 |
});
|
1384 |
efrain |
595 |
JS;
|
|
|
596 |
|
|
|
597 |
$this->inlineScript()->captureEnd();
|
9427 |
stevensc |
598 |
|
|
|
599 |
$js = <<<JS
|
|
|
600 |
const backendVariables= {
|
|
|
601 |
dashboard_link: "$routeDashboard",
|
|
|
602 |
add_link: "$routeAdd",
|
9779 |
stevensc |
603 |
table_link: "$routeDatatable",
|
9780 |
stevensc |
604 |
googleApiKey: "$google_map_key",
|
9427 |
stevensc |
605 |
permisions: {
|
9636 |
stevensc |
606 |
allowAdd: "$allowAdd",
|
9427 |
stevensc |
607 |
allowEdit: "$allowEdit",
|
|
|
608 |
allowDelete: "$allowDelete"
|
|
|
609 |
}
|
|
|
610 |
}
|
|
|
611 |
JS;
|
9469 |
stevensc |
612 |
|
|
|
613 |
$this->inlineScript()->appendScript($js);
|
9786 |
stevensc |
614 |
$this->headLink()->appendStylesheet($this->basePath('/react-bundles/recruitment_and_selection/main.css'));
|
9469 |
stevensc |
615 |
$this->inlineScript()->appendFile('/react-bundles/recruitment_and_selection/recruitmentAndSelection.js');
|
|
|
616 |
|
1384 |
efrain |
617 |
?>
|
|
|
618 |
<!-- Content Header (Page header) -->
|
9427 |
stevensc |
619 |
|
|
|
620 |
<div id="recruitment_and_selection-vacancies">
|
|
|
621 |
</div>
|
1384 |
efrain |
622 |
<section class="content-header">
|
|
|
623 |
<div class="container-fluid">
|
|
|
624 |
<div class="row mb-2">
|
|
|
625 |
<div class="col-sm-12">
|
|
|
626 |
<h1>LABEL_RECRUITMENT_AND_SELECTION</h1>
|
|
|
627 |
</div>
|
|
|
628 |
</div>
|
|
|
629 |
</div>
|
|
|
630 |
<!-- /.container-fluid -->
|
|
|
631 |
</section>
|
|
|
632 |
<section class="content">
|
|
|
633 |
<div class="container-fluid" id="row-lists">
|
|
|
634 |
<div class="row">
|
|
|
635 |
<div class="col-12">
|
|
|
636 |
<div class="card">
|
|
|
637 |
<div class="card-body">
|
|
|
638 |
<table id="gridTable" class="table table-hover">
|
|
|
639 |
<thead>
|
|
|
640 |
<tr>
|
|
|
641 |
<th style="width:25%">LABEL_NAME</th>
|
|
|
642 |
<th style="width:20%">LABEL_JOB_DESCRIPTION</th>
|
|
|
643 |
<th style="width:25%">LABEL_ACTIONS</th>
|
|
|
644 |
</tr>
|
|
|
645 |
</thead>
|
|
|
646 |
<tbody></tbody>
|
|
|
647 |
</table>
|
|
|
648 |
</div>
|
|
|
649 |
<div class="card-footer clearfix">
|
|
|
650 |
<div style="float:right;">
|
|
|
651 |
<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
|
|
|
652 |
<?php if ($allowAdd) : ?>
|
|
|
653 |
<button type="button" class="btn btn-primary btn-add-form"><i class="fa fa-plus"></i> LABEL_ADD </button>
|
|
|
654 |
<?php endif; ?>
|
|
|
655 |
</div>
|
|
|
656 |
</div>
|
|
|
657 |
</div>
|
|
|
658 |
</div>
|
|
|
659 |
</div>
|
|
|
660 |
</div>
|
|
|
661 |
<!-- Create/Edit Form -->
|
|
|
662 |
<div class="row" id="row-form" style="display: none; padding: 16px;">
|
|
|
663 |
<div class="col-xs-12 col-md-12">
|
1561 |
efrain |
664 |
<?php
|
|
|
665 |
$form = $this->form;
|
|
|
666 |
$form->setAttributes([
|
|
|
667 |
'method' => 'post',
|
1564 |
efrain |
668 |
'name' => 'form-main',
|
|
|
669 |
'id' => 'form-main'
|
1561 |
efrain |
670 |
]);
|
|
|
671 |
|
|
|
672 |
$form->prepare();
|
|
|
673 |
echo $this->form()->openTag($form);
|
|
|
674 |
|
|
|
675 |
$fields = ['formatted_address',
|
|
|
676 |
'address1',
|
|
|
677 |
'address2',
|
|
|
678 |
'country',
|
|
|
679 |
'state',
|
|
|
680 |
'city1',
|
|
|
681 |
'city2',
|
|
|
682 |
'postal_code',
|
|
|
683 |
'latitude',
|
|
|
684 |
'longitude',
|
|
|
685 |
];
|
|
|
686 |
|
|
|
687 |
foreach($fields as $field)
|
|
|
688 |
{
|
|
|
689 |
$element = $form->get($field);
|
|
|
690 |
echo $this->formHidden($element);
|
|
|
691 |
}
|
|
|
692 |
|
|
|
693 |
?>
|
|
|
694 |
<div class="form-group">
|
|
|
695 |
<?php
|
1562 |
efrain |
696 |
$element = $form->get('name');
|
1561 |
efrain |
697 |
$element->setAttributes(['class' => 'form-control']);
|
1562 |
efrain |
698 |
$element->setOptions(['label' => 'LABEL_NAME']);
|
1561 |
efrain |
699 |
|
|
|
700 |
echo $this->formLabel($element);
|
|
|
701 |
echo $this->formText($element);
|
|
|
702 |
?>
|
|
|
703 |
</div>
|
|
|
704 |
<div class="form-group">
|
|
|
705 |
<?php
|
|
|
706 |
$element = $form->get('job_description_id');
|
|
|
707 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
708 |
$element->setOptions(['label' => 'LABEL_POSITION_EVALUATED']);
|
|
|
709 |
|
|
|
710 |
echo $this->formLabel($element);
|
|
|
711 |
echo $this->formSelect($element);
|
|
|
712 |
?>
|
|
|
713 |
</div>
|
1566 |
eleazar |
714 |
<div class="form-group">
|
|
|
715 |
<?php
|
|
|
716 |
$element = $form->get('job_category_id');
|
|
|
717 |
$element->setAttributes(['class' => 'form-control']);
|
1579 |
eleazar |
718 |
$element->setOptions(['label' => 'LABEL_JOB_CATEGORY']);
|
1566 |
eleazar |
719 |
|
|
|
720 |
echo $this->formLabel($element);
|
|
|
721 |
echo $this->formSelect($element);
|
|
|
722 |
?>
|
|
|
723 |
</div>
|
1561 |
efrain |
724 |
<div class="form-group">
|
|
|
725 |
<?php
|
|
|
726 |
$element = $form->get('location_search');
|
|
|
727 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
728 |
$element->setOptions(['label' => 'LABEL_LOCATION']);
|
|
|
729 |
|
|
|
730 |
echo $this->formLabel($element);
|
|
|
731 |
echo $this->formText($element);
|
|
|
732 |
?>
|
|
|
733 |
</div>
|
|
|
734 |
<div class="form-group">
|
|
|
735 |
<?php
|
|
|
736 |
$element = $form->get('industry_id');
|
|
|
737 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
738 |
$element->setOptions(['label' => 'LABEL_INDUSTRY']);
|
|
|
739 |
|
|
|
740 |
echo $this->formLabel($element);
|
|
|
741 |
echo $this->formSelect($element);
|
|
|
742 |
?>
|
|
|
743 |
</div>
|
|
|
744 |
<div class="form-group">
|
|
|
745 |
<?php
|
|
|
746 |
$element = $form->get('last_date');
|
|
|
747 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
748 |
$element->setOptions(['label' => 'LABEL_LAST_DATE_OF_APPLICATION']);
|
|
|
749 |
|
|
|
750 |
echo $this->formLabel($element);
|
|
|
751 |
echo $this->formText($element);
|
|
|
752 |
?>
|
|
|
753 |
</div>
|
1649 |
eleazar |
754 |
<div class="form-group">
|
1561 |
efrain |
755 |
<?php
|
|
|
756 |
$element = $form->get('description');
|
|
|
757 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
758 |
$element->setOptions(['label' => 'LABEL_DESCRIPTION']);
|
|
|
759 |
|
|
|
760 |
echo $this->formLabel($element);
|
|
|
761 |
echo $this->formTextArea($element);
|
|
|
762 |
?>
|
|
|
763 |
</div>
|
|
|
764 |
<div class="form-group">
|
|
|
765 |
<?php
|
|
|
766 |
$element = $form->get('status');
|
|
|
767 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
768 |
$element->setOptions(['label' => 'LABEL_STATUS']);
|
|
|
769 |
|
|
|
770 |
echo $this->formLabel($element);
|
1563 |
efrain |
771 |
echo $this->formCheckbox($element);
|
1561 |
efrain |
772 |
?>
|
|
|
773 |
</div>
|
1456 |
eleazar |
774 |
|
1561 |
efrain |
775 |
|
|
|
776 |
|
1455 |
eleazar |
777 |
<div class="form-group">
|
|
|
778 |
<button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE</button>
|
|
|
779 |
<button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
|
|
|
780 |
</div>
|
1561 |
efrain |
781 |
<?php echo $this->form()->closeTag($form); ?>
|
1384 |
efrain |
782 |
</div>
|
|
|
783 |
</div>
|
|
|
784 |
<!-- Create/Edit Form-->
|
|
|
785 |
|
|
|
786 |
</section>
|