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 = ({ selectTheater, setEditFee, formRef }) => { const [ticketFee, setTicketFee] = useState([]) const [error, setError] = useState("") useEffect(() => { if (selectTheater !== 0) getOne(selectTheater) }, [selectTheater]) async function getOne(theatertypeId) { try { setError("") const res = await cinemaApi.getTicketFeeOne(theatertypeId) setTicketFee([res]) } catch (error) { catchErrors(error, setError) } } async function editRow(theatertypeId) { try { setError("") const res = await cinemaApi.getTicketFeeOne(theatertypeId) setEditFee({ ...res }) formRef?.current.scrollIntoView({ behavior: "smooth", block: "center" }) } catch (error) { catchErrors(error, setError) } } async function deleteData(theatertypeId) { try { setError("") await cinemaApi.removeTicketFee(theatertypeId) alert("해당 관람료 정보를 성공적으로 삭제했습니다.") window.location.reload() } catch (error) { catchErrors(error, setError) } } function priceToString(price) { return price.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); } return (
상영관 종류 | 주중 / 주말 | 시간대 | 청소년 | 일반 | 경로 | |
---|---|---|---|---|---|---|
{info.theatertype.theaterTypeName} | 주중(월~목) | 조조 (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)}원 |
|
||
상단의 상영관을 선택해주십시오. |