(function ($) {
    $(document).ready(function () {

        $('#gatewaylist').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.gateway,
                method: 'POST'
            }
        });

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

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

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

    });
}(jQuery));