+
+
+ Cliquez sur le calendrier pour créer une réservation.
+
+
+ {/* Invitation status */}
+
+ Status
+
+ setShowValidated(v)}
+ color="success"
+ />
+ }
+ label="Validées"
+ />
+ setShowRejected(v)}
+ color="error"
+ />
+ }
+ label="Rejetées"
+ />
+ setShowPending(v)}
+ color="info"
+ />
+ }
+ label="En attente de validation"
+ />
+
+
+
+ {/* Accommodations */}
+
+ Logements
+
+ {accommodations.accommodations.fullList.map((a) => (
+ {
+ if (v) hiddenAccommodations.delete(a.id);
+ else hiddenAccommodations.add(a.id);
+ setHiddenAccommodations(
+ new Set(hiddenAccommodations)
+ );
+ }}
+ />
+ }
+ label={a.name}
+ />
+ ))}
+
+
+
+ {/* People */}
+
+ Personnes
+
+ {users?.map((u) => (
+ {
+ if (v) hiddenPeople.delete(u.user_id);
+ else hiddenPeople.add(u.user_id);
+ setHiddenPeople(new Set(hiddenPeople));
+ }}
+ />
+ }
+ label={u.user_name}
+ />
+ ))}
+
+
+
+
+ {/* The calendar */}
+
+ {
+ const a = accommodations.accommodations.get(
+ r.accommodation_id
+ )!;
+ const u = users?.find((u) => u.user_id === r.user_id);
+ return {
+ title: `${u?.user_name} - ${a.name}`,
+ start: fmtUnixDateFullCalendar(r.reservation_start, false),
+ end: fmtUnixDateFullCalendar(r.reservation_end, true),
+ allDay: true,
+ color: a.color ? "#" + a.color : undefined,
+ borderColor:
+ r.validated === true
+ ? "green"
+ : r.validated === false
+ ? "red"
+ : "grey ",
+ extendedProps: {
+ id: r.id,
+ },
+ };
+ })}
+ />
+
+
+ {/* Calendar event popover */}
+
+
{
+ setActiveEvent(undefined);
+ }}
+ anchorOrigin={{
+ vertical: "bottom",
+ horizontal: "left",
+ }}
+ >
+
+
+ {activeEvent?.user.user_name
+ .substring(0, 1)
+ .toLocaleUpperCase()}
+
+ }
+ title={activeEvent?.user.user_name}
+ subheader={activeEvent?.user.user_mail}
+ />
+
+
+
+
+ Réservation de {activeEvent?.accommodation.name}
+
+ {activeEvent?.accommodation.description}
+
+
+ Du{" "}
+ {fmtUnixDate(
+ activeEvent?.reservation.reservation_start ?? 0
+ )}{" "}
+
+ Au{" "}
+ {fmtUnixDate(
+ activeEvent?.reservation.reservation_end ?? 0
+ )}
+
+
+
+ {activeEvent?.reservation.validated === false ? (
+ Refusée
+ ) : activeEvent?.reservation.validated === true ? (
+ Validée
+ ) : (
+
+ En attente de validation
+
+ )}
+
+
+
+
+
+ {activeEvent?.accommodation.need_validation &&
+ family.family.is_admin && (
+ <>
+
+
+ setValidateResaAnchorEl(e.currentTarget)
+ }
+ >
+
+
+
+
+ >
+ )}
+
+ {user.user.id === activeEvent?.reservation.user_id && (
+ <>
+
+
+ changeReservation(activeEvent?.reservation)
+ }
+ >
+
+
+
+
+
+ deleteReservation(activeEvent?.reservation)
+ }
+ >
+
+
+
+ >
+ )}
+
+
+
+
+ )}
+ />
+ >
+ );
+}
diff --git a/geneit_app/src/routes/family/accommodations/AccommodationsSettingsRoute.tsx b/geneit_app/src/routes/family/accommodations/AccommodationsSettingsRoute.tsx
new file mode 100644
index 0000000..9022ef5
--- /dev/null
+++ b/geneit_app/src/routes/family/accommodations/AccommodationsSettingsRoute.tsx
@@ -0,0 +1,410 @@
+import AddIcon from "@mui/icons-material/Add";
+import CheckIcon from "@mui/icons-material/Check";
+import CloseIcon from "@mui/icons-material/Close";
+import HouseIcon from "@mui/icons-material/House";
+import {
+ Alert,
+ Button,
+ Card,
+ CardActions,
+ CardContent,
+ Typography,
+} from "@mui/material";
+import React from "react";
+import {
+ Accommodation,
+ AccommodationListApi,
+} from "../../../api/accommodations/AccommodationListApi";
+import {
+ AccommodationCalendarURL,
+ AccommodationsCalendarURLApi,
+} from "../../../api/accommodations/AccommodationsCalendarURLApi";
+import { useConfirm } from "../../../hooks/context_providers/ConfirmDialogProvider";
+import { useLoadingMessage } from "../../../hooks/context_providers/LoadingMessageProvider";
+import { useSnackbar } from "../../../hooks/context_providers/SnackbarProvider";
+import { useCreateAccommodationCalendarURL } from "../../../hooks/context_providers/accommodations/CreateAccommodationCalendarURLDialogProvider";
+import { useInstallCalendarDialog } from "../../../hooks/context_providers/accommodations/InstallCalendarDialogProvider";
+import { useUpdateAccommodation } from "../../../hooks/context_providers/accommodations/UpdateAccommodationDialogProvider";
+import { AsyncWidget } from "../../../widgets/AsyncWidget";
+import { useFamily } from "../../../widgets/BaseFamilyRoute";
+import { FamilyCard } from "../../../widgets/FamilyCard";
+import { TimeWidget } from "../../../widgets/TimeWidget";
+import { useAccommodations } from "../../../widgets/accommodations/BaseAccommodationsRoute";
+
+const CARDS_WIDTH = "500px";
+
+export function AccommodationsSettingsRoute(): React.ReactElement {
+ return (
+ <>
+