feat: add room-planner app — 3-day HK room view with NewBook integration
NewBook-connected daily housekeeping planner. Replaces the hotelhubmodule-housekeeping-dailylist WordPress plugin. LXC 120 · 10.10.10.120:3080 · slug: room-planner. - 3-day booking window (yesterday/today/tomorrow) fetched live from NewBook - Task completion ticks back to NewBook; room status patches NewBook directly - 23px border sliver CSS system for adjacent-day booking status - 3-state filter cycling (off→inclusive→exclusive) for categories and flow types - Stat filters for outstanding tasks and clean/dirty status - Rolling 48h activity log with checkout/checkin/status/tasks events - newbook_pings event bus for future NewBook poller integration - Room modal with permission-gated guest/rate/notes, task checkboxes, status buttons - Placeholder sections for future linen-count and routine-tasks modules - Settings page: task type colours, twin/extra-bed detection, category exclusions - Mobile-first layout (sidebar desktop, compact top bar mobile) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
commit
1e658b6a48
39 changed files with 3765 additions and 0 deletions
57
seed-app.js
Normal file
57
seed-app.js
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
#!/usr/bin/env node
|
||||
// Run from room-planner/ dir: DATABASE_URL=... node seed-app.js
|
||||
import pg from 'pg'
|
||||
|
||||
const { Pool } = pg
|
||||
const pool = new Pool({ connectionString: process.env.DATABASE_URL })
|
||||
|
||||
await pool.query(`
|
||||
INSERT INTO apps (slug, name, description, base_path, icon, theme_color, category, internal_host, internal_port)
|
||||
VALUES ('room-planner', 'Room Planner', 'Daily housekeeping room view with NewBook task management', '/room-planner', 'BedDouble', '#2d6a4f', 'Housekeeping', '10.10.10.120', 3080)
|
||||
ON CONFLICT (slug) DO UPDATE SET
|
||||
name = EXCLUDED.name,
|
||||
description = EXCLUDED.description,
|
||||
base_path = EXCLUDED.base_path,
|
||||
icon = EXCLUDED.icon,
|
||||
theme_color = EXCLUDED.theme_color,
|
||||
category = EXCLUDED.category,
|
||||
internal_host = EXCLUDED.internal_host,
|
||||
internal_port = EXCLUDED.internal_port
|
||||
`)
|
||||
|
||||
// Seed capabilities
|
||||
await pool.query(`
|
||||
INSERT INTO app_capabilities (app_id, slug, name, description, sort_order)
|
||||
SELECT a.id, c.slug, c.name, c.description, c.sort_order
|
||||
FROM apps a, (VALUES
|
||||
('view', 'View Planner', 'Access the room planner view', 1),
|
||||
('guest_details', 'Guest Details', 'View guest names and personal information', 2),
|
||||
('rate_details', 'Rate Details', 'View pricing and rate plan information', 3),
|
||||
('view_all_notes','View All Notes', 'View all booking note types', 4),
|
||||
('complete_tasks','Complete Tasks', 'Mark NewBook tasks as complete', 5),
|
||||
('update_status', 'Update Room Status', 'Mark rooms clean, dirty or inspected', 6),
|
||||
('settings', 'Settings', 'Configure room planner settings', 7)
|
||||
) AS c(slug, name, description, sort_order)
|
||||
WHERE a.slug = 'room-planner'
|
||||
ON CONFLICT (app_id, slug) DO NOTHING
|
||||
`)
|
||||
|
||||
// Grant all caps to Staff role (except settings) if they have none yet
|
||||
await pool.query(`
|
||||
INSERT INTO role_capabilities (role_id, cap_id)
|
||||
SELECT r.id, ac.id
|
||||
FROM roles r
|
||||
JOIN app_capabilities ac ON ac.slug != 'settings'
|
||||
JOIN apps a ON a.id = ac.app_id AND a.slug = 'room-planner'
|
||||
WHERE r.name = 'Staff'
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM role_capabilities rc2
|
||||
JOIN app_capabilities ac2 ON rc2.cap_id = ac2.id
|
||||
JOIN apps a2 ON ac2.app_id = a2.id AND a2.slug = 'room-planner'
|
||||
WHERE rc2.role_id = r.id
|
||||
)
|
||||
ON CONFLICT DO NOTHING
|
||||
`)
|
||||
|
||||
console.log('room-planner app seeded.')
|
||||
await pool.end()
|
||||
Loading…
Add table
Add a link
Reference in a new issue