<div class="wrapper wrapper-content animated fadeInUp">
	<?php echo view('Views\view_header'); ?>
	
	<?php if(isset($cad_estados) AND !empty($cad_estados)) { ?> 
		<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">
								<thead>
									<tr>
										<th>Imagem</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_estados as $valor) { ?>
										<tr>
											<?php if(isset($valor->imagem) AND !empty($valor->imagem)) { ?>
												<td width="100">
													<a href="<?php echo PUBLICURL . "assets/cms/img/bandeiras/" . $valor->imagem; ?>" data-gallery="" data-title="<?php if(isset($valor->titulo) and $valor->titulo) { echo $valor->titulo; } ?>">
														<img class="img-list" src="<?php echo PUBLICURL . "assets/cms/img/bandeiras/" . $valor->imagem; ?>">
													</a>
												</td>
											<?php } else { ?>
												<td width="100">
													<center>
														<img class="img-list" src="<?php echo PUBLICURL . 'uploads/upload_cad_ancora/item_' . $MyAncora['img_default']->id . '/' . $MyAncora['img_default']->imagem; ?>">
													</center>
												</td>
											<?php } ?>

											<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>
													<input <?php if( $valor->ativo == '1') { echo "checked"; } ?> type="checkbox" class="js-switch" data-table="cad_estados" data-id="<?php echo $valor->id; ?>"/>
												</center>
											</td>

											<td>
												<center>
													<?php if(isset($MyModulo->editar) AND $MyModulo->editar == 1) { ?>
														<a href="<?php echo BASECMSURL . $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>
													<?php } ?>

													<?php if(isset($MyModulo->excluir) AND $MyModulo->excluir == 1) { ?>
														<a href="<?php echo BASECMSURL . $MyMod . "/deletando-cadastro/" . $valor->id; ?>" title="Deletar" class="with-tip btn-excluir">
															<button type="button" class="btn btn-danger" title="Deletar">
																<i class="fa-light fa-trash"></i>
															</button>
														</a>
													<?php } ?>
												</center>
											</td>
										</tr>
									<?php } ?>
								</tbody>

								<tfoot>
									<tr>
										<th>Imagem</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'); ?>