Línea 235... |
Línea 235... |
235 |
const lastDate = new Date(Date.parse(response['data']['last_date'] + " 00:00:00"));
|
235 |
const lastDate = new Date(Date.parse(response['data']['last_date'] + " 00:00:00"));
|
Línea 236... |
Línea 236... |
236 |
|
236 |
|
237 |
$("#rows").html('');
|
237 |
$("#rows").html('');
|
238 |
sections = [];
|
238 |
sections = [];
|
239 |
$('#form-main').attr('action', action);
|
239 |
$('#form-main').attr('action', action);
|
240 |
$('#form-main #form-name').val(response['data']['name']);
|
240 |
$('#form-main #name').val(response['data']['name']);
|
241 |
$('#form-main #job_description_id').val(response['data']['job_description_id']).trigger('change');
|
241 |
$('#form-main #job_description_id').val(response['data']['job_description_id']).trigger('change');
|
242 |
$('#form-main #location_search').val(response['data']['location_search']);
|
242 |
$('#form-main #location_search').val(response['data']['location_search']);
|
243 |
$('#form-main #job_category_id').val(response['data']['job_category_id']).trigger('change');
|
243 |
$('#form-main #job_category_id').val(response['data']['job_category_id']).trigger('change');
|
244 |
$('#form-main #industry_id').val(response['data']['industry_id']).trigger('change');
|
244 |
$('#form-main #industry_id').val(response['data']['industry_id']).trigger('change');
|
245 |
$('#form-main #last_date').val(
|
245 |
$('#form-main #last_date').val(
|
246 |
lastDate.getDate() + "/" + String(lastDate.getMonth() + 1).padStart(2, '0') + "/" + lastDate.getFullYear()
|
246 |
lastDate.getDate() + "/" + String(lastDate.getMonth() + 1).padStart(2, '0') + "/" + lastDate.getFullYear()
|
247 |
).trigger('change');
|
247 |
).trigger('change');
|
248 |
$('#form-main #form-status').val(response['data']['status']);
|
248 |
$('#form-main #status').val(response['data']['status']);
|
249 |
CKEDITOR.instances['description'].setData(response['data']['description']);
|
249 |
CKEDITOR.instances['description'].setData(response['data']['description']);
|
250 |
$('#row-lists').hide();
|
250 |
$('#row-lists').hide();
|
Línea 251... |
Línea 251... |
251 |
$('#row-form').show();
|
251 |
$('#row-form').show();
|
Línea 267... |
Línea 267... |
267 |
*/
|
267 |
*/
|
268 |
$('button.btn-add-form').click(function(e) {
|
268 |
$('button.btn-add-form').click(function(e) {
|
269 |
$("#rows").html('');
|
269 |
$("#rows").html('');
|
270 |
sections = [];
|
270 |
sections = [];
|
271 |
$('#form-main').attr('action', '$routeAdd');
|
271 |
$('#form-main').attr('action', '$routeAdd');
|
272 |
$('#form-main #form-name').val('');
|
272 |
$('#form-main #name').val('');
|
273 |
$('#form-main #job_description_id').val('').trigger('change');
|
273 |
$('#form-main #job_description_id').val('').trigger('change');
|
274 |
$('#form-main #location_search').val('');
|
274 |
$('#form-main #location_search').val('');
|
275 |
$('#form-main #job_category_id').val('').trigger('change');
|
275 |
$('#form-main #job_category_id').val('').trigger('change');
|
276 |
$('#form-main #industry_id').val('').trigger('change');
|
276 |
$('#form-main #industry_id').val('').trigger('change');
|
277 |
$('#form-main #last_date').val('');
|
277 |
$('#form-main #last_date').val('');
|
278 |
$('#form-main #form-status').val('$status_active');
|
278 |
$('#form-main #status').val('$status_active');
|
279 |
CKEDITOR.instances['description'].setData('');
|
279 |
CKEDITOR.instances['description'].setData('');
|
280 |
$('#row-lists').hide();
|
280 |
$('#row-lists').hide();
|
281 |
$('#row-form').show();
|
281 |
$('#row-form').show();
|
282 |
$('#form-main #form-name').focus();
|
282 |
$('#form-main #name').focus();
|
283 |
return;
|
283 |
return;
|
284 |
});
|
284 |
});
|
Línea 285... |
Línea 285... |
285 |
|
285 |
|
Línea 379... |
Línea 379... |
379 |
});
|
379 |
});
|
380 |
/**
|
380 |
/**
|
381 |
* Save Form Data
|
381 |
* Save Form Data
|
382 |
*/
|
382 |
*/
|
383 |
const saveData = (action) => {
|
383 |
const saveData = (action) => {
|
384 |
if ($('#form-name').val() == '') {
|
384 |
if ($('#name').val() == '') {
|
385 |
$.fn.showError('ERROR_ENTER_NAME');
|
385 |
$.fn.showError('ERROR_ENTER_NAME');
|
386 |
} else if ($('#description').val() == '') {
|
386 |
} else if ($('#description').val() == '') {
|
387 |
$.fn.showError('ERROR_ENTER_DESCRIPTION');
|
387 |
$.fn.showError('ERROR_ENTER_DESCRIPTION');
|
388 |
} else if ($('#form-category').val() == '') {
|
388 |
} else if ($('#form-category').val() == '') {
|
389 |
$.fn.showError('ERROR_ENTER_CATEGORY');
|
389 |
$.fn.showError('ERROR_ENTER_CATEGORY');
|
390 |
} else if ($('#form-industry').val() == '') {
|
390 |
} else if ($('#form-industry').val() == '') {
|
391 |
$.fn.showError('ERROR_ENTER_INDUSTRY');
|
391 |
$.fn.showError('ERROR_ENTER_INDUSTRY');
|
392 |
} else if ($('#form-text').val() == '') {
|
392 |
} else if ($('#form-text').val() == '') {
|
393 |
$.fn.showError('ERROR_ENTER_TEXT');
|
393 |
$.fn.showError('ERROR_ENTER_TEXT');
|
394 |
} else if ($('#form-status').val() == '') {
|
394 |
} else if ($('#status').val() == '') {
|
395 |
$.fn.showError('ERROR_SELECT_STATUS');
|
395 |
$.fn.showError('ERROR_SELECT_STATUS');
|
396 |
} else if ($('#job_description_id').val() == '') {
|
396 |
} else if ($('#job_description_id').val() == '') {
|
397 |
$.fn.showError('ERROR_SELECT_JOB_DESCRIPTION');
|
397 |
$.fn.showError('ERROR_SELECT_JOB_DESCRIPTION');
|
398 |
} else {
|
398 |
} else {
|
399 |
$.ajax({
|
399 |
$.ajax({
|
400 |
'dataType': 'json',
|
400 |
'dataType': 'json',
|
401 |
'method': 'post',
|
401 |
'method': 'post',
|
402 |
'url': $('#form-main').attr('action'),
|
402 |
'url': $('#form-main').attr('action'),
|
403 |
'data': {
|
403 |
'data': {
|
404 |
'name': $('#form-main #form-name').val(),
|
404 |
'name': $('#form-main #name').val(),
|
405 |
'job_description_id': $('#form-main #job_description_id').val(),
|
405 |
'job_description_id': $('#form-main #job_description_id').val(),
|
406 |
'location_search' :$('#form-main #location_search').val(),
|
406 |
'location_search' :$('#form-main #location_search').val(),
|
407 |
'formatted_address': $('#form-main #formatted_address').val(),
|
407 |
'formatted_address': $('#form-main #formatted_address').val(),
|
408 |
'address1': $('#form-main #address1').val(),
|
408 |
'address1': $('#form-main #address1').val(),
|
409 |
'address2': $('#form-main #address2').val(),
|
409 |
'address2': $('#form-main #address2').val(),
|
Línea 415... |
Línea 415... |
415 |
'latitude': $('#form-main #latitude').val(),
|
415 |
'latitude': $('#form-main #latitude').val(),
|
416 |
'longitude': $('#form-main #longitude').val(),
|
416 |
'longitude': $('#form-main #longitude').val(),
|
417 |
'job_category_id' :$('#form-main #job_category_id').val(),
|
417 |
'job_category_id' :$('#form-main #job_category_id').val(),
|
418 |
'industry_id' :$('#form-main #industry_id').val(),
|
418 |
'industry_id' :$('#form-main #industry_id').val(),
|
419 |
'last_date': $('#form-main #last_date').val(),
|
419 |
'last_date': $('#form-main #last_date').val(),
|
420 |
'status': $('#form-main #form-status').val(),
|
420 |
'status': $('#form-main #status').val(),
|
421 |
'description': $('#form-main #description').val(),
|
421 |
'description': $('#form-main #description').val(),
|
422 |
'content': JSON.stringify(sections)
|
422 |
'content': JSON.stringify(sections)
|
423 |
},
|
423 |
},
|
424 |
}).done(function(response) {
|
424 |
}).done(function(response) {
|
425 |
if (response['success']) {
|
425 |
if (response['success']) {
|
Línea 562... |
Línea 562... |
562 |
$("#location-box").modal('hide');
|
562 |
$("#location-box").modal('hide');
|
563 |
return false;
|
563 |
return false;
|
564 |
});
|
564 |
});
|
Línea 565... |
Línea 565... |
565 |
|
565 |
|
- |
|
566 |
autocompleteLocation.addListener('place_changed', $.fn.fillInAddressLocation);
|
- |
|
567 |
|
- |
|
568 |
|
566 |
autocompleteLocation.addListener('place_changed', $.fn.fillInAddressLocation);
|
569 |
CKEDITOR.replace('description');
|
567 |
});
|
570 |
});
|
Línea 568... |
Línea 571... |
568 |
JS;
|
571 |
JS;
|
569 |
|
572 |
|