Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
butter-studio
Commits
df7f83d9
Commit
df7f83d9
authored
Jul 27, 2021
by
Kim, Subin
Browse files
Admin - TicketFeeTable
parent
bc24bfb5
Changes
1
Hide whitespace changes
Inline
Side-by-side
client/src/components/Admin/TicketFeeTable.js
View file @
df7f83d9
...
...
@@ -2,7 +2,7 @@ import { useState, useEffect } from "react";
import
cinemaApi
from
"
../../apis/cinema.api.js
"
;
import
catchErrors
from
"
../../utils/catchErrors.js
"
;
const
FeeTable
=
({
editFee
,
setEditFee
})
=>
{
const
Ticket
FeeTable
=
({
setEditFee
})
=>
{
const
[
ticketFee
,
setTicketFee
]
=
useState
([])
const
[
error
,
setError
]
=
useState
(
""
)
...
...
@@ -12,14 +12,14 @@ const FeeTable = ({ editFee, setEditFee }) => {
async
function
getInfo
()
{
const
res
=
await
cinemaApi
.
getTicketFee
()
console
.
log
(
"
res==
"
,
res
)
setTicketFee
(
res
)
}
async
function
editRow
(
theaterType
)
{
try
{
setError
(
""
)
const
res
=
await
cinemaApi
.
getTicketFeeOne
(
theaterType
)
setEditFee
({
...
editFee
,
...
res
})
setEditFee
({
...
res
})
}
catch
(
error
)
{
catchErrors
(
error
,
setError
)
}
...
...
@@ -36,69 +36,79 @@ const FeeTable = ({ editFee, setEditFee }) => {
}
}
function
priceToString
(
price
)
{
return
price
.
toString
().
replace
(
/
\B(?=(\d{3})
+
(?!\d))
/g
,
'
,
'
);
}
return
(
<
table
className
=
"
table caption-top text-center align-middle
"
>
<
caption
className
=
"
text-dark
"
>
영화관람료
안내
<
/caption
>
<
thead
className
=
"
table-dark
"
>
<
tr
>
<
th
>
상영관
종류
<
/th
>
<
th
>
주중
/
주말
<
/th
>
<
th
>
시간대
<
/th
>
<
th
>
청소년
<
/th
>
<
th
>
일반
<
/th
>
<
th
>
경로
<
/th
>
<
th
><
/th
>
<
/tr
>
<
/thead
>
<
tbody
>
<
tr
>
<
td
rowSpan
=
"
6
"
>
일반석
2
D
<
/td
>
<
td
rowSpan
=
"
3
"
>
주중
(
월
~
목
)
<
/td
>
<
td
>
조조
(
06
:
00
~
)
<
/td
>
<
td
>
6
,
000
원
<
/td
>
<
td
>
8
,
000
원
<
/td
>
<
td
>
6
,
000
원
<
/td
>
<
td
rowSpan
=
"
6
"
>
<
div
className
=
"
d-flex flex-column
"
>
<
button
type
=
"
button
"
className
=
"
btn btn-primary my-1
"
onClick
=
{()
=>
editRow
(
"
일반석 2D
"
)}
>
수정
<
/button
>
<
button
type
=
"
button
"
className
=
"
btn btn-danger my-1
"
onClick
=
{()
=>
deleteData
(
"
일반석 2D
"
)}
>
삭제
<
/button
>
<
/div
>
<
/td
>
<
/tr
>
<
tr
>
<
td
>
일반
(
11
:
00
~
)
<
/td
>
<
td
>
9
,
000
원
<
/td
>
<
td
>
12
,
000
원
<
/td
>
<
td
>
9
,
000
원
<
/td
>
<
/tr
>
<
tr
>
<
td
>
심야
(
00
:
00
~
)
<
/td
>
<
td
>
5
,
000
원
<
/td
>
<
td
>
7
,
000
원
<
/td
>
<
td
>
5
,
000
원
<
/td
>
<
/tr
>
<
tr
>
<
td
rowSpan
=
"
3
"
>
주말
(
금
~
일
)
및
공휴일
<
/td
>
<
td
>
조조
(
06
:
00
~
)
<
/td
>
<
td
>
6
,
000
원
<
/td
>
<
td
>
9
,
000
원
<
/td
>
<
td
>
6
,
000
원
<
/td
>
<
/tr
>
<
tr
>
<
td
>
일반
(
11
:
00
~
)
<
/td
>
<
td
>
10
,
000
원
<
/td
>
<
td
>
13
,
000
원
<
/td
>
<
td
>
10
,
000
원
<
/td
>
<
/tr
>
<
tr
>
<
td
>
심야
(
00
:
00
~
)
<
/td
>
<
td
>
5
,
000
원
<
/td
>
<
td
>
7
,
000
원
<
/td
>
<
td
>
5
,
000
원
<
/td
>
<
/tr
>
<
/tbody
>
<
/table
>
<
table
className
=
"
table caption-top text-center align-middle
"
>
<
caption
className
=
"
text-dark
"
>
영화관람료
안내
<
/caption
>
<
thead
className
=
"
table-dark
"
>
<
tr
>
<
th
>
상영관
종류
<
/th
>
<
th
>
주중
/
주말
<
/th
>
<
th
>
시간대
<
/th
>
<
th
>
청소년
<
/th
>
<
th
>
일반
<
/th
>
<
th
>
경로
<
/th
>
<
th
><
/th
>
<
/tr
>
<
/thead
>
<
tbody
>
{
ticketFee
.
length
!==
0
?
ticketFee
.
map
(
info
=>
<>
<
tr
>
<
td
rowSpan
=
"
6
"
>
{
info
.
theaterType
}
<
/td
>
<
td
rowSpan
=
"
3
"
>
주중
(
월
~
목
)
<
/td
>
<
td
>
조조
(
06
:
00
~
)
<
/td
>
<
td
>
{
priceToString
(
info
.
weekdays
+
info
.
morning
+
info
.
youth
+
info
.
defaultPrice
)}
원
<
/td
>
<
td
>
{
priceToString
(
info
.
weekdays
+
info
.
morning
+
info
.
adult
+
info
.
defaultPrice
)}
원
<
/td
>
<
td
>
{
priceToString
(
info
.
weekdays
+
info
.
morning
+
info
.
senior
+
info
.
defaultPrice
)}
원
<
/td
>
<
td
rowSpan
=
"
6
"
>
<
div
className
=
"
d-flex flex-column
"
>
<
button
type
=
"
button
"
className
=
"
btn btn-primary my-1
"
onClick
=
{()
=>
editRow
(
info
.
theaterType
)}
>
수정
<
/button
>
<
button
type
=
"
button
"
className
=
"
btn btn-danger my-1
"
onClick
=
{()
=>
deleteData
(
info
.
theaterType
)}
>
삭제
<
/button
>
<
/div
>
<
/td
>
<
/tr
>
<
tr
>
<
td
>
일반
(
11
:
00
~
)
<
/td
>
<
td
>
{
priceToString
(
info
.
weekdays
+
info
.
day
+
info
.
youth
+
info
.
defaultPrice
)}
원
<
/td
>
<
td
>
{
priceToString
(
info
.
weekdays
+
info
.
day
+
info
.
adult
+
info
.
defaultPrice
)}
원
<
/td
>
<
td
>
{
priceToString
(
info
.
weekdays
+
info
.
day
+
info
.
senior
+
info
.
defaultPrice
)}
원
<
/td
>
<
/tr
>
<
tr
>
<
td
>
심야
(
00
:
00
~
)
<
/td
>
<
td
>
{
priceToString
(
info
.
weekdays
+
info
.
night
+
info
.
youth
+
info
.
defaultPrice
)}
원
<
/td
>
<
td
>
{
priceToString
(
info
.
weekdays
+
info
.
night
+
info
.
adult
+
info
.
defaultPrice
)}
원
<
/td
>
<
td
>
{
priceToString
(
info
.
weekdays
+
info
.
night
+
info
.
senior
+
info
.
defaultPrice
)}
원
<
/td
>
<
/tr
>
<
tr
>
<
td
rowSpan
=
"
3
"
>
주말
(
금
~
일
)
및
공휴일
<
/td
>
<
td
>
조조
(
06
:
00
~
)
<
/td
>
<
td
>
{
priceToString
(
info
.
weekend
+
info
.
morning
+
info
.
youth
+
info
.
defaultPrice
)}
원
<
/td
>
<
td
>
{
priceToString
(
info
.
weekend
+
info
.
morning
+
info
.
adult
+
info
.
defaultPrice
)}
원
<
/td
>
<
td
>
{
priceToString
(
info
.
weekend
+
info
.
morning
+
info
.
senior
+
info
.
defaultPrice
)}
원
<
/td
>
<
/tr
>
<
tr
>
<
td
>
일반
(
11
:
00
~
)
<
/td
>
<
td
>
{
priceToString
(
info
.
weekend
+
info
.
day
+
info
.
youth
+
info
.
defaultPrice
)}
원
<
/td
>
<
td
>
{
priceToString
(
info
.
weekend
+
info
.
day
+
info
.
adult
+
info
.
defaultPrice
)}
원
<
/td
>
<
td
>
{
priceToString
(
info
.
weekend
+
info
.
day
+
info
.
senior
+
info
.
defaultPrice
)}
원
<
/td
>
<
/tr
>
<
tr
>
<
td
>
심야
(
00
:
00
~
)
<
/td
>
<
td
>
{
priceToString
(
info
.
weekend
+
info
.
night
+
info
.
youth
+
info
.
defaultPrice
)}
원
<
/td
>
<
td
>
{
priceToString
(
info
.
weekend
+
info
.
night
+
info
.
adult
+
info
.
defaultPrice
)}
원
<
/td
>
<
td
>
{
priceToString
(
info
.
weekend
+
info
.
night
+
info
.
senior
+
info
.
defaultPrice
)}
원
<
/td
>
<
/tr
>
<
/>
)
:
<
tr
>
<
td
colSpan
=
"
7
"
>
등록된
관람료
관련
정보가
없습니다
.
<
/td
>
<
/tr>
}
<
/tbody
>
<
/table
>
)
}
export
default
FeeTable
\ No newline at end of file
export
default
TicketFeeTable
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment