Skip to content

Commit

Permalink
Merge pull request #116 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 Oct 31, 2023
2 parents c1e8b90 + a692647 commit 8efde90
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
10 changes: 6 additions & 4 deletions src/pages/manager/officeManage/OfficeManage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { useState, useEffect } from "react";
import { RightContainer, TitleText, WhiteContainer } from "components/rightContainer/RightContainer";
import { Bar, BookedTable, BookedThead, TableContainer } from "../../booking/bookedList/BookedList";
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";
Expand Down Expand Up @@ -49,22 +49,24 @@ function OfficeManage(props) {
<tr>
<th width="20%">회의실명</th>
<th width="20%">위치</th>
<th width="20%">수용인원</th>
<th width="10%">수용인원</th>
<th width="40%">설명</th>
<th width="10%"></th>
</tr>
</BookedThead>
<tbody>
{ offices.length === 0 ?
<OfficeManageTableCell>
<NoLineTr>
<td colSpan={5}>회의실 내역이 없습니다.</td>
</OfficeManageTableCell>
</NoLineTr>
: offices.map((office) =>
<OfficeManageTableCell
id={office.officeId}
name={office.name}
location={office.location}
capacity={office.capacity}
description={office.description}
isEnable={office.isActive}
/>
)}
</tbody>
Expand Down
25 changes: 19 additions & 6 deletions src/pages/manager/officeManage/OfficeManageTableCell.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { BookedLineTr } from '../../booking/bookedList/BookedList';



import {Link} from 'react-router-dom';
import {BookedLineTr} from '../../booking/bookedList/BookedList';
import {Toggle} from "../../../components/toggle/Toggle";
import {AdminBookingOfficeAxios} from "../../../api/AxiosApi";
import {getToken} from "../../../utils/IsLoginUtil";
import {basicError} from "../../../utils/ErrorHandlerUtil";

function OfficeManageTableCell(props) {

const changeToggle = (isEnable) => {
AdminBookingOfficeAxios.patch(`/${props.id}/activation`, null, {
headers: {
Authorization: getToken()
}
})
.then((Response) => { })
.catch((error) => {basicError(error)})
console.log(isEnable)
}

return (
<BookedLineTr>
<td width="20%"><Link to={`/manage/offices/${props.id}`}>{props.name}</Link></td>
<td width="20%">{props.location}</td>
<td width="20%">{props.capacity}</td>
<td width="10%">{props.capacity}</td>
<td width="40%">{props.description}</td>
<td width="10%"><Toggle click={changeToggle} isEnable={props.isEnable}/></td>
</BookedLineTr>
)
}
Expand Down

0 comments on commit 8efde90

Please sign in to comment.