<div class="content-header">
    <div class="container-fluid">
        <div class="row mb-2">
            <div class="col-sm-6">
                <!-- <h1 class="m-0">Deactive Member </h1> -->
            </div>
            <div class="col-sm-6">
                <ol class="breadcrumb float-sm-right">
                    <li class="breadcrumb-item"><a href="#">Others</a></li>
                    <li class="breadcrumb-item active">Others Details </li>
                </ol>
            </div>
        </div>
    </div>
</div>




<section class="content">
    <div class="container-fluid">




        <div class="row">

            <section class="col-lg-12 connectedSortable">

                <div class="card">
                    <div class="card-header " style="background-color:#31708e;color:white">
                        <h3 class="card-title">
                        Others Details
                        </h3>
                        <div class="card-tools">
                            <ul class="nav nav-pills ml-auto">
                            </ul>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="tab-content p-0">

                       <br><br>
                        <div class="row">
                            <div class="col-sm-12">
                                <div class="tile">
                                    <div class="tile-body" id="filter_id">
                                        <table id="table_id" class="table table-striped table-bordered" style="width:100%">
                                            <thead>
                                                <tr>
                                                    <th class="text-center">Member No.</th>
                                                    <th class="text-center">Member Name</th>
                                                    <!--<th>Division</th>-->
                                                    <!--<th>Section</th>-->
                                                    <th class="text-center">Others Amount</th>
                                                    <!--<th>Updated On</th>
                            <th>Added On</th>-->
                                                    <th class="text-center">Action</th>
                                                </tr>
                                            </thead>
                                            <tbody>

                                                <!-- Here's where we iterate through our $articles query object, printing out article info -->

                                                <?php
                                                $total_td = 0;
                                                $tot_td_amt = 0;

                                                foreach ($others as $others) : ?>
                                                  <?php if (!isset($others->close_month)   && !isset($others->close_year)) { ?>
                                                    <tr>
                                                        <td class="text-center">
                                                            <?= $others->me_no ?>
                                                        </td>
                                                        <td>
                                                        <a href="<?php echo base_url() . 'index.php/Member/particular_others/'.$others->me_no; ?>"> <?= $others->mem_name ?></a>
                                                        </td>
                                                        <!--<td>-->
                                                        <!--    <?= $thrift->division ?>-->
                                                        <!--</td>-->
                                                        <!--<td>-->
                                                        <!--    <?= $thrift->section ?>-->
                                                        <!--</td>-->
                                                        <td class="text-right">
                                                            <?= $others->others_amt ?>
                                                        </td>
                                                        <td class="text-center">
                                                            <a href="<?php echo base_url() ?>index.php/Member/edit_others/<?php echo $others->me_no; ?>" class="btn btn-primary btn-xs"><span class="fa fa-edit"></span><span class="sr-only"></span></a>
                                                        </td>
                                                    </tr>
                                                    <?php } else { ?>

                                                    <tr style="background-color:#f51a1a;color:white;">
                                                    <td class="text-center">
                                                            <?= $others->me_no ?>
                                                        </td>
                                                        <td>
                                                        <a href="<?php echo base_url() . 'index.php/Member/particular/'.$others->me_no; ?>"> <?= $others->mem_name ?></a>
                                                        </td>
                                                        <!--<td>-->
                                                        <!--    <?= $thrift->division ?>-->
                                                        <!--</td>-->
                                                        <!--<td>-->
                                                        <!--    <?= $thrift->section ?>-->
                                                        <!--</td>-->
                                                        <td class="text-right">
                                                            <?= $others->others_amt ?>
                                                        </td>
                                                        <td class="text-center">
                                                            <a href="<?php echo base_url() ?>index.php/Member/edit_others/<?php echo $others->me_no; ?>"  onclick="return false;" class="btn btn-primary btn-xs"><span class="fa fa-edit"></span><span class="sr-only"></span></a>
                                                        </td>
                                                    </tr>
                                                    <?php } ?>
                                                <?php

                                                    $total_td += $others->others_amt;

                                                endforeach; ?>
                                            </tbody>
                                            <tfoot>
            <tr>
            <th></th>
                <th style="text-align:right">Total:</th>
                <th style="text-align:right"></th>
                <th style="text-align:right"></th>
                        </tr>
        </tfoot>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>



                        </div>
                    </div>
                </div>
        </div>
</section>
</div>
</div>
</section>



          
<style>
    div.dt-buttons{
        margin-left: 176px;
    }
    div.dataTables_wrapper div.dataTables_length label {
        position: absolute;
    }
    div.dataTables_wrapper div.dataTables_filter {
        text-align: right;
        margin-top: -37px;
    }

    .copyButton {
background-color: #dc3545;
border: 1px solid white;
}
.excelButton {
background-color: #dc3545;
border: 1px solid white;

}
.pdfButton{
background-color: #dc3545;
border: 1px solid white;

}
.printButton {
background-color: #dc3545;
border: 1px solid white;

}
.colvisButton{
background-color: #dc3545;
border: 1px solid white;

}
</style>
            



<script>
    var table = $('#table_id').DataTable({
        "footerCallback": function ( row, data, start, end, display ) {
            var api = this.api();
 
            // Remove the formatting to get integer data for summation
            var intVal = function ( i ) {
                return typeof i === 'string' ?
                    i.replace(/[\$,]/g, '')*1 :
                    typeof i === 'number' ?
                        i : 0;
            };
            // Total over all pages
            total = api
                .column( 2 )
                .data()
                .reduce( function (a, b) {
                    return intVal(a) + intVal(b);
                }, 0 );

              
            // Total over this page
            pageTotal = api
                .column( 2, { page: 'current'} )
                .data()
                .reduce( function (a, b) {
                    return intVal(a) + intVal(b);
                }, 0 );
                // Total over this page
           
 
            // Update footer
            $( api.column( 2).footer() ).html(
                '<span style="color:blue;display:none">' + pageTotal + '<br> </span> <span id="second_total"> ' + total + '</span>'
            );
           
        },
        "processing": true,
        "dom": 'lBfrtip',
        "lengthMenu": [
            [100, 250, 500, 1000, -1],
            [100, 250, 500, 1000, "All"]
        ],
        "buttons": 
        {
    buttons: [
        { extend: 'copy', className: 'copyButton' },
        { extend: 'excel', className: 'excelButton' },
        { extend: 'pdf', className: 'pdfButton' },
        { extend: 'print', className: 'printButton' },
        { extend: 'colvis', className: 'colvisButton' },
    ]
}
        
    });

    $("div.dataTables_filter input").keyup( function (e) {
        if(table.search()!=""){
            $("span").show();
            $("#second_total").hide();
        }else{
            $("span").hide();
            $("#second_total").show();
        }
} );
</script>