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.} +
+
+
+
+
+
+