79 lines
3.0 KiB
PHP
79 lines
3.0 KiB
PHP
<?php
|
|
require_once 'includes/session.php';
|
|
require_once 'db/config.php';
|
|
include_once 'includes/header.php';
|
|
|
|
// Fetch macro areas from the database
|
|
$pdo = db();
|
|
$stmt = $pdo->query('SELECT * FROM macro_areas ORDER BY nome ASC');
|
|
$macro_areas = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
?>
|
|
|
|
<div class="container-fluid">
|
|
<!-- Page Heading -->
|
|
<div class="d-sm-flex align-items-center justify-content-between mb-4">
|
|
<h1 class="h3 mb-0 text-gray-800">Macro Áreas</h1>
|
|
<a href="#" class="btn btn-success btn-icon-split">
|
|
<span class="icon text-white-50">
|
|
<i class="fas fa-plus"></i>
|
|
</span>
|
|
<span class="text">Nova Macro Área</span>
|
|
</a>
|
|
</div>
|
|
|
|
<div class="card shadow mb-4">
|
|
<div class="card-header py-3">
|
|
<h6 class="m-0 font-weight-bold text-primary">Registros</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
|
|
<thead>
|
|
<tr>
|
|
<th>Nome</th>
|
|
<th>Descrição</th>
|
|
<th>Status</th>
|
|
<th>Ações</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($macro_areas as $area): ?>
|
|
<tr>
|
|
<td><?php echo htmlspecialchars($area['nome']); ?></td>
|
|
<td><?php echo htmlspecialchars($area['descricao']); ?></td>
|
|
<td>
|
|
<?php if ($area['ativo']): ?>
|
|
<span class="badge badge-success">Ativo</span>
|
|
<?php else: ?>
|
|
<span class="badge badge-secondary">Arquivado</span>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td>
|
|
<a href="#" class="btn btn-info btn-circle btn-sm">
|
|
<i class="fas fa-edit"></i>
|
|
</a>
|
|
<a href="#" class="btn btn-danger btn-circle btn-sm">
|
|
<i class="fas fa-trash"></i>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php if (empty($macro_areas)): ?>
|
|
<tr>
|
|
<td colspan="4" class="text-center">Nenhuma macro área encontrada.</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<!-- /.container-fluid -->
|
|
|
|
<?php
|
|
include_once 'includes/footer.php';
|
|
?>
|