<?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>Liste des envois par agent</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">Envois par agent</div>
    <div class="panel-body">
	<div class="col-sm-12 report-params">
		<form method="post" action="<?php echo site_url('Reports/agent_wise_transfer_report') ?>">

		<div class="col-sm-3"> 
		<div class="form-group"> 
		<select class="form-control" name="agent" id="agent" required>
		<option value="">Selectionner un Agent</option>
		<?php foreach(get_agent_list() as $agent){ ?>
		<option value="<?php echo $agent->id; ?>"><?php echo $agent->username; ?></option>
		<?php } ?>
		</select>  
		</div> 
		</div>

		<div class="col-md-1 col-lg-1 col-sm-1"> 
		<button type="submit"  class="mybtn btn-submit"><i class="fa fa-play"></i></button>
		</div>
		</form>
		</div>
		<table class="table table-bordered" style="width:100%;" id="report-table">
			<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>
			</thead>
			<tbody>
			<?php foreach($report_data as $report) {?>
				<tr><td><?php echo ucwords($report->sending_type); ?></td>
					<td><?php echo $report->sending_code; ?></td>
					<td><?php echo $report->sending_date; ?></td>
					<td><?php echo $report->sender_fullname; ?></td>
					<td align="right"><b><?php echo decimalplace($report->sending_amount); ?></b></td>
					<td><?php echo $report->recipent_fullname; ?></td>
					<td><?php echo $report->first_name." ".$report->last_name; ?></td>
					<?php if($report->status=="paid"){ ?>
					<td><span class="label label-success"><?php echo $report->status; ?></span></td>
					<?php }else if($report->status=="sending"){ ?>
					<td><span class="label label-primary"><?php echo $report->status; ?></span></td>
					<?php }else{ ?>
					<td><span class="label label-danger"><?php echo $report->status; ?></span></td>
					<?php } ?>
                   </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() {

$('#report-table').DataTable( {
    "order": [[2, "desc"]],
	responsive: true,
	"bAutoWidth":false,
	"iDisplayLength": 25,
	dom: 'Bfrtip',
	buttons: [
	'copy', 'csv', 'excel', 'pdf', 'print'
	]
});

document.title = "Agent Wise Transfer Report";

});

</script>
</body>

</html>
