Skip to content

Commit

Permalink
Merge pull request #118 from PLADI-ALM/feat/PDW-66-activate-office
Browse files Browse the repository at this point in the history
[PDW-66/feat] 관리자 회의실 목록 조회 API 연결
  • Loading branch information
psyeon1120 authored Nov 1, 2023
2 parents ef4cf46 + bcd6a2b commit 6b6196d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 25 deletions.
53 changes: 36 additions & 17 deletions src/pages/booking/selectOffice/SelectOffice.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import React, { useEffect } from "react";
import React, {useEffect} from "react";
import SearchBar from "components/searchBar/SearchBar";
import OfficeInfo from "components/officeInfo/OfficeInfo";
import {RightContainer, WhiteContainer, TitleText, ResourceSearchBar} from "components/rightContainer/RightContainer";
import { OfficesAxios } from "api/AxiosApi";
import { useState } from "react";
import { basicError } from 'utils/ErrorHandlerUtil';
import { SearchDateContainer, SearchDateInput, SearchTextInput, SearchTitleContainer, SearchTitleText} from "../selectResource/SelectResource";
import {OfficesAxios} from "api/AxiosApi";
import {useState} from "react";
import {basicError} from 'utils/ErrorHandlerUtil';
import {
SearchDateContainer,
SearchDateInput,
SearchTextInput,
SearchTitleContainer,
SearchTitleText
} from "../selectResource/SelectResource";
import SearchButtonImg from "../../../assets/images/button/searchButton.png";
import ImageButton from "../../../components/button/ImageButton";
import {SelectToggle} from "../../../components/capsule/SelectToggle";
Expand All @@ -23,13 +29,17 @@ function SelectOffice(props) {
const [endTime, setEndTime] = useState("");

const getOfficeList = () => {
OfficesAxios.get("?size=200", {
OfficesAxios.get("?size=200", {
headers: {
Authorization: getToken()
}
})
.then((Response) => { setOffices(Response.data.data.content) })
.catch((error) => {basicError(error)})
.then((Response) => {
setOffices(Response.data.data.content)
})
.catch((error) => {
basicError(error)
})
};

const changeFacilityName = (e) => {
Expand All @@ -49,9 +59,17 @@ function SelectOffice(props) {
}

const searchOffice = () => {
OfficesAxios.get(`?date=${date}&startTime=${startTime}&endTime=${endTime}&facilityName=${facilityName}`)
.then((Response) => { setOffices(Response.data.data.content) })
.catch((error) => {basicError(error)})
OfficesAxios.get(`?date=${date}&startTime=${startTime}&endTime=${endTime}&facilityName=${facilityName}`, {
headers: {
Authorization: getToken()
}
})
.then((Response) => {
setOffices(Response.data.data.content)
})
.catch((error) => {
basicError(error)
})
}

useEffect(() => {
Expand All @@ -67,18 +85,19 @@ function SelectOffice(props) {
<SearchTitleText>예약 가능 회의실 검색</SearchTitleText>
</SearchTitleContainer>

<SearchTextInput type="text" placeholder="시설 검색" onChange={changeFacilityName} />
<SearchTextInput type="text" placeholder="시설 검색" onChange={changeFacilityName}/>

<SearchDateContainer>
<SearchDateInput type="date" onChange={changeDate} />
<SelectToggle items={timeOptionList} change={changeStart} />~
<SelectToggle items={timeOptionList} change={changeEnd} />
<SearchDateInput type="date" onChange={changeDate}/>
<SelectToggle items={timeOptionList} change={changeStart}/>~
<SelectToggle items={timeOptionList} change={changeEnd}/>
</SearchDateContainer>
<ImageButton image={SearchButtonImg} width={"40px"} height={"40px"} click={searchOffice} />
<ImageButton image={SearchButtonImg} width={"40px"} height={"40px"} click={searchOffice}/>
</ResourceSearchBar>
<WhiteContainer>
<div className="cardList">
{offices.length === 0 ? <label>예약 가능한 회의실이 없습니다.</label> : offices.map((office) => <OfficeInfo key={office.officeId}
{offices.length === 0 ? <label>예약 가능한 회의실이 없습니다.</label> : offices.map((office) => <OfficeInfo
key={office.officeId}
officeId={office.officeId}
name={office.name}
imgUrl={office.imgUrl}
Expand Down
15 changes: 7 additions & 8 deletions src/pages/manager/officeManage/OfficeManage.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import React from "react";
import { useState, useEffect } from "react";
import { RightContainer, TitleText, WhiteContainer } from "components/rightContainer/RightContainer";
import React, {useEffect, useState} from "react";
import {RightContainer, TitleText, WhiteContainer} from "components/rightContainer/RightContainer";
import {Bar, BookedTable, BookedThead, NoLineTr, TableContainer} from "../../booking/bookedList/BookedList";
import OfficeManageTableCell from "./OfficeManageTableCell";
import ManageSearchBar from "components/searchBar/ManageSearchBar";
import { getToken } from "utils/IsLoginUtil";
import { basicError } from "utils/ErrorHandlerUtil";
import { OfficesAxios } from "api/AxiosApi";
import {getToken} from "utils/IsLoginUtil";
import {basicError} from "utils/ErrorHandlerUtil";
import {AdminBookingOfficeAxios} from "api/AxiosApi";

function OfficeManage(props) {

const [offices, setOffices] = useState([]);

const getOffices = (name) => {
const max = Int32Array.max;
OfficesAxios.get(`?keyword=${name}&size=200`,{
AdminBookingOfficeAxios.get(`?facilityName=${name}&size=200`,{
headers: {
Authorization: getToken()
}
Expand All @@ -28,7 +27,7 @@ function OfficeManage(props) {
};

useEffect(() => {
getOffices();
getOffices("");
}, [])

const moveToAdd = () => {
Expand Down

0 comments on commit 6b6196d

Please sign in to comment.