diff --git a/src/components/searchBar/ManageSearchBar.js b/src/components/searchBar/ManageSearchBar.js index c62da83..5de395a 100644 --- a/src/components/searchBar/ManageSearchBar.js +++ b/src/components/searchBar/ManageSearchBar.js @@ -37,6 +37,7 @@ const ManageSearchText = styled.input` background: none; border: none; outline: none; + width: 100%; ` export const ManageAddButton = styled.button` diff --git a/src/pages/basic/booking/office/SelectOffice.js b/src/pages/basic/booking/office/SelectOffice.js index c9427ad..983ef6c 100644 --- a/src/pages/basic/booking/office/SelectOffice.js +++ b/src/pages/basic/booking/office/SelectOffice.js @@ -22,8 +22,8 @@ function SelectOffice(props) { const [offices, setOffices] = useState([]); const facilityName = useRef(""); const [date, setDate] = useState(""); - const [startTime, setStartTime] = useState(""); - const [endTime, setEndTime] = useState(""); + const [startTime, setStartTime] = useState("00:00"); + const [endTime, setEndTime] = useState("00:00"); const changeFacilityName = (e) => { facilityName.current = e.target.value; @@ -47,7 +47,10 @@ function SelectOffice(props) { } const searchOffice = () => { - OfficesAxios.get(`?date=${date}&startTime=${startTime}&endTime=${endTime}&facilityName=${facilityName.current}`, { + let url = `?facilityName=${facilityName.current}` + if (date !== "") + url = `?facilityName=${facilityName.current}&date=${date}&startTime=${startTime}&endTime=${endTime}` + OfficesAxios.get(url, { headers: { Authorization: getToken() } diff --git a/src/pages/basic/booking/resource/SelectResource.js b/src/pages/basic/booking/resource/SelectResource.js index 2f54af3..f98376b 100644 --- a/src/pages/basic/booking/resource/SelectResource.js +++ b/src/pages/basic/booking/resource/SelectResource.js @@ -26,8 +26,8 @@ function SelectResource(props) { const resourceName = useRef(""); const [startDate, setStartDate] = useState(""); const [endDate, setEndDate] = useState(""); - const [startTime, setStartTime] = useState(""); - const [endTime, setEndTime] = useState(""); + const [startTime, setStartTime] = useState("00:00"); + const [endTime, setEndTime] = useState("00:00"); useEffect(() => { searchResource(); @@ -46,16 +46,20 @@ function SelectResource(props) { setEndDate(e.target.value) } - const changeStart = (e) => { + const changeStartTime = (e) => { setStartTime(e.target.value) } - const changeEnd = (e) => { + const changeEndTime = (e) => { setEndTime(e.target.value) } const searchResource = () => { - ResourcesAxios.get(`?resourceName=${resourceName.current}&startDate=${startDate}&endDate=${endDate}`, + // var bookingPurpose = document.getElementById("bookingPurpose").value; + let url = `?resourceName=${resourceName.current}`; + if (startDate !== "" && endDate !== "") + url = `?resourceName=${resourceName.current}&startDate=${startDate} ${startTime}&endDate=${endDate} ${endTime}`; + ResourcesAxios.get(url, { headers: { Authorization: getToken() @@ -80,11 +84,11 @@ function SelectResource(props) { - - + + ~ - - + +