diff --git a/src/App.js b/src/App.js index 95274be..b308221 100644 --- a/src/App.js +++ b/src/App.js @@ -23,6 +23,7 @@ import CarBookingCheck from "./pages/basic/booking/car/CarBookingCheck"; import CarManage from "./pages/admin/car/CarManage"; import CarBookingManage from "./pages/admin/carBookings/CarBookingManage"; import CarManageAdd from "./pages/admin/car/CarManageAdd"; +import CarManageDetail from "./pages/admin/car/CarManageDetail"; function App() { @@ -62,6 +63,7 @@ function App() { } /> } /> } /> + } /> } /> } /> } /> diff --git a/src/constants/Path.js b/src/constants/Path.js index f061ce8..d4faf57 100644 --- a/src/constants/Path.js +++ b/src/constants/Path.js @@ -12,7 +12,7 @@ import AdminInactiveIcon from 'assets/images/sidebarIcon/AdminInactive.svg' export const BOOKING_MENUS = [ {name: '회의실 예약', path: '/officeBooking'}, {name: '장비 예약', path: '/resourceBooking'}, - {name: '차량 내역', path: '/carBooking'} + {name: '차량 예약', path: '/carBooking'} ] export const MY_BOOKING_MENUS = [ diff --git a/src/pages/admin/car/CarManage.js b/src/pages/admin/car/CarManage.js index 3456188..96a96fc 100644 --- a/src/pages/admin/car/CarManage.js +++ b/src/pages/admin/car/CarManage.js @@ -12,7 +12,7 @@ function CarManage(props) { const [cars, setCars] = useState([]); const getCars = (name) => { - AdminCarsAxios.get(`?keyword=${name}`, { + AdminCarsAxios.get(`?keyword=${name}&size=100`, { headers: { Authorization: getToken() } diff --git a/src/pages/admin/car/CarManageAdd.js b/src/pages/admin/car/CarManageAdd.js index 9c4db63..a958d3d 100644 --- a/src/pages/admin/car/CarManageAdd.js +++ b/src/pages/admin/car/CarManageAdd.js @@ -206,6 +206,7 @@ function CarManageAdd(props) { setIsUpload(false); imageInput.current.value = ""; setImgSrc("") + setImgUrl(null) }; // 이미지 람다 호출 @@ -328,6 +329,7 @@ function CarManageAdd(props) { description: Response.data.data.description }); setImgUrl(Response.data.data.imgUrl); + setImgSrc(Response.data.data.imgUrl); }) .catch((Error) => { basicError(Error) @@ -407,10 +409,10 @@ function CarManageAdd(props) { 첨부사진 - {imageFile !== null && ×} + {imageSrc !== "" && ×} 파일선택 diff --git a/src/pages/admin/car/CarManageDetail.js b/src/pages/admin/car/CarManageDetail.js index 81cd12e..7159f60 100644 --- a/src/pages/admin/car/CarManageDetail.js +++ b/src/pages/admin/car/CarManageDetail.js @@ -1,27 +1,17 @@ import React, {useEffect, useState} from 'react'; -import styled from "styled-components" -import {AdminResourcesAxios, ResourcesAxios} from 'api/AxiosApi'; +import styled from "styled-components"; +import {AdminCarsAxios, CarsAxios} from 'api/AxiosApi'; import {useParams} from 'react-router-dom'; import Capsule from 'components/capsule/Capsule'; import {basicError} from 'utils/ErrorHandlerUtil'; import {Bar} from 'pages/basic/myBookings/BookedList'; import {RightContainer, TitleText, WhiteContainer} from 'components/rightContainer/RightContainer'; -import { - MainTextContainer, - NameSubTitleText, - SubTextContainer, - DetailSubTitleText -} from 'components/officeBooking/SubTitleBar'; +import {DetailSubTitleText, NameSubTitleText} from 'components/officeBooking/SubTitleBar'; import {getToken} from 'utils/IsLoginUtil'; -import MoreButtonIcon from "../../../assets/images/button/triple_dot_icon.svg" -import ResourceDetailInfo from "../../../components/card/ResourceDetailInfo"; -import ImageFullButton from "../../../components/button/ImageFullButton"; +import MoreButtonIcon from "assets/images/button/triple_dot_icon.svg"; +import ResourceDetailInfo from "components/card/ResourceDetailInfo"; +import ImageFullButton from "components/button/ImageFullButton"; -export const MoreButton = styled.button` - border: none; - background-color: #2A3042; - float: right; -` export const OptionsView = styled.div` display: ${props => props.isShowing ? 'table-cell' : 'none'}; width: 85px; @@ -50,7 +40,6 @@ export const InfoTable = styled.table` border-collapse: collapse; border: 1px solid #959494; font-size: 17px; - align: center; ` export const InfoTableData = styled.td` @@ -59,126 +48,126 @@ export const InfoTableData = styled.td` ` function CarManageDetail() { - let {resourceId} = useParams() + let {carId} = useParams() const [isShowingOptions, setOptionViewShowing] = useState(false) - const [resourceInfo, setResourceInfo] = useState([]) + const [carInfo, setCarInfo] = useState([]) const [bookingsInfo, setBookingsInfo] = useState([]) - const getResourceInfo = () => { - ResourcesAxios.get(`/${resourceId}`, { + const getCarInfo = () => { + CarsAxios.get(`/${carId}`, { headers: { Authorization: getToken() } }) .then((Response) => { console.log(Response.data.data) - setResourceInfo(Response.data.data) + setCarInfo(Response.data.data) }) .catch((Error) => { basicError(Error) - console.log(Error) - window.alert("장비 정보를 불러올 수 없습니댜.") + window.alert("차량 정보를 불러올 수 없습니댜.") window.history.back() }) } - const getResourceBookingListInfo = () => { - AdminResourcesAxios.get(`${resourceId}`, { + const getCarBookingListInfo = () => { + AdminCarsAxios.get(`${carId}`, { headers: { Authorization: getToken() } }) .then((Response) => { console.log(Response.data.data) - setBookingsInfo(Response.data.data.resourcesLists) + setBookingsInfo(Response.data.data.productList) }) .catch((Error) => { basicError(Error) - console.log(Error) window.alert("예약 정보를 불러올 수 없습니댜.") window.history.back() }) } - const deleteResource = () => { - if (window.confirm("장비을 삭제하시겠습니까?")) { - AdminResourcesAxios.delete(`${resourceId}`, { + const deleteCar = () => { + if (window.confirm("차량을 삭제하시겠습니까?")) { + AdminCarsAxios.delete(`${carId}`, { headers: { Authorization: getToken() } }) .then((Response) => { if (Response.data.status === 200) { - alert('장비을 성공적으로 삭제하였습니다.') - window.history.back() + alert('차량을 성공적으로 삭제하였습니다.') + window.location.href = `/admin/cars` } }) .catch((Error) => { basicError(Error) - console.log(Error) }) setOptionViewShowing(false) } } useEffect(() => { - getResourceInfo() - getResourceBookingListInfo() + getCarInfo() + getCarBookingListInfo() }, []); - return - 장비 관리 - - - -
- {resourceInfo.name} - {resourceInfo.location} + return ( + + 차량 관리 + + + +
+ {carInfo.name} + {carInfo.location} +
+ { + setOptionViewShowing(!isShowingOptions) + }}/> + + { + window.location.href = `/admin/cars/edit/${carId}` + }}>수정 + 삭제 + +
+ + + +
+
- { - setOptionViewShowing(!isShowingOptions) - }}/> - - { - window.location.href = `/admin/resources/edit/${resourceId}` - }}>수정 - 삭제 - - - - - -
- -
- - - - 요청자 - 예약일자 - 목적 - 상태 - - {bookingsInfo.map(function (info) { - return ( - - {info.reservatorName} ({info.reservatorPhone}) - {info.startDateTime} ~
{info.endDateTime}
- {info.goal} - {info.bookingStatus} - - ) - })} -
- -
-
+ + + + 요청자 + 예약일자 + 목적 + 상태 + + {bookingsInfo.map(function (info) { + return ( + + {info.reservatorName} ({info.reservatorPhone}) + {info.startDateTime} ~
{info.endDateTime} +
+ {info.memo} + {info.bookingStatus} + + ) + })} +
+ + + + ) } export default CarManageDetail; diff --git a/src/pages/admin/resource/ResourceManageDetail.js b/src/pages/admin/resource/ResourceManageDetail.js index 6b1e481..1420e9d 100644 --- a/src/pages/admin/resource/ResourceManageDetail.js +++ b/src/pages/admin/resource/ResourceManageDetail.js @@ -106,12 +106,11 @@ function ResourceManageDetail() { .then((Response) => { if (Response.data.status === 200) { alert('장비을 성공적으로 삭제하였습니다.') - window.history.back() + window.location.href = `/admin/resources` } }) .catch((Error) => { basicError(Error) - console.log(Error) }) setOptionViewShowing(false) }