<div class="wrapper wrapper-content animated fadeInUp">
	<?php echo view('Views\view_header'); ?>
	
	<?php if(isset($cms_modulos) AND !empty($cms_modulos)) { ?> 
		<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 datatables-with-filter w-100" data-col="0">
								<thead>
									<tr>
										<th class="d-none"><center>Categoria</center></th>
										<th><center>Categoria</center></th>
										<th><center>Ícone</center></th>
										<th>Título</th>
										
										<th><center>Root</center></th>
										<th><center>Cadastrar</center></th>
										<th><center>Editar</center></th>
										<th><center>Excluir</center></th>
										<th><center>Salvar</center></th>
										<th><center>Lote</center></th>
										<th><center>Upload</center></th>
										<th><center>API</center></th>

										<th><center>Ordem</center></th>
										<th><center>Ativo</center></th>
										<th width="250"><center>Ações</center></th>
									</tr>
								</thead>

								<tbody>
									<?php foreach($cms_modulos as $valor) { ?>
										<tr>
											<td class="d-none">
												<?php echo $valor->categoria; ?>
											</td>
											
											<td>
												<div class='d-block w-100 rounded-0 label label-info py-2 text-2 font-normal text-center'>
													<?php echo $valor->categoria; ?>
												</div>
											</td>

											<td>
												<center><i class="<?php echo $valor->icone; ?>"></i></center>
											</td>

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

											<td>
												<center>
													<?php if($valor->root == 1) { ?>
														<i class="fa-light fa-check text-navy"></i>
													<?php } else { ?> 
														<i class="fa-light fa-xmark text-danger"></i>
													<?php } ?>
												</center>
											</td>


											<td>
												<center>
													<?php if($valor->cadastrar == 1) { ?>
														<i class="fa-light fa-check text-navy"></i>
													<?php } else { ?> 
														<i class="fa-light fa-xmark text-danger"></i>
													<?php } ?>
												</center>
											</td>
											
											<td>
												<center>
													<?php if($valor->editar == 1) { ?>
														<i class="fa-light fa-check text-navy"></i>
													<?php } else { ?> 
														<i class="fa-light fa-xmark text-danger"></i>
													<?php } ?>
												</center>
											</td>
											
											<td>
												<center>
													<?php if($valor->excluir == 1) { ?>
														<i class="fa-light fa-check text-navy"></i>
													<?php } else { ?> 
														<i class="fa-light fa-xmark text-danger"></i>
													<?php } ?>
												</center>
											</td>
											
											<td>
												<center>
													<?php if($valor->salvar == 1) { ?>
														<i class="fa-light fa-check text-navy"></i>
													<?php } else { ?> 
														<i class="fa-light fa-xmark text-danger"></i>
													<?php } ?>
												</center>
											</td>
											
											<td>
												<center>
													<?php if($valor->lote == 1) { ?>
														<i class="fa-light fa-check text-navy"></i>
													<?php } else { ?> 
														<i class="fa-light fa-xmark text-danger"></i>
													<?php } ?>
												</center>
											</td>
											
											<td>
												<center>
													<?php if($valor->upload == 1) { ?>
														<i class="fa-light fa-check text-navy"></i>
													<?php } else { ?> 
														<i class="fa-light fa-xmark text-danger"></i>
													<?php } ?>
												</center>
											</td>

											<td>
												<center>
													<?php if($valor->api > 0) { ?>
														<span class="text-navy"><?php echo $valor->api; ?></span>
													<?php } else { ?> 
														<i class="fa-light fa-xmark text-danger"></i>
													<?php } ?>
												</center>
											</td>

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

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

											<td>
												<center>
													<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>

													<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>
												</center>
											</td>
										</tr>
									<?php } ?>
								</tbody>

								<tfoot>
									<tr>
										<th class="d-none"><center>Categoria</center></th>
										<th><center>Categoria</center></th>
										<th><center>Ícone</center></th>
										<th>Título</th>

										<th><center>Root</center></th>
										<th><center>Cadastrar</center></th>
										<th><center>Editar</center></th>
										<th><center>Excluir</center></th>
										<th><center>Salvar</center></th>
										<th><center>Lote</center></th>
										<th><center>Upload</center></th>
										<th><center>API</center></th>

										<th><center>Ordem</center></th>
										<th><center>Ativo</center></th>
										<th width="250"><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'); ?>