//jshint esversion: 6

$(document).on("click",".tx-info",function(e){
    e.preventDefault();
    if($(this).data('reason') != "" ){
        Swal.fire({
            icon: "info",
            html: $(this).data('reason')
        });
    }
});

let table = NioApp.DataTable('#statement-table', {
    processing: true,
    serverSide: true,
    ajax: "/user/statement/load",
    columns: [
        {
            data: 'tx_id',
            name: 'txid',
            orderable: false,
            searchable: true,
            className: 'nk-tb-col'
        },
        {
            data: 'amount',
            name: 'amount',
            searchable: false,
            className: 'nk-tb-col'
        },
        {
            data: 'receiver_account',
            name: 'receiving_account',
            searchable: true,
            className: 'nk-tb-col'
        },
        {
            data: 'type',
            name: 'type',
            searchable: true,
            className: 'nk-tb-col'
        },
        {
            data: 'bank_name',
            name: 'bank',
            className: 'nk-tb-col',
            orderable: false,
            searchable: false
        },
        {
            data: 'remark',
            name: 'description',
            className: 'nk-tb-col',
            orderable: false,
            searchable: false
        },
        {
            data: 'status',
            name: 'status',
            className: 'nk-tb-col',
            orderable: false,
            searchable: false
        },
        {
            data: 'created_at',
            name: 'date',
            className: 'nk-tb-col',
            orderable: false,
            searchable: false
        },
    ],
    // responsive: true,
    autoWidth: false,
    dom: '<"row justify-between g-2"<"col-7 col-sm-6 text-left"f><"col-5 col-sm-6 text-right"<"datatable-filter"l>>><"datatable-wrap my-3"t><"row align-items-center"<"col-7 col-sm-12 col-md-9"p><"col-5 col-sm-12 col-md-3 text-left text-md-right"i>>',
    language: {
        search: "",
        searchPlaceholder: "Type in to Search",
        lengthMenu: "<span class='d-none d-sm-inline-block'>Show</span><div class='form-control-select'> _MENU_ </div>",
        info: "_START_ -_END_ of _TOTAL_",
        infoEmpty: "No records found",
        infoFiltered: "( Total _MAX_  )",
        paginate: {
            "first": "First",
            "last": "Last",
            "next": "Next",
            "previous": "Prev"
        }
    }
});

