-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoomsOverview.tsx
More file actions
70 lines (66 loc) · 2.04 KB
/
RoomsOverview.tsx
File metadata and controls
70 lines (66 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import type { RoomWithOptionalGuestBooking } from "@shared";
import { OverviewCard } from "@/components/rooms/OverviewCard";
type RoomsOverviewProps = {
rooms: Array<RoomWithOptionalGuestBooking>;
};
// TODO: Replace with hifi (this is just to confirm the data is correct for us to ship rooms list)
export function RoomsOverview({ rooms }: RoomsOverviewProps) {
const totalRooms = rooms.length;
const occupiedRooms = rooms.filter(
(r) => r.booking_status === "active",
).length;
const cleaningRooms = rooms.filter(
(r) => r.room_status === "cleaning",
).length;
const cleaningOnlyRooms = rooms.filter(
(r) => r.room_status === "cleaning" && r.booking_status !== "active",
).length;
const occupiedAndCleaningRooms = rooms.filter(
(r) => r.booking_status === "active" && r.room_status === "cleaning",
).length;
const vacantRooms = totalRooms - occupiedRooms;
return (
<aside className="w-1/4 shrink-0 min-h-0 overflow-y-auto px-6">
<div className="flex flex-col">
<OverviewCard
title="Tasks"
columns={[
{
field: "Urgent",
value: 0,
description: "Tasks",
urgent: true,
},
{
field: "Unassigned",
value: cleaningOnlyRooms,
description: "Tasks",
},
{ field: "Pending", value: cleaningRooms, description: "Tasks" },
]}
/>
<OverviewCard
title="Guest Flow"
columns={[
{
field: "Floor Occupancy",
value: occupiedRooms,
valueSecondary: totalRooms,
description: "Rooms occupied",
},
{
field: "Expected Arrivals",
value: vacantRooms,
description: "Guests",
},
{
field: "Expected Departures",
value: occupiedAndCleaningRooms,
description: "Guests",
},
]}
/>
</div>
</aside>
);
}