Commit 87c679ef authored by Jiwon Yoon's avatar Jiwon Yoon
Browse files

Merge branch 'kimpen'

parents 30a418f0 195d1f5f
...@@ -55,6 +55,7 @@ const CinemaEdit = () => { ...@@ -55,6 +55,7 @@ const CinemaEdit = () => {
async function getTicketFeeInfo() { async function getTicketFeeInfo() {
try { try {
setError("")
const res = await theaterApi.getTheaterType() const res = await theaterApi.getTheaterType()
setTheaterTypeList(res) setTheaterTypeList(res)
} catch (error) { } catch (error) {
......
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import { useHistory } from "react-router-dom";
import cinemaApi from "../../apis/cinema.api.js"; import cinemaApi from "../../apis/cinema.api.js";
import catchErrors from "../../utils/catchErrors.js"; import catchErrors from "../../utils/catchErrors.js";
import { useAuth } from '../../context/auth_context';
import styles from "./admin.module.scss"; import styles from "./admin.module.scss";
const TicketFeeTable = ({ selectTheater, setEditFee, formRef }) => { const TicketFeeTable = ({ selectTheater, setEditFee, formRef }) => {
const [ticketFee, setTicketFee] = useState([]) const [ticketFee, setTicketFee] = useState([])
const [error, setError] = useState("") const [error, setError] = useState("")
const { user } = useAuth() const history = useHistory()
useEffect(() => { useEffect(() => {
if (selectTheater !== 0) getOne(selectTheater) if (selectTheater !== 0) getOne(selectTheater)
...@@ -51,7 +50,7 @@ const TicketFeeTable = ({ selectTheater, setEditFee, formRef }) => { ...@@ -51,7 +50,7 @@ const TicketFeeTable = ({ selectTheater, setEditFee, formRef }) => {
} }
return ( return (
<table className={`table text-center align-middle ${styles.tableForm}`} style={{ color: user.role === "admin" ? "" : "white" }}> <table className={`table text-center align-middle ${styles.tableForm}`} style={{ color: (/admin/g.test(history.location.pathname)) ? "" : "white" }}>
<thead className={`table-dark align-middle ${styles.dNone}`}> <thead className={`table-dark align-middle ${styles.dNone}`}>
<tr> <tr>
<th className={styles.word}>상영관 종류</th> <th className={styles.word}>상영관 종류</th>
...@@ -60,7 +59,7 @@ const TicketFeeTable = ({ selectTheater, setEditFee, formRef }) => { ...@@ -60,7 +59,7 @@ const TicketFeeTable = ({ selectTheater, setEditFee, formRef }) => {
<th>청소년</th> <th>청소년</th>
<th>일반</th> <th>일반</th>
<th>경로</th> <th>경로</th>
{user.role === "admin" ? <th style={{ width: "14%" }}></th> : <></>} {(/admin/g.test(history.location.pathname)) ? <th style={{ width: "14%" }}></th> : <></>}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
...@@ -73,7 +72,7 @@ const TicketFeeTable = ({ selectTheater, setEditFee, formRef }) => { ...@@ -73,7 +72,7 @@ const TicketFeeTable = ({ selectTheater, setEditFee, formRef }) => {
<td className="d-inline-block d-md-table-cell">{priceToString(info.weekdays + info.morning + info.youth + info.defaultPrice)}</td> <td className="d-inline-block d-md-table-cell">{priceToString(info.weekdays + info.morning + info.youth + info.defaultPrice)}</td>
<td className="d-inline-block d-md-table-cell">{priceToString(info.weekdays + info.morning + info.adult + info.defaultPrice)}</td> <td className="d-inline-block d-md-table-cell">{priceToString(info.weekdays + info.morning + info.adult + info.defaultPrice)}</td>
<td className="d-inline-block d-md-table-cell">{priceToString(info.weekdays + info.morning + info.senior + info.defaultPrice)}</td> <td className="d-inline-block d-md-table-cell">{priceToString(info.weekdays + info.morning + info.senior + info.defaultPrice)}</td>
{user.role === "admin" {(/admin/g.test(history.location.pathname))
? ?
<td rowSpan="6" className="d-none d-md-table-cell"> <td rowSpan="6" className="d-none d-md-table-cell">
<div className="d-flex flex-column"> <div className="d-flex flex-column">
...@@ -113,7 +112,7 @@ const TicketFeeTable = ({ selectTheater, setEditFee, formRef }) => { ...@@ -113,7 +112,7 @@ const TicketFeeTable = ({ selectTheater, setEditFee, formRef }) => {
<td className="d-inline-block d-md-table-cell">{priceToString(info.weekend + info.night + info.youth + info.defaultPrice)}</td> <td className="d-inline-block d-md-table-cell">{priceToString(info.weekend + info.night + info.youth + info.defaultPrice)}</td>
<td className="d-inline-block d-md-table-cell">{priceToString(info.weekend + info.night + info.adult + info.defaultPrice)}</td> <td className="d-inline-block d-md-table-cell">{priceToString(info.weekend + info.night + info.adult + info.defaultPrice)}</td>
<td className="d-inline-block d-md-table-cell">{priceToString(info.weekend + info.night + info.senior + info.defaultPrice)}</td> <td className="d-inline-block d-md-table-cell">{priceToString(info.weekend + info.night + info.senior + info.defaultPrice)}</td>
{user.role === "admin" {(/admin/g.test(history.location.pathname))
? ?
<td className={`d-block d-md-none ${styles.borderTop}`}> <td className={`d-block d-md-none ${styles.borderTop}`}>
<div className="d-flex justify-content-end"> <div className="d-flex justify-content-end">
......
...@@ -26,7 +26,7 @@ const Calender = ({ selectDate, setSelectDate }) => { ...@@ -26,7 +26,7 @@ const Calender = ({ selectDate, setSelectDate }) => {
{current.isSame(oneDay) || current.format("DD") === "01" ? <strong className={styles.yearmonth}>{current.format('YYYY.MM')}</strong> : ""} {current.isSame(oneDay) || current.format("DD") === "01" ? <strong className={styles.yearmonth}>{current.format('YYYY.MM')}</strong> : ""}
<div className={`d-flex flex-column ${styles.cursor} ` + ((current.format("d") === "0" || current.format("d") === "6") ? ((current.format("d") === "0") ? "text-danger" : "text-primary") : "")}> <div className={`d-flex flex-column ${styles.cursor} ` + ((current.format("d") === "0" || current.format("d") === "6") ? ((current.format("d") === "0") ? "text-danger" : "text-primary") : "")}>
<strong className={current.isSame(oneDay) ? (/admin/g.test(history.location.pathname) ? styles.selectDate : styles.selectatHome) : ""}>{current.format('DD')}</strong> <strong className={current.isSame(oneDay) ? (/admin/g.test(history.location.pathname) ? styles.selectDate : styles.selectatHome) : ""}>{current.format('DD')}</strong>
<strong>{current.isSame(oneDay) ? "오늘" : week[Number(current.format("d"))]}</strong> <strong>{current.isSame(moment().format('YYYY-MM-DD')) ? "오늘" : week[Number(current.format("d"))]}</strong>
</div> </div>
</div> </div>
}) })
...@@ -46,7 +46,7 @@ const Calender = ({ selectDate, setSelectDate }) => { ...@@ -46,7 +46,7 @@ const Calender = ({ selectDate, setSelectDate }) => {
{moment(el.date).isSame(oneDay) || el.date.split('-')[2] === "01" ? <strong className={styles.yearmonth}>{moment(el.date).format('YYYY.MM')}</strong> : ""} {moment(el.date).isSame(oneDay) || el.date.split('-')[2] === "01" ? <strong className={styles.yearmonth}>{moment(el.date).format('YYYY.MM')}</strong> : ""}
<div className={`d-flex flex-column ${styles.cursor} ` + ((Number(el.day) === 0 || Number(el.day) === 6) ? ((Number(el.day) === 0) ? "text-danger" : "text-primary") : "")}> <div className={`d-flex flex-column ${styles.cursor} ` + ((Number(el.day) === 0 || Number(el.day) === 6) ? ((Number(el.day) === 0) ? "text-danger" : "text-primary") : "")}>
<strong className={moment(el.date).isSame(oneDay) ? (/admin/g.test(history.location.pathname) ? styles.selectDate : styles.selectatHome) : ""}>{moment(el.date).format('DD')}</strong> <strong className={moment(el.date).isSame(oneDay) ? (/admin/g.test(history.location.pathname) ? styles.selectDate : styles.selectatHome) : ""}>{moment(el.date).format('DD')}</strong>
<strong>{moment(el.date).isSame(oneDay) ? "오늘" : week[el.day]}</strong> <strong>{moment(el.date).isSame(moment().format('YYYY-MM-DD')) ? "오늘" : week[el.day]}</strong>
</div> </div>
</div>) </div>)
setDateList(resultArr) setDateList(resultArr)
......
import { useState } from 'react' import { useState, useEffect } from 'react'
import TicketFeeTable from '../components/Admin/TicketFeeTable' import TicketFeeTable from '../components/Admin/TicketFeeTable'
import TheaterInfo from '../components/TheaterInfo' import TheaterInfo from '../components/TheaterInfo'
import theaterApi from '../apis/theater.api.js'
import catchErrors from "../utils/catchErrors.js";
const TheaterPage = () => { const TheaterPage = () => {
const [theaterTypeList, setTheaterTypeList] = useState([])
const [state, setState] = useState(0) const [state, setState] = useState(0)
const [selectTheater, setSelectTheater] = useState(0)
const [error, setError] = useState("")
useEffect(() => {
getTicketFeeInfo()
}, [])
async function getTicketFeeInfo() {
try {
setError("")
const res = await theaterApi.getTheaterType()
setTheaterTypeList(res)
} catch (error) {
catchErrors(error, setError)
}
}
return ( return (
<div> <div>
...@@ -28,9 +47,15 @@ const TheaterPage = () => { ...@@ -28,9 +47,15 @@ const TheaterPage = () => {
<div className="pb-5">상영시간표</div> <div className="pb-5">상영시간표</div>
</div> </div>
<div className="tab-pane fade" id="review" role="tabpanel" aria-labelledby="review-tab"> <div className="tab-pane fade" id="review" role="tabpanel" aria-labelledby="review-tab">
<div className="row justify-content-center"> <div className="d-flex justify-content-center">
<div className="col-sm-9 pb-5"> <div className="col-sm-9 pb-5">
<TicketFeeTable /> <nav aria-label="breadcrumb">
<ol className={"breadcrumb" + (theaterTypeList.length === 0 ? " d-flex justify-content-center" : "")}>
{theaterTypeList.length !== 0 ? theaterTypeList.map(theater => <li className="breadcrumb-item" key={theater.id} onClick={() => setSelectTheater(theater.id)} style={{ cursor: "pointer" }}>{theater.theaterTypeName}</li>)
: <li>등록된 관람료 관련 정보가 없습니다.</li>}
</ol>
</nav>
<TicketFeeTable selectTheater={selectTheater} />
</div> </div>
</div> </div>
</div> </div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment