20 lines
502 B
PHP
20 lines
502 B
PHP
<?php
|
|
require_once __DIR__ . '/../config/config.php';
|
|
require_once __DIR__ . '/../config/database.php';
|
|
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
|
|
$empresaId = (int) ($_GET['empresa_id'] ?? 0);
|
|
if ($empresaId <= 0) {
|
|
echo json_encode([]);
|
|
exit;
|
|
}
|
|
|
|
$db = getDB();
|
|
$stmt = $db->prepare('
|
|
SELECT id, nombre FROM servicios
|
|
WHERE empresa_id = ? AND activo = 1
|
|
ORDER BY nombre
|
|
');
|
|
$stmt->execute([$empresaId]);
|
|
echo json_encode($stmt->fetchAll(), JSON_UNESCAPED_UNICODE);
|