<?php include "Views/templates/header.php"; ?>

<?php if ($_SESSION['permisos']['agregar marca']) {?>
    <button class="btn btn-outline-primary mb-2" type="button" onclick="frmMarca();"><i class="fas fa-plus"></i></button>
<?php } ?>
<?php if ($_SESSION['permisos']['editar marca']) {?>
    <button class="btn btn-primary mb-2 btn-toolbar-status" disabled type="button" onclick="btnEditarMar(active_row);"><i class="fas fa-edit"></i></button>
<?php } ?>
<?php if ($_SESSION['permisos']['eliminar o reingresar marca']) {?>
    <button class="btn btn-danger mb-2 btn-toolbar-status btn-eliminar" disabled type="button" onclick="btnEliminarMar(active_row);"><i class="fas fa-trash-alt"></i></button>
    <button class="btn btn-success mb-2 btn-toolbar-status btn-recuperar" disabled type="button" onclick="btnReingresarMar(active_row);" style="display: none;"><i class="fas fa-toggle-on"></i></button>
<?php } ?>

<div class="card">
    <div class="card-body">
        <div class="table-responsive">
            <table class="table table-borderd table-hover table-striped display responsive nowrap" id="t_mar" style="width: 100%;">
                <thead class="thead-dark">
                    <tr>
                        <th>Id</th>
                        <th>Marca</th>
                        <th>Estado</th>
                    </tr>
                </thead>
                <tbody>
                </tbody>
            </table>
        </div>
    </div>
</div>
<div id="nuevo_marca" 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 Marca</h5>
                <button class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <form class="needs-validation" novalidate id="formulario" autocomplete="off">
                <div class="modal-body">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="form-group">
                                <label for="marca">Nombre *</label>
                                <input type="hidden" id="id" name="id">
                                <input id="marca" class="form-control" type="text" name="marca" placeholder="Marca" required>
                                <div class="valid-feedback">
                                    Correcto
                                </div>
                                <div class="invalid-feedback">
                                    El nombre es requerido
                                </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>
                </div>
            </form>
        </div>
    </div>
</div>
<?php include "Views/templates/footer.php"; ?>