<?php $this->load->view('theme/include/header.php') ?>

<!--Start Main Content-->
<section>
    <div class="main-content">
        <div class="row">
            <div class="inner-contatier">
                <div class="col-sm-12 content-title"><h4>Export Data</h4></div>
                <div class="col-sm-12">

                    <?php
                    $message = $this->session->userdata('success');
                    if($message){?>
                        <!-- Alert Box -->
                        <div class="alert my-alert alert-success">
                            <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                            <strong>Success! </strong><?php echo $message; ?>
                        </div>
                        <?php
                    }else{
                        $message = $this->session->userdata('error');
                        if($message){
                            ?>
                            <!-- Alert Box -->
                            <div class="alert my-alert alert-danger">
                                <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                                <strong>Alert! </strong><?php echo $message; ?>
                            </div>
                            <?php
                        }
                    }
                    if(validation_errors()) {
                        ?>
                        <!-- Alert Box //validation error -->
                        <div class="alert my-alert alert-danger">
                            <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                            <?php echo validation_errors('<i class="fa fa-times"> ','</i></br>'); ?>
                        </div>
                    <?php } ?>

                    <!--Start Panel-->
                    <div class="panel panel-default">
                        <!-- Default panel contents -->
                        <div class="panel-heading">Export<div class="add-button">
                        <a class="mybtn btn-primary" href="<?php echo site_url('Export/export_data') ?>">Export</a>
						</div></div>
                        <div class="panel-body add-client">
                         <ul class="nav nav-tabs">
						  <li class="active"><a data-toggle="tab" href="#transfer">Transfer</a></li>
						  <li><a data-toggle="tab" href="#payment">Payment</a></li>
						</ul>

						<div class="tab-content" style="margin-top:25px;">
						  <div id="transfer" class="tab-pane fade in active">
							<table class="table table-bordered" style="width:100%;" id="manage-transfer">
							<thead>
								<th>Type</th>
								<th>Code</th>
								<th>Date</th>
								<th>Sender</th>
								<th style="text-align:right">Sending Amount</th>
								<th>Recipent</th>
								<th>Status</th>
							</thead>
							<tbody>
							<?php foreach($transfer_data as $transfer) {?>
								<tr><td><?php echo ucwords($transfer->sending_type); ?></td>
									<td><?php echo $transfer->sending_code; ?></td>
									<td><?php echo $transfer->sending_date; ?></td>
									<td><?php echo $transfer->sender_fullname; ?></td>
									<td align="right"><b><?php echo decimalplace($transfer->sending_amount); ?></b></td>
									<td><?php echo $transfer->recipent_fullname; ?></td>			
									<?php if($transfer->status=="paid"){ ?>
									<td><span class="label label-success"><?php echo $transfer->status; ?></span></td>
									<?php }else if($transfer->status=="sending"){ ?>
									<td><span class="label label-primary"><?php echo $transfer->status; ?></span></td>
									<?php }else{ ?>
									<td><span class="label label-danger"><?php echo $transfer->status; ?></span></td>
									<?php } ?>
                                    </tr>
							<?php } ?>
							</tbody>
						</table>
						  </div>
						  <div id="payment" class="tab-pane fade">
							<table class="table table-bordered" id="manage-payment">
							<thead>
								<th>Type</th>
								<th>Code</th>
								<th>Date</th>
								<th>Sender</th>
								<th style="text-align:right">Sending Amount</th>
								<th>Recipent</th>
							</thead>
							<tbody>
							<?php foreach($payment_data as $transfer) {?>
								<tr><td><?php echo ucwords($transfer->payment_type); ?></td>
									<td><?php echo $transfer->sending_code; ?></td>
									<td><?php echo $transfer->date_of_sending; ?></td>
									<td><?php echo $transfer->sender_fullname; ?></td>
									<td align="right"><b><?php echo decimalplace($transfer->payable_amount); ?></b></td>
									<td><?php echo $transfer->recipent_fullname; ?></td>
					                </tr>
							<?php } ?>
							</tbody>
						</table>
						  </div>
						</div>                    
                       </div>
                        <!--End Panel Body-->
                    </div>
                    <!--End Panel-->
                </div>



            </div><!--End Inner container--->
        </div><!--End Row-->
    </div><!--End Main-content DIV-->
</section><!--End Main-content Section-->

<?php $this->load->view('theme/include/footer'); ?>

<script type="text/javascript">
    $(document).ready(function() {
      $('#manage-transfer, #manage-payment').DataTable( {
         responsive: true,
	     "bAutoWidth":false
       });
    });

</script>
</body>

</html>
