TicketingSeatPage.js 4.76 KB
Newer Older
Jiwon Yoon's avatar
Jiwon Yoon committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { Link } from 'react-router-dom'
import { useState } from 'react'
import CountButton from '../components/CountButton'
import SeatTable from '../components/SeatTable/SeatTable'

const TicketingSeatPage = ({ location }) => {
    const [ticketInfo, setTicketInfo] = useState({ ...location.state })
    const [selectedSeats, setSelectedSeats] = useState([])
    const [count, setCount] = useState({
        adult: 0,
        teenager: 0,
        elderly: 0
    })
    const allSeat = { row: 6, col: 10 }
    return (
        <div className="container" style={{ color: "white" }}>
            {console.log(ticketInfo)}
            <div className="row justify-content-center my-5">
                <div className="col-sm-4 mb-3 ">
                    <h3 className="py-2 text-white text-center" style={{ border: "3px solid #000000", borderBottom: "3px solid #FEDC00" }}>좌석선택</h3>
                </div>
            </div>
            <div className="row justify-content-center my-3">
                <div className="col-sm-6 mb-4 text-center">
Jiwon Yoon's avatar
Jiwon Yoon committed
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
                    <div className="row">

                    <div className="col-sm-6 text-end">
                        <div className="my-1">일반</div>
                        <div className="my-1">청소년</div>
                        <div className="my-1">경로우대</div>
                    </div>
                    <div className="col-sm-6 text-start">
                        <CountButton name="adult" count={count} setCount={setCount} />
                        <CountButton name="teenager" count={count} setCount={setCount} />
                        <CountButton name="elderly" count={count} setCount={setCount} />
                    </div>
                    </div>
                    {/* <span className="">일반</span>
                    <CountButton name="adult" count={count} setCount={setCount} />

                    <span className="">청소년</span>
                    <CountButton name="teenager" count={count} setCount={setCount} />

                    <span className="">경로우대</span>
                    <CountButton name="elderly" count={count} setCount={setCount} /> */}

Jiwon Yoon's avatar
Jiwon Yoon committed
47
48
                </div>
                <div className="col-sm-6 mb-4 p-2 text-center" style={{ backgroundColor: '#252525' }}>
Jiwon Yoon's avatar
Jiwon Yoon committed
49
                    <div>{ticketInfo.theater} | {ticketInfo.selectedCinemaNum}</div>
Jiwon Yoon's avatar
Jiwon Yoon committed
50
                    <div>{ticketInfo.title}</div>
Jiwon Yoon's avatar
Jiwon Yoon committed
51
                    <div>{ticketInfo.time}</div>
Jiwon Yoon's avatar
Jiwon Yoon committed
52
53
54
55
56
57
58
59
60
61
62
                </div>
            </div>
            <div className="row justify-content-center border p-5 ">
                <div className="col-sm-8">
                    <SeatTable count={count} setSelectedSeats={setSelectedSeats} selectedSeats={selectedSeats} allSeat={allSeat} />
                </div>
                <div className="col-sm-4 mt-5">
                    <p>선택됨</p>
                    <p>선택불가</p>
                </div>
            </div>
Jiwon Yoon's avatar
Jiwon Yoon committed
63
            <div className="row p-3 mt-5" style={{ backgroundColor: "#252525" }}>
Jiwon Yoon's avatar
Jiwon Yoon committed
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
                <div className="col-sm-3 border-end text-center">
                    {ticketInfo
                        ? <img style={{ maxHeight: "10rem" }} src={`https://image.tmdb.org/t/p/original${ticketInfo.poster_path}`} alt="영화포스터" />
                        : <div className="mb-2" style={{ color: "white" }}>영화선택</div>}
                </div>
                <div className="col-sm-6 border-end" style={{ color: "white" }}>
                    <div className="mb-2  text-center">극장선택</div>
                    {ticketInfo
                        ? <ul>
                            <li>영화: {ticketInfo.title}</li>
                            <li>극장: {ticketInfo.theater}</li>
                            <li>일시: 2021/07/21 10:00 </li>
                            <li>상영관: 3</li>
                            <li>좌석: {selectedSeats}</li>
                        </ul>
                        : <div></div>}
                </div>
                <div className="col-sm-3 text-center">
                    <div className="mb-2" style={{ color: "white" }}>결제하기</div>
                    {ticketInfo
                        ?
                        <Link to={{
                            pathname: `/payment`,
Jiwon Yoon's avatar
Jiwon Yoon committed
87
                            state: { ...ticketInfo, selectedSeats: selectedSeats, ...count }
Jiwon Yoon's avatar
Jiwon Yoon committed
88
89
90
91
92
93
94
95
96
97
98
99
100
101
                        }}>
                            <img className="border border-3 rounded-3" src="/images/icons8-arrow-white.png" alt="예매하기" />
                        </Link>
                        :
                        <img className="border border-3 rounded-3" src="/images/icons8-arrow-white.png" alt="예매하기" />

                    }
                </div>
            </div>
        </div>
    )
}

export default TicketingSeatPage