From 1da7b2c63f0e54a911c840a15e2a529ec96586c1 Mon Sep 17 00:00:00 2001 From: Mariela Date: Wed, 24 Aug 2022 16:14:33 -0600 Subject: [PATCH] =?UTF-8?q?=C3=81reacom=C3=BAnparainquilino:=20Auto=20stas?= =?UTF-8?q?h=20before=20merge=20of=20"US-30-Reservar=C3=81reacom=C3=BAnpar?= =?UTF-8?q?ainquilino"=20and=20"US-32-ListarReservas"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web-react/src/components/Reservaciones.js | 74 ++++++++++++++++++- 1 file changed, 72 insertions(+), 2 deletions(-) diff --git a/web-ui/web-react/src/components/Reservaciones.js b/web-ui/web-react/src/components/Reservaciones.js index f14d9adf..70cf6275 100644 --- a/web-ui/web-react/src/components/Reservaciones.js +++ b/web-ui/web-react/src/components/Reservaciones.js @@ -41,7 +41,9 @@ const Reservations = () => { const dt = useRef(null); const [cookies, setCookies] = useCookies() const [areas, setAreas] = useState([]); + const [areaId, setAreaId] = useState(); const [tenants, setTenants] = useState([]); + const [saveButtonTitle, setSaveButtonTitle] = useState("Registrar") async function tenantsList(id) { await fetch(`http://localhost:4000/user/findTenants/${id}`, @@ -105,8 +107,8 @@ const Reservations = () => { reservations.map((item) => { let tenant = tenants.find(item2 => item2._id == item.user_id); - if(tenant){ - item.user_name = tenant.name + ' ' + tenant.last_name; + if (tenant) { + item.user_name = tenant.name + ' ' + tenant.last_name; } }); @@ -115,7 +117,13 @@ const Reservations = () => { reservationList(cookies.community_id); }, []) + const saveReservation = () => { + if (reservation.common_area_id) { + } else { + setSubmitted(true); + } + } const actionsReservation = (rowData) => { @@ -144,6 +152,12 @@ const Reservations = () => { setDeleteReservationsDialog(true); }; + const cancelEdit = () => { + setReservation(emptyReservation); + setSaveButtonTitle('Registrar'); + setAreaId(''); + } + const leftToolbarTemplate = () => { return ( @@ -250,6 +264,16 @@ const Reservations = () => { ); }; + const handleAreas = (e) => { + const getAreaId = e.target.value; + setAreaId(getAreaId); + } + + const aList = areas.map((item) => ({ + label: item.name, + value: item._id, + })); + return (
@@ -343,7 +367,53 @@ const Reservations = () => {
+
+
+
Reservar Área para Inquilino
+
+
+ +
+
+ + + + +
+ {submitted + && !areaId + && Área Común es requerida.} +
+
+
+
+
+
+