<div id="page-wrapper">

            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">Reservation's</h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <div class="row">
    <div class="col-lg-12">
        <?php if($this->session->flashdata('approved_success')): ?>
            <?= "<div class='alert alert-success'>". $this->session->flashdata("approved_success"). "</div>"; ?>
        <?php endif; ?>
        <?php if($this->session->flashdata('approved_failed')): ?>
            <?= "<div class='alert alert-danger'>". $this->session->flashdata("approved_failed"). "</div>"; ?>
        <?php endif; ?>

         <?php if($this->session->flashdata('reject_success')): ?>
            <?= "<div class='alert alert-success'>". $this->session->flashdata("reject_success"). "</div>"; ?>
        <?php endif; ?>
        <?php if($this->session->flashdata('invoice_ok')): ?>
            <?= "<div class='alert alert-success'>". $this->session->flashdata("invoice_ok"). "</div>"; ?>
        <?php endif; ?>
        <?php if($this->session->flashdata('invoice_cancel')): ?>
            <?= "<div class='alert alert-success'>". $this->session->flashdata("invoice_cancel"). "</div>"; ?>
        <?php endif; ?>
        <?php if($this->session->flashdata('reject_failed')): ?>
            <?= "<div class='alert alert-danger'>". $this->session->flashdata("reject_failed"). "</div>"; ?>
        <?php endif; ?>

    </div>
</div>
            <!-- /.row -->
             <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            User Appointement's
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example">
                                <thead>
                                    <tr>
                                        <th>SNo</th>
                                        <th>Invoice</th>
                                        <th>Appartment</th>
                                        <th>Owner</th>
                                        <th>Buy User</th>
                                        <th>Appointment Ok</th>
                                        <th>Appointemnt Cencel</th>
                                        <th>Invoice Date</th>

                                    </tr>
                                </thead>
                                <tbody>
                                <?php $i = 1; ?>
                                   <?php foreach($book as $app): ?>
                                    <?php $app->invoice_date;
                                          

                                     ?>
                                    <?php 

                                    $current = strtotime(date('m/d/Y'));
                                    $invoice_date = strtotime($app->invoice_date);
                                    $sub = $invoice_date-$current;
                                    $days = floor($sub/(60*60*24));
                                    $result = explode("-",$days);


                                     ?>
                                    <tr>
                                <td><?php echo $i++; ?></td>
                                <td><?= $app->invoice; ?></td>
                                <td><a href="<?php echo base_url('admin/admin_controller/appartment_details/'.$app->appartement_id.'');?>">Appartment Details</a></td>
                                <td><a href="<?php echo base_url('admin/admin_controller/user_details/'.$app->owner_id.'');?>">Owner Details</a></td>
                                <td><a href="<?php echo base_url('admin/admin_controller/user_details/'.$app->buy_user_id.'');?>">Buy User Details</a></td>
                                <td><a href="<?php echo base_url('admin/admin_controller/invoice_ok/'.$app->appartement_id.'');?>" class="btn btn-success"><span class="glyphicon glyphicon-ok"></span></a></td>
                                <td><a href="<?php echo base_url('admin/admin_controller/invoice_cancel/'.$app->appartement_id.'');?>" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span></a></td>
                                <?php if($days == 1): ?>
                                    <td><?php echo "Today"; ?></td>
                                <?php else: ?>
                                <td><?php echo $result[1]." Days"; ?></td>
                            <?php endif; ?>
                                </tr>
                                   <?php endforeach; ?>
                                </tbody>
                            </table>
                            <!-- /.table-responsive -->
                           
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>