AlertUtil  = function() {
    this.spinnerHtmlBlock = '<div class="spinner spinner-border spinner-border-sm" role="status"></div>';
};
AlertUtil.prototype.showErrorSwal = function() {
    swal.fire(Translator.trans('error.oops'), '', "error");
};
AlertUtil.prototype.showLoadingSwal = function(){
    swal.fire({
        title: Translator.trans('your.process.in.progress'),
        type: 'info',
        onOpen: function() {
            swal.showLoading()
        }
    });
};
AlertUtil.prototype.closeLoadingSwal = function(){
    swal.close();
};
AlertUtil.prototype.showLoadingSpinner = function($element, $side = 'right') {
    if($side === 'left'){
        $element.html(this.spinnerHtmlBlock + ' ' + $element.html());
    }else{ // right
        $element.html($element.html() + ' ' + this.spinnerHtmlBlock);
    }
};
AlertUtil.prototype.closeLoadingSpinner = function ($element) {
    $element.find('div.spinner').remove();
};
AlertUtil.prototype.showLoading = function($element){
    var $loadingType = $element.attr('data-loading-type');
    if($loadingType === 'swal'){
        this.showLoadingSwal();
    }else if($loadingType === 'spinner'){
        this.showLoadingSpinner($element);
    }
};
AlertUtil.prototype.closeLoading = function($element){
    var $loadingType = $element.attr('data-loading-type');
    if($loadingType === 'swal'){
        this.closeLoadingSwal();
    }else if($loadingType === 'spinner'){
        this.closeLoadingSpinner($element);
    }
};