diff --git a/src/components/officeBooking/BookingTimeBar.js b/src/components/officeBooking/BookingTimeBar.js index d775808..f61bc52 100644 --- a/src/components/officeBooking/BookingTimeBar.js +++ b/src/components/officeBooking/BookingTimeBar.js @@ -179,7 +179,10 @@ function getIndexValue(timeStr) { // 예약 현황 반영 관련 function setBookingState(props) { - bookingState = Array.from({length: 24}, () => false); + bookingState = Array.from({length: 24}, () => false); + selectedState = Array.from({length: 24}, () => false); + bookedTimeList = [] + startT = -1; endT = -1; for (var i = 0; i < props.length; i++) { setBookingTime(props[i].startTime, props[i].endTime) } diff --git a/src/pages/booking/officeBooking/OfficeBooking.js b/src/pages/booking/officeBooking/OfficeBooking.js index 3f835ef..26fa380 100644 --- a/src/pages/booking/officeBooking/OfficeBooking.js +++ b/src/pages/booking/officeBooking/OfficeBooking.js @@ -17,6 +17,7 @@ import { basicError } from 'utils/ErrorHandlerUtil'; import SmallButton from 'components/button/SmallButton'; import { Bar } from '../bookedList/BookedList'; import { getToken } from 'utils/IsLoginUtil'; +import moment from 'moment'; var bookingDate = ''; var startTimeStr = ''; @@ -59,8 +60,7 @@ function OfficeBooking(props) { var [date, setDate] = useState(""); // 예약날짜 변경 if (date.length === 0) { - const dateNow = new Date(); - date = dateNow.toISOString().slice(0, 10); + date = moment(new Date()).format("YYYY-MM-DD") bookingDate = date; } @@ -83,6 +83,7 @@ function OfficeBooking(props) { basicError(Error) console.log(Error) window.alert("예약 현황을 불러오는데 실패하였습니다.") + window.history.back() }); }; @@ -96,6 +97,7 @@ function OfficeBooking(props) { basicError(Error) console.log(Error) window.alert("회의실 정보를 불러올 수 없습니댜.") + window.history.back() }); }; diff --git a/src/pages/booking/resourceBooking/ResourceBooking.js b/src/pages/booking/resourceBooking/ResourceBooking.js index b72f4ee..3d8643e 100644 --- a/src/pages/booking/resourceBooking/ResourceBooking.js +++ b/src/pages/booking/resourceBooking/ResourceBooking.js @@ -109,11 +109,25 @@ function ResourceBooking(props) { const startDateFormat = moment(e[0]).format("YYYY-MM-DD"); const endDateFormat = moment(e[1]).format("YYYY-MM-DD"); - setStartDate(startDateFormat); - setEndDate(endDateFormat); - - startDate = startDateFormat; - endDate = endDateFormat; + setStartDate(startDateFormat) + setEndDate(endDateFormat) + + startDate = startDateFormat + endDate = endDateFormat + + for(var i=0; i= temp) { + alert('예약된 일자를 포함한 날짜는 선택할 수 없습니다.') + startDate = ''; endDate = ''; + setStartDate(startDate) + setEndDate(endDate) + window.location.reload() + return + } + } }; const onActiveStartDateChange = (e) => { diff --git a/src/pages/manager/officeBookingManage/OfficeBookingManageCell.js b/src/pages/manager/officeBookingManage/OfficeBookingManageCell.js index b233be6..b9d17c2 100644 --- a/src/pages/manager/officeBookingManage/OfficeBookingManageCell.js +++ b/src/pages/manager/officeBookingManage/OfficeBookingManageCell.js @@ -7,21 +7,23 @@ import styled from 'styled-components'; import { getToken } from 'utils/IsLoginUtil'; import { basicError } from 'utils/ErrorHandlerUtil'; -const SettingButtonContainer = styled.div` +export const SettingButtonContainer = styled.div` display: flex; width: 90%; height: 100%; align-items: center; justify-content: flex-end; ` -const SettingButton = styled.button` - color: #8741CB; - font-size: 20px; - font-style: normal; - font-weight: 400; - line-height: 22px; - background: none; - border: none; +export const SettingButton = styled.button` + color: #8741CB; + font-size: 18px; + font-style: normal; + font-weight: 400; + line-height: 22px; + background: none; + border: none; + cursor: pointer; + ` @@ -37,7 +39,7 @@ function OfficeBookingManageCell(props) { Authorization: getToken() } }) - .then((Response) => { + .then((Response) => { alert(Response.data.message) window.location.reload() }) @@ -63,7 +65,7 @@ function OfficeBookingManageCell(props) { var usingButton = ( - 반려 |상세보기 + 반려 |상세보기 ) return ( @@ -85,4 +87,4 @@ function OfficeBookingManageCell(props) { ) } -export default OfficeBookingManageCell; \ No newline at end of file +export default OfficeBookingManageCell; diff --git a/src/pages/manager/resourceBookingManage/ResourceBookingManageCell.js b/src/pages/manager/resourceBookingManage/ResourceBookingManageCell.js index 99ab625..a820cc5 100644 --- a/src/pages/manager/resourceBookingManage/ResourceBookingManageCell.js +++ b/src/pages/manager/resourceBookingManage/ResourceBookingManageCell.js @@ -2,30 +2,12 @@ import React from 'react'; import { Link } from 'react-router-dom'; import { BookedLineTr } from '../../booking/bookedList/BookedList'; import { StatusCircle, StatusContainer, StatusText } from 'components/booking/StatusTag'; -import { CANCELED, USING, WAITING, findStatus } from 'constants/BookingStatus'; +import {CANCELED, USING, WAITING, findStatus, BOOKED} from 'constants/BookingStatus'; import { AdminBookingAxios } from 'api/AxiosApi'; import styled from 'styled-components'; import { getToken } from 'utils/IsLoginUtil'; import { basicError } from 'utils/ErrorHandlerUtil'; - -const SettingButtonContainer = styled.div` - display: flex; - width: 90%; - height: 100%; - align-items: center; - justify-content: flex-end; -` -const SettingButton = styled.button` - color: #8741CB; - font-size: 20px; - font-style: normal; - font-weight: 400; - line-height: 22px; - background: none; - border: none; -` - - +import {SettingButton, SettingButtonContainer} from "../officeBookingManage/OfficeBookingManageCell"; function ResourceBookingManageCell(props) { @@ -37,7 +19,7 @@ function ResourceBookingManageCell(props) { Authorization: getToken() } }) - .then((Response) => { + .then((Response) => { alert(Response.data.message) window.location.reload() }) @@ -50,7 +32,7 @@ function ResourceBookingManageCell(props) { alert("예약 허가를 취소하셨습니다.") } - + }; const rejectResource = () => { @@ -61,7 +43,7 @@ function ResourceBookingManageCell(props) { Authorization: getToken() } }) - .then((Response) => { + .then((Response) => { alert(Response.data.message) window.location.reload() }) @@ -83,7 +65,7 @@ function ResourceBookingManageCell(props) { Authorization: getToken() } }) - .then((Response) => { + .then((Response) => { alert(Response.data.message) window.location.reload() }) @@ -103,10 +85,12 @@ function ResourceBookingManageCell(props) { + + var status = findStatus(props.status) var watingButton = ( - 허가 | 반려 | 상세보기 + 허가 | 반려 | 상세보기 ) var cancelButton = ( @@ -114,9 +98,17 @@ function ResourceBookingManageCell(props) { var usingButton = ( - 반납 | 상세보기 + 반납 | 상세보기 ) + + + var bookingButton = ( + + 반려 | 상세보기 + + ); + return ( {props.name} @@ -130,12 +122,13 @@ function ResourceBookingManageCell(props) { - {status === WAITING ? watingButton : - status === USING ? usingButton : cancelButton + {status === WAITING ? watingButton : + status === USING ? usingButton : + status === BOOKED ? bookingButton :cancelButton } ) } -export default ResourceBookingManageCell; \ No newline at end of file +export default ResourceBookingManageCell; diff --git a/src/pages/manager/resourceManage/ResourceManageAdd.js b/src/pages/manager/resourceManage/ResourceManageAdd.js index e5b2f10..ec5427e 100644 --- a/src/pages/manager/resourceManage/ResourceManageAdd.js +++ b/src/pages/manager/resourceManage/ResourceManageAdd.js @@ -156,7 +156,7 @@ function ResourceManageAdd(props) { const [selectCategory, setSelectCategory] = useState(""); const [description, setDescription] = useState(""); const [imageFile, setImageFile] = useState(null); - const [imageUrl, setImageUrl] = useState(""); + const [imageUrl, setImageUrl] = useState(null); const getCategories = () => { AdminBookingResourceAxios.get(`/category`, { @@ -199,14 +199,20 @@ function ResourceManageAdd(props) { if (imageFile !== null) { ImageUrlAxios.get(`?ext=${imageFile.type.split("/", 2)[1]}&dir=photo`) .then((Response) => { - alert(Response) + setImageUrl(Response.data); + uploadImage(); }) .catch((error) => { console.log(error) }); + }else { + addResource() } } + const uploadImage = () => { + console.log(imageUrl) + } const addResource = () => { AdminBookingResourceAxios.post(``, {