diff --git a/agregar_producto.php b/agregar_producto.php index 3434b23..012e92f 100644 --- a/agregar_producto.php +++ b/agregar_producto.php @@ -26,6 +26,10 @@ try { +
+ + +
diff --git a/assets/css/style.css b/assets/css/style.css index 4a3fd4a..2df147e 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -306,6 +306,7 @@ a:hover { flex-grow: 1; padding: 2rem; background-color: var(--color-fondo); + width: 100%; /* Ensure it takes full width */ } /* Forzar color de texto en el cuerpo de las tablas */ @@ -318,4 +319,39 @@ a:hover { color: #000 !important; } +/* --- Responsive / Mobile --- */ +@media (max-width: 768px) { + .d-flex { + flex-direction: column; + } + + .sidebar { + min-width: 100%; + max-width: 100%; + min-height: auto; + display: none; /* Hidden by default on mobile */ + } + + .sidebar.show { + display: flex; + } + + .main-content { + padding: 1rem; + } + + .mobile-nav { + display: flex !important; + justify-content: space-between; + align-items: center; + padding: 1rem; + background-color: #00754A; + color: white; + } +} + +.mobile-nav { + display: none; /* Hidden on desktop */ +} + diff --git a/assets/pasted-20260202-195725-d26f89a4.png b/assets/pasted-20260202-195725-d26f89a4.png new file mode 100644 index 0000000..9b105bc Binary files /dev/null and b/assets/pasted-20260202-195725-d26f89a4.png differ diff --git a/editar_producto.php b/editar_producto.php index c4b8150..9e746e1 100644 --- a/editar_producto.php +++ b/editar_producto.php @@ -39,6 +39,11 @@ if (!$product) {
+
+ + +
+
diff --git a/handle_agregar_producto.php b/handle_agregar_producto.php index eec0634..5d57a08 100644 --- a/handle_agregar_producto.php +++ b/handle_agregar_producto.php @@ -11,6 +11,7 @@ require_once 'db/config.php'; if ($_SERVER["REQUEST_METHOD"] == "POST") { // Sanitize and retrieve product data $nombre = filter_input(INPUT_POST, 'nombre', FILTER_SANITIZE_STRING); + $codigo_barras = filter_input(INPUT_POST, 'codigo_barras', FILTER_SANITIZE_STRING); $descripcion = filter_input(INPUT_POST, 'descripcion', FILTER_SANITIZE_STRING); $costo = filter_input(INPUT_POST, 'costo', FILTER_VALIDATE_FLOAT); $precio_venta = filter_input(INPUT_POST, 'precio_venta', FILTER_VALIDATE_FLOAT); @@ -26,9 +27,9 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { // 1. Insert product $sku = 'SKU-' . strtoupper(substr(uniqid(), -8)); - $sql_producto = "INSERT INTO productos (sku, nombre, descripcion, costo, precio_venta, created_at) VALUES (?, ?, ?, ?, ?, NOW())"; + $sql_producto = "INSERT INTO productos (sku, nombre, codigo_barras, descripcion, costo, precio_venta, created_at) VALUES (?, ?, ?, ?, ?, ?, NOW())"; $stmt_producto = $pdo->prepare($sql_producto); - $stmt_producto->execute([$sku, $nombre, $descripcion, $costo, $precio_venta]); + $stmt_producto->execute([$sku, $nombre, $codigo_barras, $descripcion, $costo, $precio_venta]); // Get the ID of the new product $producto_id = $pdo->lastInsertId(); diff --git a/handle_editar_producto.php b/handle_editar_producto.php index 99741d3..40ed563 100644 --- a/handle_editar_producto.php +++ b/handle_editar_producto.php @@ -10,6 +10,7 @@ require_once 'db/config.php'; if ($_SERVER["REQUEST_METHOD"] == "POST") { $product_id = isset($_POST['id']) ? (int)$_POST['id'] : 0; $nombre = trim($_POST['nombre']); + $codigo_barras = trim($_POST['codigo_barras']); $descripcion = trim($_POST['descripcion']); $costo = filter_input(INPUT_POST, 'costo', FILTER_VALIDATE_FLOAT); $precio_venta = filter_input(INPUT_POST, 'precio_venta', FILTER_VALIDATE_FLOAT); @@ -17,10 +18,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($product_id > 0 && !empty($nombre) && $costo !== false && $precio_venta !== false) { try { $pdo = db(); - $sql = "UPDATE productos SET nombre = ?, descripcion = ?, costo = ?, precio_venta = ? WHERE id = ?"; + $sql = "UPDATE productos SET nombre = ?, codigo_barras = ?, descripcion = ?, costo = ?, precio_venta = ? WHERE id = ?"; $stmt = $pdo->prepare($sql); - if ($stmt->execute([$nombre, $descripcion, $costo, $precio_venta, $product_id])) { + if ($stmt->execute([$nombre, $codigo_barras, $descripcion, $costo, $precio_venta, $product_id])) { $_SESSION['success_message'] = "Producto actualizado correctamente."; } else { $_SESSION['error_message'] = "Error al actualizar el producto."; diff --git a/imprimir_codigo.php b/imprimir_codigo.php new file mode 100644 index 0000000..cabb44d --- /dev/null +++ b/imprimir_codigo.php @@ -0,0 +1,82 @@ +prepare("SELECT * FROM productos WHERE id = ?"); +$stmt->execute([$product_id]); +$product = $stmt->fetch(PDO::FETCH_ASSOC); + +if (!$product) { + die("Producto no encontrado."); +} + +$barcodeValue = $product['codigo_barras'] ? $product['codigo_barras'] : $product['sku']; +?> + + + + + + Imprimir Código de Barras - <?php echo htmlspecialchars($product['nombre']); ?> + + + + + +
+ + +
+
+ +
+
+ +
+ + + + diff --git a/includes/footer.php b/includes/footer.php index 9ad4207..b35200e 100644 --- a/includes/footer.php +++ b/includes/footer.php @@ -6,5 +6,25 @@ + + \ No newline at end of file diff --git a/includes/header.php b/includes/header.php index 0b5001c..06292ce 100644 --- a/includes/header.php +++ b/includes/header.php @@ -29,8 +29,16 @@ if (!is_logged_in()) {
+ +
+

Inventario

+ +
+ -