const ContractUnchargedMemberDataTable = {
    templateUrl : 'js/app/components/contract/contract-uncharged-member-data-table.html',
    create : function( props )
    {
        var app = this.app,
            groupId = props.get( 'groupId' ),
            $container = $( this.container );

        this.render( { ui: props.get( 'unchargedItems' ), activeGroup : groupId } );

        $container.find( '.datatable' ).DataTable( {
            pageLength: 50,
            responsive: true,
            dom: '<"html5buttons"B>lTfgitp',
            language : {
                search      : 'Suche',
                emptyTable  : 'Keine Einträge vorhanden.',
                zeroRecords : 'Keine Einträge vorhanden.',
                info        : 'Zeige _START_ bis _END_ von _TOTAL_ Einträgen',
                lengthMenu : 'Zeige _MENU_ Einträge',
                paginate : {
                    first : 'Erste',
                    previous : 'Vorherige',
                    next : 'Nächste',
                    last : 'Letzte'
                },
            },
            order : [[ 5, "desc" ]],
            buttons: [
                { extend: 'copy'},
                {extend: 'csv'},
                {extend: 'excel', title: 'Termine'},
                {extend: 'pdf', title: 'Termine'},

                {extend: 'print',
                    customize: function (win){
                        $(win.document.body).addClass('white-bg');
                        $(win.document.body).css('font-size', '10px');

                        $(win.document.body).find('table')
                            .addClass('compact')
                            .css('font-size', 'inherit');
                    }
                }
            ]
        });

        $container.on( 'click', 'tr[data-type="memberChargeItem"]', function( e )
        {
            app.redirect( '/contract/charge-appointment/' + groupId + '/' + $( e.currentTarget ).attr( 'data-member-id' ) );
        });
    },

    destroy : function()
    {

    }
};

export { ContractUnchargedMemberDataTable };