@extends('layouts.layout-2')

@section('content')
    <h4 class="font-weight-bold py-2 mb-2">
        {{ __('navigation.my_account') }} / {{ __('navigation.credit') }}
    </h4>

    <div class="card">
        <div class="card-datatable table-responsive">
            <table class="datatables-style table table-striped table-bordered" id="datatable-user-credit">
                <thead>
                <tr>
                    <th>{{__('G.Nr.')}}</th>
                    <th>{{__('Gutschrift')}}</th>
                    <th>{{__('Betrag') }}</th>
                    <th>{{__('Datum') }}</th>
                    <th>{{__('Zahlung')}}</th>
                    <th>{{__('aus Bestellung  / Gutschrift')}}</th>
                </tr>
                </thead>
                <tbody>
                </tbody>
            </table>
        </div>
    </div>
    <script>
        $( document ).ready(function() {
            var oTable = $('#datatable-user-credit').DataTable({
                    "processing": true,
                    "serverSide": true,
                    ajax: {
                        url: '{!! route( 'user_payment_credit_datatable') !!}',
                        data: function(d) {
                            //d.filter_sales_year = $('select[name=filter_sales_year]').val();
                        }
                    },
                    "order": [[0, "desc" ]],
                    "columns": [
                        { data: 'credit_number', name: 'credit_number' },
                        { data: 'credit', name: 'credit', orderable: false, searchable: false  },
                        { data: 'total', name: 'total' },
                        { data: 'date', name: 'date' },
                        { data: 'status', name: 'status', searchable: false  },
                        { data: 'user_margins', name: 'user_margins', orderable: false },
                    ],
                    "bLengthChange": false,
                    "iDisplayLength": 100,
                    "language": {
                        "url": "/js/German.json"
                    }
                });
           /*$('#filter_sales_year').on('change', function(){
                oTable.draw();
            });
            */
        });    
    </script>
@endsection
