<?php include "Views/templates/header.php"; ?>
<?php if ($_SESSION['permisos']['agregar categoria']) {?>
    <button class="btn btn-outline-primary mb-2" type="button" onclick="frmCat();"><i class="fas fa-plus"></i></button>
<?php } ?>
<?php if ($_SESSION['permisos']['editar categoria']) {?>
    <button class="btn btn-primary btn-toolbar-status mb-2" disabled type="button" onclick="btnEditarCat(active_row);"><i class="fas fa-edit"></i></button>
<?php } ?>
<?php if ($_SESSION['permisos']['eliminar y reingresar categoria']) {?>
    <button class="btn btn-danger btn-toolbar-status btn-eliminar mb-2" disabled type="button" onclick="btnEliminarCat(active_row);"><i class="fas fa-trash-alt"></i></button>
    <button class="btn btn-success btn-toolbar-status btn-recuperar mb-2" disabled type="button" onclick="btnReingresarCat(active_row);" style="display: none;"><i class="fas fa-toggle-on"></i></button>
<?php } ?>
<?php if ($_SESSION['permisos']['generar catalogo categorias']) {?>
    <button class="btn btn-warning btn-toolbar-status btn-eliminar mb-2" disabled type="button" onclick="btnGenerarCatalogo(active_row);"><i class="fa fa-list"></i></button>
<?php } ?>


<div class="card">
    <div class="card-body">
        <div class="table-responsive">
            <table class="table table-bordered table-striped display responsive nowrap" id="t_cat" style="width: 100%;">
                <thead class="thead-dark">
                    <tr>
                        <th>Id</th>
                        <th>Categoria</th>
                        <th>Estado</th>
                    </tr>
                </thead>
                <tbody>
                </tbody>
            </table>
        </div>
    </div>
</div>
<div id="nuevo_categoria" class="modal fade" data-focus="false" role="dialog" aria-labelledby="my-modal-title" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header bg-primary">
                <h5 class="modal-title text-white" id="title">Nueva Categoria</h5>
                <button class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <form method="post" id="formulario" class="needs-validation" novalidate autocomplete="off">
                <div class="modal-body">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="form-group">
                                <label for="categoria">Nombre *</label>
                                <input type="hidden" id="id" name="id">
                                <input id="categoria" class="form-control" type="text" name="categoria" placeholder="Categoria" required>
                                <div class="valid-feedback">
                                    Correcto
                                </div>
                                <div class="invalid-feedback">
                                    El nombre es requerido
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-outline-primary" type="submit" id="btnAccion">Registrar</button>
                    <button class="btn btn-outline-danger" type="button" data-dismiss="modal">Cancelar</button>
                </div>
            </form>
        </div>
    </div>
</div>
<?php include "Views/templates/footer.php"; ?>