This commit is contained in:
Lizandro Guarnizo
2026-04-21 19:48:30 -05:00
parent 63da89c31a
commit c934125f2f
7 changed files with 878 additions and 212 deletions
+6 -4
View File
@@ -16,6 +16,7 @@ requireTurnero();
$datos = inputJson();
$area = $datos['area'] ?? '';
$lugarId = isset($datos['lugar_id']) ? (int) $datos['lugar_id'] : null;
$deskId = isset($datos['desk_id']) ? (int) $datos['desk_id'] : null;
// ── Validación ────────────────────────────────────────────────
if (!in_array($area, ['recepcion', 'lugar'], true)) {
@@ -42,12 +43,13 @@ try {
$stmt = $pdo->prepare(
'UPDATE turnero_turnos
SET estado = "en_recepcion",
llamado_recepcion_at = NOW(),
inicio_recepcion_at = NOW(),
atendido_recepcion_por = ?
llamado_recepcion_at = NOW(),
inicio_recepcion_at = NOW(),
atendido_recepcion_por = ?,
recepcion_desk_id = COALESCE(?, recepcion_desk_id)
WHERE id = ? AND estado = "espera"'
);
$stmt->execute([adminId(), $turno['id']]);
$stmt->execute([adminId(), $deskId, $turno['id']]);
if ($stmt->rowCount() === 0) {
// Otro proceso lo tomó primero (race condition)