Newer
Older
'use strict';
import $ from 'jquery';
/**
/**
* Kicks things off
*/
constructor() {
$('.remove-file').on('click', this._removeFile);
$('#sgjobs-joblist').on('change', '.sgjobs-select', this._filterJoblist);
$('#apply-cover-letter').on('change', this._checkFileSize);
$('#apply-cv').on('change', this._checkFileSize);
$('#apply-certificate').on('change', this._checkFileSize);
}
/**
* Remove file from application logic
*
* @param event
* @private
*/
_removeFile(event) {
let currentElement = $(this);
event.preventDefault();
$.post(
'?eID=sgAjax&extensionName=SgJobs&controller=Ajax%5CJoblist&action=deleteTempFile&format=json&vendorName=SGalinski',
{
file: currentElement.parent().children('.filename').html(),
type: currentElement.attr('filetype')
}
currentElement.parent().remove();
});
* Filter for the joblist, simply apply the form
*
* @private
*/
_filterJoblist() {
$('#sgjobs-filter').submit();
_checkFileSize() {
if (this.files[0].size > document.querySelector('#maxFileSize').getAttribute('data-maxFilesize') * 1000) {
alert(document.querySelector('#maxFileSizeMessage').getAttribute('data-maxFileSizeMessage'));
this.value = "";
};
}