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

<!--Start Main Content-->
<section>
<div class="main-content">
<div class="row">
<div class="inner-contatier">    
<div class="col-md-12 col-lg-12 col-sm-12 content-title"><h4>Gestion des envois</h4></div>
<div class="col-md-12 col-lg-12 col-sm-12">

<?php
$message = $this->session->userdata('success');
if($message){?>
<div class="alert my-alert alert-danger">
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong>Alerte! </strong><?php echo $message; ?>
</div>
<?php } ?>



<!--Start Panel-->
<div class="panel panel-default">
    <!-- Default panel contents -->
    <div class="panel-heading">Liste des envois</div>
    <div class="panel-body manage-client">
		<table class="table table-bordered" style="width:100%;" id="manage-transfer">
			<thead>
			    <th>Type</th>
				<th>Code</th>
				<th>Date</th>
				<th>Emetteur</th>
				<th style="text-align:right">Montant</th>
				<th>Beneficiaire</th>
				<th>Agent</th>
				<th>Statut</th>
				<th>Action</th>
			</thead>
			<tbody>
			<?php foreach($table_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>
					<td><?php echo $transfer->first_name." ".$transfer->last_name; ?></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 } ?>
					<td>
					    <a class='btn btn-info btn-xs' href='<?php echo site_url('Transfer/view_invoice/'.$transfer->id) ?>'><i class="fa fa-search"></i> Afficher</a>
						<?php if($transfer->status!="paid"){ ?>
						<a class='btn btn-danger btn-xs' href='<?php echo site_url('Transfer/cancle_transfer/'.$transfer->id) ?>'><i class="fa fa-undo"></i> ANNULER</a>			
					    <?php } ?>
					</td></tr>
			<?php } ?>
			</tbody>
		</table>
    </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').DataTable( {
    responsive: true,
	"bAutoWidth":false
});

});

</script>
</body>

</html>
