diff --git a/web-ui/web-react/src/components/Reservaciones.js b/web-ui/web-react/src/components/Reservaciones.js index 70cf6275..fc51f6b4 100644 --- a/web-ui/web-react/src/components/Reservaciones.js +++ b/web-ui/web-react/src/components/Reservaciones.js @@ -43,6 +43,7 @@ const Reservations = () => { const [areas, setAreas] = useState([]); const [areaId, setAreaId] = useState(); const [tenants, setTenants] = useState([]); + const [tenantId, setTenantId] = useState(); const [saveButtonTitle, setSaveButtonTitle] = useState("Registrar") async function tenantsList(id) { @@ -264,16 +265,34 @@ const Reservations = () => { ); }; + const onInputChange = (e, name) => { + const val = (e.target && e.target.value) || ''; + let _reservation = { ...reservation }; + _reservation[`${name}`] = val; + + setReservation(_reservation); + }; + const handleAreas = (e) => { const getAreaId = e.target.value; setAreaId(getAreaId); } + const handleTenants = (e) => { + const getTenantId = e.target.value; + setAreaId(getTenantId); + } + const aList = areas.map((item) => ({ label: item.name, value: item._id, })); + const tList = tenants.map((item) => ({ + label: item.name, + value: item._id, + })); + return (
@@ -371,8 +390,53 @@ const Reservations = () => {
Reservar Área para Inquilino
- -
+
+ +
+
+ + + + onInputChange(e, 'name')} + required + autoFocus + className={classNames({ + 'p-invalid': submitted && reservation.start_time === '', + })} + /> +
+ {submitted && reservation.start_time === '' && ( + Nombre es requirido. + )} +
+
+
+ +
+
+ + + + +
+ {submitted + && !tenantId + && Inquilino es requerido.} +
+
+