<link rel="stylesheet" href="<?= base_url('<link rel="stylesheet" 
	href="https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap.min.css">') ?>">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/css/bootstrap-multiselect.css">
<link rel="stylesheet" href="<?= base_url('bower_components/toastr/toastr.css') ?>">
<div class="content-wrapper">
	<!-- Content Header (Page header) -->
	<section class="content-header">

		<h1>
			<?= $this->lang->line('edit_paying_and_transmitting_networks'); ?>
		</h1>
		<?php
		$site_url = base_url();

		if($alert=="ok") {

			if(!$success=="ok"){
				?>
				<div class='alert alert-danger alert-dismissible col-xs-6'>
					<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
					<h4><i class='icon fa fa-ban'></i> Erreur!</h4>
					<?= $message; ?>
				</div>

				<?php
			} else {
				?>
				<div class="alert alert-success alert-dismissible col-xs-6">
					<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
					<h4><i class="icon fa fa-check"></i> Success!</h4>
					<?= $message; ?>
				</div>

				<?php
			}
		}
		?>
	</section>

	<section class="content">
		<div class="row">
			<div class="col-xs-12">
				<div class="box">
					<div class="box-header">
						<h3 class="box-title"><?= $this->lang->line('activated_countries'); ?></h3>
					</div>
					<div class="box-body" style="overflow-x:auto;">

						<?php
						$sql2 = $countries;
						if($sql2!=false){
							$numrows= sizeof($sql2);
							$num = 0;
							if ($numrows > 0) {
								?>
								<table id="validated" class="table table-bordered table-striped">
									<thead>
									<tr>
										<th align='center'>N°</th>
										<th><?= $this->lang->line('Nom'); ?></th>
										<th align='center'><?= $this->lang->line('paying_networks'); ?> </th>
										<th align='center'><?= $this->lang->line('transmitting_networks'); ?> </th>
										<th align='center'> Action </th>
									</tr>
									</thead>
									<tbody>
									<?php
									foreach($sql2 as $row) {
										$num ++;
										//$member_code = randomString1(10);
										echo "<tr>
                                                  <td align='center'>$num</td>
                                                  <td >$row->name</td>";
										?>
										<?php
										if($row->total_paying){
											?>
											<td><span class="label label-success" style="font-size: 1em;"><?= $row->total_paying.' '.$this->lang->line($row->total_paying > 1 ? 'Reseaux' : 'Reseau') ?></span></td>
											<?php
										}else{
											?>
											<td><span class="label label-danger" style="font-size: 1em;" ><?= $this->lang->line('no_network'); ?></span></td>
											<?php
										}
										?>
										<?php
										if($row->total_transmitting){
											?>
											<td><span class="label label-success" style="font-size: 1em;"><?= $row->total_transmitting.' '.$this->lang->line($row->total_paying > 1 ? 'Reseaux' : 'Reseau') ?></span></td>
											<?php
										}else{
											?>
											<td><span class="label label-danger" style="font-size: 1em;" ><?= $this->lang->line('no_network'); ?></span></td>
											<?php
										}
										?>
										<td>
											<a href="<?= current_url().('?config=paying_networks&country='.$row->id)?>" class="btn btn-primary btn-block"  >
												<b><?= $this->lang->line('Voir plus...'); ?></b>
											</a>
										</td>
										<?php
											}
										?>
									</tbody>
								</table>

								<?php

							}

							else {
								echo $this->lang->line('Aucun réseau');
							}
						}else {
							echo $this->lang->line('Aucun réseau');
						}
						?>
					</div>
				</div>
			</div>
		</div>
	</section>
</div>

<!-- jQuery 2.2.4 -->
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>

<!-- Bootstrap 3.3.7 -->
<script src="<?= base_url('bower_components/bootstrap/dist/js/bootstrap.min.js') ?>"></script>
<!-- DataTables -->
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap.min.js"></script>
<!-- Slimscroll -->
<script src="<?= base_url('bower_components/jquery-slimscroll/jquery.slimscroll.min.js') ?>"></script>
<!-- FastClick -->
<script src="<?= base_url('bower_components/fastclick/lib/fastclick.js') ?>"></script>
<!-- AdminLTE App -->
<script src="<?= base_url('dist/js/adminlte.min.js') ?>"></script>
<!-- AdminLTE for demo purposes -->
<script src="<?= base_url('dist/js/demo.js') ?>"></script>

<script>
	$(function() {
		$('#validated').DataTable();
	})
</script>
