<div class="wrapper wrapper-content animated fadeInUp">
	<?php echo view('Views\view_header'); ?>

	<div class="row">
		<div class="col-lg-12">
			<div class="ibox float-e-margins">
				<div class="ibox-title">
					<h5>
						Listagem
					</h5>
				</div>
				
				<div class="ibox-content">
					<div class="table-responsive">
						<table class="table table-striped table-hover dataTables">
							<thead>
								<tr>
									<?php if($MyModulo->lote == 1) { ?>
										<th width="50"> 
											<center>
												<input type="checkbox" class="check-all-for-actions" name="check-all" value="" data-table="form_newsletter">
											</center>
										</th>
									<?php } ?>

									<th>
										<center>
											Imagem
										</center>
									</th>
									
									<?php if($MyUser->id_categoria == 1) { ?>
										<th><center>Tipo</center></th>
										<th>Âncora</th>
									<?php } ?>
									
									<th>Título</th>
									
									<?php if($MyUser->id_categoria == 1) { ?>
										<th><center>Status</center></th>
									<?php } ?>
									
									<th width="250"><center>Ações</center></th>
								</tr>
							</thead>

							<tbody>
								<?php foreach($cad_ancora as $valor) { ?>
									<tr>
										<?php if($MyModulo->lote == 1) { ?>
											<td>
												<center>
													<input type="checkbox" class="check-for-actions" name="check-<?php echo $valor->id; ?>" value="<?php echo $valor->id; ?>" data-table="cad_ancora">
												</center>
											</td>
										<?php } ?>

										<?php if(isset($valor->imagem) AND !empty($valor->imagem)) { ?>
											<td width="100">
												<a href="<?php echo PUBLICURL . "uploads/upload_cad_ancora/item_" . $valor->id . "/" . $valor->imagem; ?>" data-gallery="" data-title="<?php if(isset($valor->titulo) and $valor->titulo) { echo $valor->titulo; } ?>">
													<center>
														<img class="img-list" src="<?php echo PUBLICURL . "uploads/upload_cad_ancora/item_" . $valor->id . "/" . $valor->imagem; ?>">
													</center>
												</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 } ?>

										<?php if($MyUser->id_categoria == 1) { ?>
											<td>
												<center>
													<?php if($valor->root == 1) { ?>
														<i class="fal fa-eye-slash text-danger"></i>
													<?php } else { ?> 
														<i class="fal fa-eye text-navy"></i>
													<?php } ?>
												</center>
											</td>

											<td>
												<?php echo $valor->atalho; ?>
											</td>
										<?php } ?>

										<td>
											<?php echo $valor->titulo; ?>
										</td>

										<?php if($MyUser->id_categoria == 1) { ?>
											<td>
												<center>
													<input <?php if( $valor->ativo == '1') { echo "checked"; } ?> type="checkbox" class="js-switch" data-table="cad_ancora" data-id="<?php echo $valor->id; ?>"/>
												</center>
											</td>
										<?php } ?>

										<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 || $MyUser->id_categoria == 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>
									<?php if($MyModulo->lote == 1) { ?>
										<th> 
											<center>
												<input type="checkbox" class="check-all-for-actions" name="check-all" value="" data-table="form_newsletter">
											</center>
										</th>
									<?php } ?>

									<th>
										<center>
											Imagem
										</center>
									</th>
									
									<?php if($MyUser->id_categoria == 1) { ?>
										<th><center>Tipo</center></th>
										<th>Âncora</th>
									<?php } ?>
									
									<th>Título</th>
									
									<?php if($MyUser->id_categoria == 1) { ?>
										<th><center>Status</center></th>
									<?php } ?>
									
									<th width="250"><center>Ações</center></th>
								</tr>
							</tfoot>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

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