Skip to content

Commit

Permalink
Merge pull request #153 from PLADI-ALM/feat/PDW-19-equipment
Browse files Browse the repository at this point in the history
[PDW-20/feat] 비품 추가
  • Loading branch information
psyeon1120 authored Nov 30, 2023
2 parents a9ae465 + 6afa11d commit cbd86aa
Show file tree
Hide file tree
Showing 11 changed files with 402 additions and 30 deletions.
3 changes: 3 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import CarManageAdd from "./pages/admin/car/CarManageAdd";
import CarManageDetail from "./pages/admin/car/CarManageDetail";
import OfficeManageAdd from "./pages/admin/office/OfficeManageAdd";
import EquipmentList from "./pages/basic/equipment/EquipmentList";
import EquipmentAdd from "./pages/basic/equipment/EquipmentAdd";

function App() {

Expand Down Expand Up @@ -58,6 +59,8 @@ function App() {
<Route path="/my/bookings/cars" element={<BookedList title="차량 예약 내역" type={"cars"} />} />
<Route path='/my/bookings/cars/:bookingId' element={<CarBookingCheck />} />
<Route path='/equipments' element={<EquipmentList />} />
<Route path='/equipments/add' element={<EquipmentAdd />} />
<Route path='/equipments/:equipmentId/edit' element={<EquipmentAdd />} />
<Route path='/admin/offices' element={<OfficeManage />} />
<Route path='/admin/offices/add' element={<OfficeManageAdd />} />
<Route path='/admin/offices/:officeId/edit' element={<OfficeManageAdd />} />
Expand Down
11 changes: 2 additions & 9 deletions src/components/capsule/DropBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const Select = styled.select`

const ManagerSelect = styled(Select)`
margin-right: 10px;
border: ${props => props.color ? `2px solid ${props.color}` : '1px solid #717171'};
`

const NoBorderSelect = styled(Select)`
Expand Down Expand Up @@ -52,15 +53,7 @@ export function SelectToggleInModal(props) {

export function DropBox(props) {
return (
<Select onChange={props.change} imgUrl={SelectArrow} height={props.height}>
{props.items}
</Select>
);
}

export function ManagerDropBox(props) {
return (
<ManagerSelect onChange={props.change} imgUrl={SelectArrow} height={props.height}>
<ManagerSelect name={props.name} onChange={props.change} imgUrl={SelectArrow} height={props.height} color={props.color}>
{props.items}
</ManagerSelect>
);
Expand Down
2 changes: 0 additions & 2 deletions src/components/card/EquipmentInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ import EmptyImg from "assets/images/EmptyImg.svg"
// 카드 박스
export const Card = styled.div`
height: 350px;
width: calc(33.33% - 15px);
background: white;
border-radius: 8px;
border: 1px solid #E6E6E6;
box-sizing: border-box;
padding: 15px;
margin: 0 0 15px 0;
`

// 상단줄 컨테이너
Expand Down
4 changes: 2 additions & 2 deletions src/components/searchBar/ManageSearchBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import styled from "styled-components";
import SearchInputImage from "../../assets/images/SearchInput.svg"
import SearchButtonImage from "../../assets/images/SearchPlus.svg"
import {ManagerDropBox} from "../capsule/DropBox";
import {DropBox} from "../capsule/DropBox";

const Container = styled.div`
background: none;
Expand Down Expand Up @@ -74,7 +74,7 @@ function ManageSearchBar(props) {
let dropBoxes = [];
if (props.selectOptions !== null)
props.selectOptions.forEach((option, index) =>
dropBoxes.push(<ManagerDropBox height={"40px"} items={option} change={props.onSelectedChange[index]}/>)
dropBoxes.push(<DropBox height={"40px"} items={option} change={props.onSelectedChange[index]}/>)
)
return dropBoxes
}
Expand Down
18 changes: 11 additions & 7 deletions src/pages/admin/car/CarManage.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ function CarManage(props) {
Authorization: getToken()
}
})
.then((Response) => { setCars(Response.data.data.content) })
.catch((error) => {basicError(error)})
.then((Response) => {
setCars(Response.data.data.content)
})
.catch((error) => {
basicError(error)
})
};

const searchCars = (e) => {
Expand All @@ -29,16 +33,16 @@ function CarManage(props) {
getCars("");
}, [])

const moveToAdd = () => {
const moveToAdd = () => {
window.location.href = `/admin/cars/add`
}

return (
<RightContainer>
<RightContainer>
<TitleText>차량 관리</TitleText>
<ManageSearchBar selectOptions={null} buttonTitle="차량 추가" onEnter={searchCars} btnClick={moveToAdd}/>
<WhiteContainer>
<Bar />
<Bar/>
<TableContainer>
<BookedTable>
<BookedThead>
Expand All @@ -52,7 +56,7 @@ function CarManage(props) {
</tr>
</BookedThead>
<tbody>
{ cars.length === 0 ?
{cars.length === 0 ?
<NoLineTr>
<td colSpan={6}>차량 내역이 없습니다.</td>
</NoLineTr>
Expand All @@ -73,7 +77,7 @@ function CarManage(props) {
</BookedTable>
</TableContainer>
</WhiteContainer>
</RightContainer>
</RightContainer>
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/admin/car/CarManageAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function CarManageAdd(props) {
alert("책임자를 선택해주세요.");
return;
}
if (imageFile !== null) { // 이미지 파일 선택했을 때
if (imageFile !== null && !isUpload) { // 이미지 파일 선택했을 때
ImageUrlAxios.get(`?ext=${imageFile.type.split("/", 2)[1]}&dir=car`)
.then((Response) => {
setImgUrl(Response.data);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/admin/office/OfficeManageAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function OfficeManageAdd(props) {
// 이미지 람다 호출
const getImageUrl = () => {
// todo: 검사 다 하기
if (imageFile !== null) { // 이미지 파일 선택했을 때
if (imageFile !== null && !isUpload) { // 이미지 파일 선택했을 때 && 업로드 안했을
ImageUrlAxios.get(`?ext=${imageFile.type.split("/", 2)[1]}&dir=office`)
.then((Response) => {
setImgUrl(Response.data);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/admin/resource/ResourceManageAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function ResourceManageAdd(props) {
alert("책임자를 선택해주세요.");
return;
}
if (imageFile !== null) { // 이미지 파일 선택했을 때
if (imageFile !== null && !isUpload) { // 이미지 파일 선택했을 때
ImageUrlAxios.get(`?ext=${imageFile.type.split("/", 2)[1]}&dir=resource`)
.then((Response) => {
setImgUrl(Response.data);
Expand Down
3 changes: 1 addition & 2 deletions src/pages/admin/user/UserManage.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function UserManage(props) {
const currentAffiliation = useRef("");
const currentDepartment = useRef("");
const currentSearchWord = useRef("");
let departments;

// 유저 목록 조회
const getUserList = (word, affiliation, department) => {
Expand All @@ -51,7 +50,7 @@ function UserManage(props) {
}
})
.then((response) => {
departments = response.data.data.departmentList
let departments = response.data.data.departmentList
if (departmentOptionList.length === 0) {
departmentOptionList.push(<option value="">부서</option>)
departments.map((department) =>
Expand Down
Loading

0 comments on commit cbd86aa

Please sign in to comment.