feat: room history tab + tech task resolution comment
- RoomModal: new "История" tab showing all housekeeping and maintenance tasks for the room - Groups tasks by date (newest first), expandable cards - Shows: assignee, start time, end time, duration (started_at → completed_at) - For maintenance: description, problem/solution photos with lightbox viewer - Timing grid: start / completion timestamps - Backend GET /housekeeping: add room_id filter param - TechnicalPage CompletionModal: add resolution comment field saved to task notes - api.ts: housekeeping.list() accepts roomId param Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,7 @@ const housekeeping: FastifyPluginAsync = async (fastify) => {
|
||||
role === 'super_admin' || userSlug === slug
|
||||
|
||||
// ── GET /api/hotels/:slug/housekeeping ─────────────────────────────────────
|
||||
fastify.get<SlugParam & { Querystring: { status?: string; date?: string; category?: string } }>(
|
||||
fastify.get<SlugParam & { Querystring: { status?: string; date?: string; category?: string; room_id?: string } }>(
|
||||
'/api/hotels/:slug/housekeeping',
|
||||
{ onRequest: [fastify.authenticate] },
|
||||
async (request, reply) => {
|
||||
@@ -31,7 +31,7 @@ const housekeeping: FastifyPluginAsync = async (fastify) => {
|
||||
const values: unknown[] = [hotelId]
|
||||
let idx = 2
|
||||
|
||||
const { status, date, category } = request.query
|
||||
const { status, date, category, room_id } = request.query
|
||||
if (status === 'active') {
|
||||
conditions.push(`t.status IN ('pending', 'in_progress')`)
|
||||
} else if (status) {
|
||||
@@ -39,6 +39,7 @@ const housekeeping: FastifyPluginAsync = async (fastify) => {
|
||||
}
|
||||
if (date) { conditions.push(`t.due_date = $${idx}`); values.push(date); idx++ }
|
||||
if (category) { conditions.push(`t.category = $${idx}`); values.push(category); idx++ }
|
||||
if (room_id) { conditions.push(`t.room_id = $${idx}`); values.push(room_id); idx++ }
|
||||
|
||||
const { rows } = await db.query(
|
||||
`SELECT t.*,
|
||||
@@ -50,7 +51,7 @@ const housekeeping: FastifyPluginAsync = async (fastify) => {
|
||||
WHERE ${conditions.join(' AND ')}
|
||||
ORDER BY
|
||||
CASE t.priority WHEN 'urgent' THEN 1 WHEN 'high' THEN 2 WHEN 'medium' THEN 3 ELSE 4 END,
|
||||
t.created_at`,
|
||||
COALESCE(t.completed_at, t.created_at) DESC`,
|
||||
values,
|
||||
)
|
||||
return rows
|
||||
|
||||
Reference in New Issue
Block a user