import { useState, useEffect } from "react"; import cinemaApi from "../../apis/cinema.api.js"; import catchErrors from "../../utils/catchErrors.js"; import styles from "./admin.module.scss"; const TicketFeeTable = ({ setEditFee, formRef }) => { const [ticketFee, setTicketFee] = useState([]) const [error, setError] = useState("") useEffect(() => { getInfo() }, []) async function getInfo() { const res = await cinemaApi.getTicketFee() setTicketFee(res) } async function editRow(theaterType) { try { setError("") const res = await cinemaApi.getTicketFeeOne(theaterType) setEditFee({ ...res }) formRef?.current.scrollIntoView({ behavior: "smooth", block: "center" }) } catch (error) { catchErrors(error, setError) } } async function deleteData(theaterType) { try { setError("") await cinemaApi.removeTicketFee(theaterType) alert("해당 관람료 정보를 성공적으로 삭제했습니다.") getInfo() } catch (error) { catchErrors(error, setError) } } function priceToString(price) { return price.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); } return ( {ticketFee.length !== 0 ? ticketFee.map(info => <> ) : }
영화관람료 안내
상영관 종류 주중 / 주말 시간대 청소년 일반 경로
{info.theaterType} 주중(월~목) 조조 (06:00 ~ ) {priceToString(info.weekdays + info.morning + info.youth + info.defaultPrice)}원 {priceToString(info.weekdays + info.morning + info.adult + info.defaultPrice)}원 {priceToString(info.weekdays + info.morning + info.senior + info.defaultPrice)}원
일반 (11:00 ~ ) {priceToString(info.weekdays + info.day + info.youth + info.defaultPrice)}원 {priceToString(info.weekdays + info.day + info.adult + info.defaultPrice)}원 {priceToString(info.weekdays + info.day + info.senior + info.defaultPrice)}원
심야 (00:00 ~ ) {priceToString(info.weekdays + info.night + info.youth + info.defaultPrice)}원 {priceToString(info.weekdays + info.night + info.adult + info.defaultPrice)}원 {priceToString(info.weekdays + info.night + info.senior + info.defaultPrice)}원
주말(금~일) 및 공휴일 조조 (06:00 ~ ) {priceToString(info.weekend + info.morning + info.youth + info.defaultPrice)}원 {priceToString(info.weekend + info.morning + info.adult + info.defaultPrice)}원 {priceToString(info.weekend + info.morning + info.senior + info.defaultPrice)}원
일반 (11:00 ~ ) {priceToString(info.weekend + info.day + info.youth + info.defaultPrice)}원 {priceToString(info.weekend + info.day + info.adult + info.defaultPrice)}원 {priceToString(info.weekend + info.day + info.senior + info.defaultPrice)}원
심야 (00:00 ~ ) {priceToString(info.weekend + info.night + info.youth + info.defaultPrice)}원 {priceToString(info.weekend + info.night + info.adult + info.defaultPrice)}원 {priceToString(info.weekend + info.night + info.senior + info.defaultPrice)}원
등록된 관람료 관련 정보가 없습니다.
) } export default TicketFeeTable