<div class="wrapper wrapper-content animated fadeInUp">
	<?php echo view('Views\view_header'); ?>
	
	<?php if(isset($cad_cidades) AND !empty($cad_cidades)) { ?> 
		<div class="row">
			<div class="col-lg-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5><i class="fal fa-list-ul"></i> Listagem</h5>
					</div>

					<div class="ibox-content">
						<div class="table-responsive">
							<table class="table table-striped table-hover dataTables datatables-with-filter" data-col="0">
								<thead>
									<tr>
										<th class="d-none"><center>UF</center></th>
										<th><center>UF</center></th>
										<th>Título</th>
										<th><center>Latitude</center></th>
										<th><center>Longitude</center></th>
										<th><center>Status</center></th>
										<th width="250"><center>Ações</center></th>
									</tr>
								</thead>

								<tbody>
									<?php foreach($cad_cidades as $valor) { ?>
										<tr>
											<td class="d-none">
												<?php echo $valor->uf; ?>
											</td>

											<td>
												<center>
													<?php echo $valor->uf; ?>
												</center>
											</td>

											<td>
												<?php echo $valor->titulo; ?>
											</td>
											
											<td>
												<center>
													<?php 
													if(isset($valor->latitude) AND !empty($valor->latitude)) { 
														echo $valor->latitude; 
													} 
													else { 
														echo '<i class="fal fa-times text-danger"></i>'; 
													} 
													?>
												</center>
											</td>
											
											<td>
												<center>
													<?php 
													if(isset($valor->longitude) AND !empty($valor->longitude)) { 
														echo $valor->longitude; 
													} 
													else { 
														echo '<i class="fal fa-times text-danger"></i>'; 
													} 
													?>
												</center>
											</td>

											<td>
												<center>
													<?php if($valor->latitude == "" OR $valor->longitude == "") { ?>
														<i class="fal fa-times text-danger"></i>
													<?php } else { ?> 
														<input <?php if( $valor->ativo == '1') { echo "checked"; } ?> type="checkbox" class="js-switch" data-table="cad_cidades" data-id="<?php echo $valor->id; ?>"/>
													<?php } ?>
												</center>
											</td>

											<td>
												<center>
													<a href="<?php echo base_url($MyMod . "/alterando-cadastro/" . $valor->id); ?>" title="Editar" class="with-tip loading">
														<button type="button" class="btn btn-primary text-uppercase" title="Editar">
															Editar
														</button>
													</a>

													<a href="<?php echo base_url($MyMod . "/deletar/" . $valor->id); ?>" title="Deletar" class="with-tip btn-excluir">
														<button type="button" class="btn btn-danger" title="Deletar">
															<i class="fal fa-trash"></i>
														</button>
													</a>
												</center>
											</td>
										</tr>
									<?php } ?>
								</tbody>

								<tfoot>
									<tr>
										<th class="d-none"><center>UF</center></th>
										<th><center>UF</center></th>
										<th>Título</th>
										<th><center>Latitude</center></th>
										<th><center>Longitude</center></th>
										<th><center>Status</center></th>
										<th><center>Ações</center></th>
									</tr>
								</tfoot>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
	<?php } else { ?> 
		<div class="row">
			<div class="col-12">
				<div class="p-lg text-center">
					<div class="m-b-md">
						<i class="fal fa-exclamation-triangle fa-10x mb-4"></i>
						<h1 class="m-xs">NÃO FOI ENCONTRADO<br/>NENHUM CADASTRO<br/>NESTE MÓDULO</h1>
					</div>
				</div>
			</div>
		</div>
	<?php } ?>
</div>

<?php echo view('Views\view_footer'); ?>