Skip to content

Commit

Permalink
Merge pull request #91 from PLADI-ALM/feat/PDW-37-manager-resource-ad…
Browse files Browse the repository at this point in the history
…d-api

[PDW-37] fix: 자원 예약관리 설정 버튼 크기 감소
  • Loading branch information
psyeon1120 authored Oct 16, 2023
2 parents b4d9daa + 024502f commit d630397
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 43 deletions.
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 d630397

Please sign in to comment.