(function ($) {
    $(document).ready(function () {
        $('#currencylist').DataTable({
            processing: true,
            serverSide: true,
            ordering: true,
            order: [[0, 'desc']],
            columnDefs: [{ orderable: false, targets: 'no-sort' }],
            language: {
                "processing": "<div class='table-loading'></div>"
            },
            ajax: {
                url:__rCore.datatable.currency,
                method: 'POST'
            }
        });

        $("body").on('click.removecurrency', '.acl-remove-currency', function(e){
            e.preventDefault();
            var url = $(this).attr('href');
            var title = $(this).attr('title');
            swal({
                title: "Are you sure?",
                text: "You are going to remove the currency "+title+"",
                icon: "error",
                buttons: true,
                dangerMode: true,
            }).then(function(ok) {
                if (ok) {
                    window.location.href= url;
                }
            });
        });

        if(success){
            swal("Successfull!", success, "success");
        }

        if(currencyError){
            swal("Error Occured!", currencyError, "error");
        }

    });
}(jQuery));