diff --git a/admin/api/requisitor_lookup.php b/admin/api/requisitor_lookup.php new file mode 100644 index 0000000..c529a25 --- /dev/null +++ b/admin/api/requisitor_lookup.php @@ -0,0 +1,45 @@ + 'Acesso negado']); + exit; +} + +$query = isset($_GET['q']) ? sanitize_input($_GET['q'], 100) : ''; +$query = trim($query); + +if (mb_strlen($query) < 2) { + echo json_encode(['items' => [], 'limit' => 10, 'requiresFilter' => true]); + $db->close(); + exit; +} + +$escaped = str_replace(['%', '_'], ['\\%', '\\_'], $query); +$idPrefixParam = $escaped . '%'; +$searchParam = '%' . $escaped . '%'; +$limit = 10; + +$stmt = $db->prepare("SELECT id, nome, email FROM cache WHERE id LIKE ? ESCAPE '\\\\' OR nome LIKE ? ESCAPE '\\\\' OR email LIKE ? ESCAPE '\\\\' ORDER BY nome ASC LIMIT ?"); +$stmt->bind_param("sssi", $idPrefixParam, $searchParam, $searchParam, $limit); +$stmt->execute(); +$result = $stmt->get_result(); + +$items = []; +while ($row = $result->fetch_assoc()) { + $items[] = [ + 'id' => $row['id'], + 'title' => $row['nome'], + 'subtitle' => $row['email'] + ]; +} + +$stmt->close(); +$db->close(); + +echo json_encode(['items' => $items, 'limit' => $limit, 'requiresFilter' => false]); +?> diff --git a/admin/api/sala_lookup.php b/admin/api/sala_lookup.php new file mode 100644 index 0000000..c848ea5 --- /dev/null +++ b/admin/api/sala_lookup.php @@ -0,0 +1,44 @@ + 'Acesso negado']); + exit; +} + +$query = isset($_GET['q']) ? sanitize_input($_GET['q'], 100) : ''; +$query = trim($query); + +if (mb_strlen($query) < 2) { + echo json_encode(['items' => [], 'limit' => 10, 'requiresFilter' => true]); + $db->close(); + exit; +} + +$escaped = str_replace(['%', '_'], ['\\%', '\\_'], $query); +$idPrefixParam = $escaped . '%'; +$searchParam = '%' . $escaped . '%'; +$limit = 10; + +$stmt = $db->prepare("SELECT id, nome FROM salas WHERE id LIKE ? ESCAPE '\\\\' OR nome LIKE ? ESCAPE '\\\\' ORDER BY nome ASC LIMIT ?"); +$stmt->bind_param("ssi", $idPrefixParam, $searchParam, $limit); +$stmt->execute(); +$result = $stmt->get_result(); + +$items = []; +while ($row = $result->fetch_assoc()) { + $items[] = [ + 'id' => $row['id'], + 'title' => $row['nome'] + ]; +} + +$stmt->close(); +$db->close(); + +echo json_encode(['items' => $items, 'limit' => $limit, 'requiresFilter' => false]); +?> diff --git a/admin/api/tempo_lookup.php b/admin/api/tempo_lookup.php new file mode 100644 index 0000000..57063a5 --- /dev/null +++ b/admin/api/tempo_lookup.php @@ -0,0 +1,44 @@ + 'Acesso negado']); + exit; +} + +$query = isset($_GET['q']) ? sanitize_input($_GET['q'], 100) : ''; +$query = trim($query); + +if (mb_strlen($query) < 2) { + echo json_encode(['items' => [], 'limit' => 10, 'requiresFilter' => true]); + $db->close(); + exit; +} + +$escaped = str_replace(['%', '_'], ['\\%', '\\_'], $query); +$idPrefixParam = $escaped . '%'; +$searchParam = '%' . $escaped . '%'; +$limit = 10; + +$stmt = $db->prepare("SELECT id, horashumanos FROM tempos WHERE id LIKE ? ESCAPE '\\\\' OR horashumanos LIKE ? ESCAPE '\\\\' ORDER BY horashumanos ASC LIMIT ?"); +$stmt->bind_param("ssi", $idPrefixParam, $searchParam, $limit); +$stmt->execute(); +$result = $stmt->get_result(); + +$items = []; +while ($row = $result->fetch_assoc()) { + $items[] = [ + 'id' => $row['id'], + 'title' => $row['horashumanos'] + ]; +} + +$stmt->close(); +$db->close(); + +echo json_encode(['items' => $items, 'limit' => $limit, 'requiresFilter' => false]); +?> diff --git a/admin/materiais.php b/admin/materiais.php index 8a2bb9c..92ebca0 100644 --- a/admin/materiais.php +++ b/admin/materiais.php @@ -1,13 +1,16 @@ - +
Nota: Para obter o RoomID de uma sala, consulte a gestão de salas ou use a listagem abaixo.
Deve de consultar o manual do administrador para mais informações.