Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
psyeon1120 committed Oct 17, 2023
2 parents a761521 + f1e5d4e commit 2583323
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 51 deletions.
5 changes: 4 additions & 1 deletion src/components/officeBooking/BookingTimeBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 4 additions & 2 deletions src/pages/booking/officeBooking/OfficeBooking.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down Expand Up @@ -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;
}

Expand All @@ -83,6 +83,7 @@ function OfficeBooking(props) {
basicError(Error)
console.log(Error)
window.alert("예약 현황을 불러오는데 실패하였습니다.")
window.history.back()
});
};

Expand All @@ -96,6 +97,7 @@ function OfficeBooking(props) {
basicError(Error)
console.log(Error)
window.alert("회의실 정보를 불러올 수 없습니댜.")
window.history.back()
});
};

Expand Down
24 changes: 19 additions & 5 deletions src/pages/booking/resourceBooking/ResourceBooking.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<dates.length; i++) {
var temp = new Date(dates[i])
temp = moment(temp).format("YYYY-MM-DD")

if (startDateFormat <= temp && endDateFormat >= temp) {
alert('예약된 일자를 포함한 날짜는 선택할 수 없습니다.')
startDate = ''; endDate = '';
setStartDate(startDate)
setEndDate(endDate)
window.location.reload()
return
}
}
};

const onActiveStartDateChange = (e) => {
Expand Down
26 changes: 14 additions & 12 deletions src/pages/manager/officeBookingManage/OfficeBookingManageCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
`


Expand All @@ -37,7 +39,7 @@ function OfficeBookingManageCell(props) {
Authorization: getToken()
}
})
.then((Response) => {
.then((Response) => {
alert(Response.data.message)
window.location.reload()
})
Expand All @@ -63,7 +65,7 @@ function OfficeBookingManageCell(props) {

var usingButton = (
<SettingButtonContainer>
<SettingButton onClick={rejectResource}>반려</SettingButton> |<SettingButton onClick={moveToDetail}>상세보기</SettingButton>
<SettingButton onClick={rejectResource}>반려</SettingButton> |<SettingButton onClick={moveToDetail}>상세보기</SettingButton>
</SettingButtonContainer>)

return (
Expand All @@ -85,4 +87,4 @@ function OfficeBookingManageCell(props) {
)
}

export default OfficeBookingManageCell;
export default OfficeBookingManageCell;
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -37,7 +19,7 @@ function ResourceBookingManageCell(props) {
Authorization: getToken()
}
})
.then((Response) => {
.then((Response) => {
alert(Response.data.message)
window.location.reload()
})
Expand All @@ -50,7 +32,7 @@ function ResourceBookingManageCell(props) {
alert("예약 허가를 취소하셨습니다.")
}


};

const rejectResource = () => {
Expand All @@ -61,7 +43,7 @@ function ResourceBookingManageCell(props) {
Authorization: getToken()
}
})
.then((Response) => {
.then((Response) => {
alert(Response.data.message)
window.location.reload()
})
Expand All @@ -83,7 +65,7 @@ function ResourceBookingManageCell(props) {
Authorization: getToken()
}
})
.then((Response) => {
.then((Response) => {
alert(Response.data.message)
window.location.reload()
})
Expand All @@ -103,20 +85,30 @@ function ResourceBookingManageCell(props) {





var status = findStatus(props.status)
var watingButton = (
<SettingButtonContainer>
<SettingButton onClick={allowResource}>허가</SettingButton> | <SettingButton onClick={rejectResource}>반려</SettingButton> | <SettingButton onClick={moveToDetail}>상세보기</SettingButton>
<SettingButton onClick={allowResource}>허가</SettingButton> | <SettingButton onClick={rejectResource}>반려</SettingButton> | <SettingButton onClick={moveToDetail}>상세보기</SettingButton>
</SettingButtonContainer>)

var cancelButton = (
<SettingButtonContainer><SettingButton onClick={moveToDetail}>상세보기</SettingButton></SettingButtonContainer>)

var usingButton = (
<SettingButtonContainer>
<SettingButton onClick={returnResource}>반납</SettingButton> | <SettingButton onClick={moveToDetail}>상세보기</SettingButton>
<SettingButton onClick={returnResource}>반납</SettingButton> | <SettingButton onClick={moveToDetail}>상세보기</SettingButton>
</SettingButtonContainer>)



var bookingButton = (
<SettingButtonContainer>
<SettingButton onClick={rejectResource}>반려</SettingButton> | <SettingButton onClick={moveToDetail}>상세보기</SettingButton>
</SettingButtonContainer>
);

return (
<BookedLineTr>
<td width="15%">{props.name}</td>
Expand All @@ -130,12 +122,13 @@ function ResourceBookingManageCell(props) {
</StatusContainer>
</td>
<td width="20%">
{status === WAITING ? watingButton :
status === USING ? usingButton : cancelButton
{status === WAITING ? watingButton :
status === USING ? usingButton :
status === BOOKED ? bookingButton :cancelButton
}
</td>
</BookedLineTr>
)
}

export default ResourceBookingManageCell;
export default ResourceBookingManageCell;
10 changes: 8 additions & 2 deletions src/pages/manager/resourceManage/ResourceManageAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`, {
Expand Down Expand Up @@ -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(``, {
Expand Down

0 comments on commit 2583323

Please sign in to comment.