feat: fix backend SQL columns, add dark/light theme, fix legacy CSS
- Fix 7 backend controllers: rename columns to match actual DB schema (name_room→room_number, id_room→id, bed_type→room_type, id_employee→id, status_employee→status) - Fix 10 frontend files with matching property renames - Add ThemeContext with dark/light toggle (localStorage persisted) - Redesign theme.css with [data-theme] attribute selectors - Add Google Fonts (Syne, DM Sans, JetBrains Mono) - Redesign sidebar, topbar, and login page CSS - Migrate ~44 legacy CSS files from hardcoded colors to CSS variables - Remove Dashboards/Tableros section from menu - Clean up commented-out CSS blocks across codebase Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,10 +5,10 @@ const getReservations = async (req, res) => {
|
||||
const { status, from_date, to_date, search } = req.query;
|
||||
let query = `
|
||||
SELECT r.*, g.first_name, g.last_name, g.phone, g.email,
|
||||
rm.name_room, rm.bed_type
|
||||
rm.room_number, rm.room_type
|
||||
FROM reservations r
|
||||
JOIN guests g ON g.id = r.guest_id
|
||||
LEFT JOIN rooms rm ON rm.id_room = r.room_id
|
||||
LEFT JOIN rooms rm ON rm.id = r.room_id
|
||||
WHERE 1=1
|
||||
`;
|
||||
const params = [];
|
||||
@@ -128,7 +128,7 @@ const updateReservationStatus = async (req, res) => {
|
||||
// Cascading side effects
|
||||
if (status === 'checked_in') {
|
||||
// Set room to occupied
|
||||
await pool.query("UPDATE rooms SET status = 'occupied' WHERE id_room = $1", [reservation.room_id]);
|
||||
await pool.query("UPDATE rooms SET status = 'occupied' WHERE id = $1", [reservation.room_id]);
|
||||
await pool.query(
|
||||
'INSERT INTO room_status_log (room_id, previous_status, new_status, changed_by) VALUES ($1, $2, $3, $4)',
|
||||
[reservation.room_id, 'available', 'occupied', userId]
|
||||
@@ -142,7 +142,7 @@ const updateReservationStatus = async (req, res) => {
|
||||
|
||||
if (status === 'checked_out') {
|
||||
// Set room to cleaning
|
||||
await pool.query("UPDATE rooms SET status = 'cleaning' WHERE id_room = $1", [reservation.room_id]);
|
||||
await pool.query("UPDATE rooms SET status = 'cleaning' WHERE id = $1", [reservation.room_id]);
|
||||
await pool.query(
|
||||
'INSERT INTO room_status_log (room_id, previous_status, new_status, changed_by) VALUES ($1, $2, $3, $4)',
|
||||
[reservation.room_id, 'occupied', 'cleaning', userId]
|
||||
@@ -162,7 +162,7 @@ const updateReservationStatus = async (req, res) => {
|
||||
if (status === 'cancelled') {
|
||||
// Free room if it was occupied
|
||||
if (reservation.status === 'checked_in') {
|
||||
await pool.query("UPDATE rooms SET status = 'available' WHERE id_room = $1", [reservation.room_id]);
|
||||
await pool.query("UPDATE rooms SET status = 'available' WHERE id = $1", [reservation.room_id]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user