Add an accommodations reservations module #188

Merged
pierre merged 81 commits from accomodation_module into master 2024-06-22 21:30:26 +00:00
7 changed files with 18 additions and 5 deletions
Showing only changes of commit be9a278c11 - Show all commits

View File

@ -8,7 +8,7 @@ import {
import React from "react"; import React from "react";
import { ServerApi } from "../../api/ServerApi"; import { ServerApi } from "../../api/ServerApi";
import { NewCalendarURL } from "../../api/accommodations/AccommodationsCalendarURLApi"; import { NewCalendarURL } from "../../api/accommodations/AccommodationsCalendarURLApi";
import { checkConstraint } from "../../utils/from_utils"; import { checkConstraint } from "../../utils/form_utils";
import { useAccommodations } from "../../widgets/accommodations/BaseAccommodationsRoute"; import { useAccommodations } from "../../widgets/accommodations/BaseAccommodationsRoute";
import { PropEdit } from "../../widgets/forms/PropEdit"; import { PropEdit } from "../../widgets/forms/PropEdit";
import { PropSelect } from "../../widgets/forms/PropSelect"; import { PropSelect } from "../../widgets/forms/PropSelect";

View File

@ -9,7 +9,7 @@ import {
import React from "react"; import React from "react";
import { ServerApi } from "../../api/ServerApi"; import { ServerApi } from "../../api/ServerApi";
import { UpdateAccommodation } from "../../api/accommodations/AccommodationListApi"; import { UpdateAccommodation } from "../../api/accommodations/AccommodationListApi";
import { checkConstraint } from "../../utils/from_utils"; import { checkConstraint } from "../../utils/form_utils";
import { PropCheckbox } from "../../widgets/forms/PropCheckbox"; import { PropCheckbox } from "../../widgets/forms/PropCheckbox";
import { PropEdit } from "../../widgets/forms/PropEdit"; import { PropEdit } from "../../widgets/forms/PropEdit";
import { PropColorPicker } from "../../widgets/forms/PropColorPicker"; import { PropColorPicker } from "../../widgets/forms/PropColorPicker";

View File

@ -560,10 +560,14 @@ export function AccommodationsReservationsRoute(): React.ReactElement {
</Menu> </Menu>
</> </>
)} )}
{user.user.id === activeEvent?.reservation.user_id && ( {user.user.id === activeEvent?.reservation.user_id && (
<> <>
<Tooltip title="Modifier les dates de réservation" arrow> <Tooltip title="Modifier les dates de réservation" arrow>
<IconButton <IconButton
disabled={
!activeEvent.accommodation.open_to_reservations
}
onClick={() => onClick={() =>
changeReservation(activeEvent?.reservation) changeReservation(activeEvent?.reservation)
} }

View File

@ -3,6 +3,7 @@ import CheckIcon from "@mui/icons-material/Check";
import CloseIcon from "@mui/icons-material/Close"; import CloseIcon from "@mui/icons-material/Close";
import HouseIcon from "@mui/icons-material/House"; import HouseIcon from "@mui/icons-material/House";
import { import {
Alert,
Button, Button,
Card, Card,
CardActions, CardActions,
@ -310,10 +311,16 @@ function AccommodationsCalURLsCard(): React.ReactElement {
</Typography> </Typography>
<Typography> <Typography>
Vous pouvez, si vous le souhaitez, importer dans votre application de Vous pouvez, si vous le souhaitez, importer dans votre application de
calendrier le planning de réservation des logement. Pour ce faire, il calendrier le planning de réservation des logements. Pour ce faire, il
vous suffit de créer une URL de calendrier. vous suffit de créer une URL de calendrier.
</Typography> </Typography>
<Alert severity="info">
Les calendriers créés ici ne sont visible que par vous. Vous ne pouvez
pas manipuler les calendriers créés par les autres membres de la
famille.
</Alert>
<Button <Button
startIcon={<AddIcon />} startIcon={<AddIcon />}
variant="outlined" variant="outlined"

View File

@ -15,7 +15,7 @@ export function checkConstraint(
return `Veuillez indiquer au moins ${constraint.min} caractères !`; return `Veuillez indiquer au moins ${constraint.min} caractères !`;
if (value.length > constraint.max) if (value.length > constraint.max)
return `Veuillez indiquer au maximum ${constraint.min} caractères !`; return `Veuillez indiquer au maximum ${constraint.max} caractères !`;
return undefined; return undefined;
} }

View File

@ -9,7 +9,7 @@ export function CopyToClipboard(
const copy = () => { const copy = () => {
navigator.clipboard.writeText(p.content); navigator.clipboard.writeText(p.content);
snackbar(`${p.content} copied to clipboard.`); snackbar(`${p.content} a été copié dans le presse papier.`);
}; };
return ( return (

View File

@ -151,6 +151,8 @@ pub async fn anonymous_access(req: web::Path<AnonymousAccessURL>) -> HttpResult
cal.events.push(event); cal.events.push(event);
} }
// TODO : update last used of calendar, if required
Ok(HttpResponse::Ok() Ok(HttpResponse::Ok()
.content_type("text/calendar") .content_type("text/calendar")
.body(cal.generate())) .body(cal.generate()))