<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="#">Insurance</a></li>
                    <li class="breadcrumb-item active">Insurance 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">
                        Insurance 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">

                        <!-- <h1><i class="fa fa-th-list"></i> Insurance Details</h1> -->
                        <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 align="center">
                                                    <th align="center">Member No.</th>
                                                    <th align="center">Member Name</th>
                                                    <!--<th>Division</th>-->
                                                    <!--<th>Section</th>-->
                                                    <th align="center">Insurance Amount</th>
                                                    <th align="center">Total Insurance Amount</th>
                                                    <!--<th>Updated On</th>
                            <th>Added On</th>-->
                                                    <th align="center">Action</th>
                                                </tr>
                                            </thead>
                                            <tbody>

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

                                                <?php foreach ($value as $key => $value) : ?>
                                                    <tr>
                                                        <td align="center">
                                                            <?php echo  $value->me_no ?>
                                                        </td>
                                                        <td>
                                                        <a href="<?php echo base_url() . 'index.php/Member/particular_insurence/'.$value->me_no; ?>"> <?php echo  $value->mem_name ?></a>
                                                        </td>
                                                        <!--<td>-->
                                                        <!--    <?php echo  $value->division ?>-->
                                                        <!--</td>-->
                                                        <!--<td>-->
                                                        <!--    <?php echo  $value->section ?>-->
                                                        <!--</td>-->
                                                        <td style="text-align:right">
                                                            <?php echo  $value->insurance ?>
                                                        </td>
                                                        <td style="text-align:right">
                                                            <?php echo  $value->tot_insurance ?>
                                                        </td>
                                                        <!-- <td>
                                <?php echo  $value->added_on ?>
                                </td>
                                <td>
                                <?php echo  $value->updated_on ?>
                                </td> -->
                                                        <td class="text-center">
                                                            <a href="<?php echo base_url() ?>index.php/Member/edit_insurance/<?php echo $value->me_no; ?>" class="btn btn-primary btn-xs"><span class="fa fa-edit"></span><span class="sr-only"></span></a>
                                                        </td>
                                                    </tr>
                                                <?php 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>
                <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 );

                totals = api
                .column( 3 )
                .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
            pageTotals = api
                .column(3, { page: 'current'} )
                .data()
                .reduce( function (a, b) {
                    return intVal(a) + intVal(b);
                }, 0 );
 
            // Update footer
            $( api.column( 2).footer() ).html(
                '<span style="color:blue;display:none">' + pageTotal + '<br> </span> <span id="second_total"> ' + total + '</span>'
            );
            $( api.column( 3).footer() ).html(
                '<span style="color:blue;display:none">' + pageTotals + '<br> </span> <span id="second_total1"> ' + totals + '</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();
            $("#second_total1").hide();
        }else{
            $("span").hide();
            $("#second_total").show();
            $("#second_total1").show();
        }
} );
</script>