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
7262e03c
Commit
7262e03c
authored
Jul 26, 2021
by
Kim, Subin
Browse files
영화관람표 관련 컴포넌트 추가
parent
6493078a
Changes
1
Hide whitespace changes
Inline
Side-by-side
client/src/components/Admin/CinemaEdit.js
View file @
7262e03c
import
{
useState
,
useEffect
}
from
"
react
"
;
import
{
useState
,
useEffect
}
from
"
react
"
;
import
TicketEditForm
from
"
./TicketEditForm.js
"
;
import
TicketFeeTable
from
"
./TicketFeeTable.js
"
;
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
styles
from
"
./admin.module.scss
"
;
import
styles
from
"
./admin.module.scss
"
;
const
INIT_CINEMAINFO
=
{
const
INIT_CINEMAINFO
=
{
cinemaName
:
""
,
cinemaName
:
""
,
transportation
:
""
,
transportation
:
""
,
parking
:
""
,
parking
:
""
,
address
:
""
address
:
""
,
moreFeeInfo
:
""
}
}
const
CinemaEdit
=
()
=>
{
const
CinemaEdit
=
()
=>
{
const
[
cinemaInfo
,
setCinemaInfo
]
=
useState
(
INIT_CINEMAINFO
)
const
[
cinemaInfo
,
setCinemaInfo
]
=
useState
(
INIT_CINEMAINFO
)
const
[
ticketFee
,
setTicketFee
]
=
useState
({})
const
[
error
,
setError
]
=
useState
(
""
)
const
[
error
,
setError
]
=
useState
(
""
)
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -26,7 +30,7 @@ const CinemaEdit = () => {
...
@@ -26,7 +30,7 @@ const CinemaEdit = () => {
async
function
getInfo
()
{
async
function
getInfo
()
{
try
{
try
{
setError
(
""
)
setError
(
""
)
const
info
=
await
cinemaApi
.
getInfo
()
const
info
=
await
cinemaApi
.
get
Cinema
Info
()
if
(
info
)
setCinemaInfo
(
info
)
if
(
info
)
setCinemaInfo
(
info
)
else
setCinemaInfo
(
INIT_CINEMAINFO
)
else
setCinemaInfo
(
INIT_CINEMAINFO
)
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -37,7 +41,7 @@ const CinemaEdit = () => {
...
@@ -37,7 +41,7 @@ const CinemaEdit = () => {
async
function
handleSubmit
()
{
async
function
handleSubmit
()
{
try
{
try
{
setError
(
""
)
setError
(
""
)
await
cinemaApi
.
edit
(
cinemaInfo
)
await
cinemaApi
.
edit
Cinema
(
cinemaInfo
)
window
.
location
.
reload
()
window
.
location
.
reload
()
}
catch
(
error
)
{
}
catch
(
error
)
{
catchErrors
(
error
,
setError
)
catchErrors
(
error
,
setError
)
...
@@ -65,6 +69,14 @@ const CinemaEdit = () => {
...
@@ -65,6 +69,14 @@ const CinemaEdit = () => {
<
span
className
=
"
input-group-text
"
id
=
"
address
"
><
i
className
=
"
bi bi-geo-alt-fill
"
><
/i></
span
>
<
span
className
=
"
input-group-text
"
id
=
"
address
"
><
i
className
=
"
bi bi-geo-alt-fill
"
><
/i></
span
>
<
input
type
=
"
text
"
className
=
{
`form-control
${
styles
.
shadowNone
}
`
}
id
=
"
address
"
name
=
"
address
"
value
=
{
cinemaInfo
.
address
}
onChange
=
{
handleChange
}
value
=
{
cinemaInfo
.
address
}
/
>
<
input
type
=
"
text
"
className
=
{
`form-control
${
styles
.
shadowNone
}
`
}
id
=
"
address
"
name
=
"
address
"
value
=
{
cinemaInfo
.
address
}
onChange
=
{
handleChange
}
value
=
{
cinemaInfo
.
address
}
/
>
<
/div
>
<
/div
>
<
p
className
=
"
mb-0
"
>
영화관람료
설정
<
/p
>
<
p
className
=
"
text-danger
"
>*
추가금액
정보를
입력바랍니다
.
필요에
따라
기본가격
또한
변경
가능합니다
.
<
/p
>
<
TicketEditForm
editFee
=
{
ticketFee
}
/
>
<
TicketFeeTable
editFee
=
{
ticketFee
}
setEditFee
=
{
setTicketFee
}
/
>
<
div
className
=
"
mb-3
"
>
<
label
for
=
"
moreFeeInfo
"
className
=
"
form-label
"
>
관람료
추가정보
<
/label
>
<
textarea
className
=
{
`form-control
${
styles
.
shadowNone
}
${
styles
.
textarea
}
`
}
rows
=
"
7
"
id
=
"
moreFeeInfo
"
name
=
"
moreFeeInfo
"
value
=
{
cinemaInfo
.
moreFeeInfo
}
onChange
=
{
handleChange
}
><
/textarea
>
<
/div
>
<
div
className
=
"
d-grid gap-2 mb-5
"
>
<
div
className
=
"
d-grid gap-2 mb-5
"
>
<
button
type
=
"
submit
"
className
=
{
`btn btn-dark shadow-none
${
styles
.
customBtn
}
`
}
onClick
=
{
handleSubmit
}
>
수정
<
/button
>
<
button
type
=
"
submit
"
className
=
{
`btn btn-dark shadow-none
${
styles
.
customBtn
}
`
}
onClick
=
{
handleSubmit
}
>
수정
<
/button
>
<
/div
>
<
/div
>
...
...
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