Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
Zasedání CF
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Zasedání CF
Commits
4c268306
Commit
4c268306
authored
Mar 22, 2023
by
Marek Förster
Browse files
Options
Downloads
Patches
Plain Diff
Sloty na obedy v registraci
parent
2e4e5b26
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#11958
passed
Mar 22, 2023
Stage: build
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/RegistrationForm.js
+27
-0
27 additions, 0 deletions
src/components/RegistrationForm.js
src/pages/Registration.js
+11
-3
11 additions, 3 deletions
src/pages/Registration.js
with
38 additions
and
3 deletions
src/components/RegistrationForm.js
+
27
−
0
View file @
4c268306
...
...
@@ -10,11 +10,13 @@ const RegistrationForm = ({
fixedEmail
,
showOrganization
,
showQuestions
,
showProducts
,
showLunch
,
showPrintouts
,
showParties
,
showDonation
,
questions
,
products
,
onSubmit
,
className
,
})
=>
{
...
...
@@ -148,6 +150,31 @@ const RegistrationForm = ({
<
/div
>
)}
{
showProducts
&&
(
<
div
className
=
"
form-field col-span-4
"
>
<
label
className
=
"
form-field__label
"
htmlFor
=
"
field
"
>
{
products
[
3
].
name
}
({
products
[
3
].
price
}
Kč
)
<
/label
>
<
div
className
=
"
form-field__wrapper form-field__wrapper--shadowed
"
>
<
div
className
=
"
select
"
>
<
select
className
=
"
select__control form-field__control col-span-4
"
defaultValue
=
""
{...
register
(
"
product__99
"
)}
>
<
option
value
=
""
>
nepotřebuji
<
/option>
{
products
[
3
].
variations
.
map
((
product
)
=>
(
<
option
value
=
{
product
.
id
}
style
=
{{
display
:
product
.
quotes
.
available
===
0
?
'
none
'
:
'
block
'
}}
>
{
product
.
value
}
[
volných
{
product
.
quotes
.
available
}
ze
{
product
.
quotes
.
total
}]
<
/option
>
))}
<
/select
>
<
/div>
<
/div>
<
/div
>
)}
{
showLunch
&&
(
<
div
className
=
"
form-field col-span-4
"
>
<
label
className
=
"
form-field__label
"
htmlFor
=
"
field
"
>
...
...
This diff is collapsed.
Click to expand it.
src/pages/Registration.js
+
11
−
3
View file @
4c268306
...
...
@@ -29,6 +29,7 @@ const resolveAudience = (keycloak) => {
const
Registration
=
()
=>
{
const
{
keycloak
}
=
useKeycloak
();
const
[
questions
,
setQuestions
]
=
useState
();
const
[
products
,
setProducts
]
=
useState
();
const
[
audience
,
setAudience
]
=
useState
(
resolveAudience
(
keycloak
));
const
[
formData
,
setFormData
]
=
useState
();
const
[
submitted
,
setSubmitted
]
=
useState
(
false
);
...
...
@@ -37,7 +38,7 @@ const Registration = () => {
const
[
submitDuplicity
,
setSubmitDuplicity
]
=
useState
(
false
);
const
[
registrationFormRenderKey
,
setRegistrationFormRenderKey
]
=
useState
(
0
);
const
[
response
,
setResponse
]
=
useState
(
""
);
const
[
responseTotal
,
setResponseTotal
]
=
useState
(
0
);
//
const [responseTotal, setResponseTotal] = useState(0);
useEffect
(()
=>
{
const
doFetch
=
async
()
=>
{
...
...
@@ -46,6 +47,12 @@ const Registration = () => {
]);
setQuestions
(
allQuestions
);
const
[
allProducts
]
=
await
Promise
.
all
([
fetch
(
`
${
api
.
baseUrl
}
/products`
).
then
((
r
)
=>
r
.
json
()),
]);
setProducts
(
allProducts
);
};
doFetch
();
...
...
@@ -223,7 +230,7 @@ const Registration = () => {
<
/div
>
)}
{
audience
&&
questions
&&
(
{
audience
&&
questions
&&
products
&&
(
<>
<
h2
className
=
"
head-heavy-sm
"
>
2
.
Nyní
prosím
vyplňte
registrační
formulář
...
...
@@ -238,11 +245,12 @@ const Registration = () => {
}
showOrganization
=
{
audience
!==
"
member
"
}
showQuestions
=
{
audience
!==
"
journalist
"
}
show
Lunch
=
{
audience
!==
"
journalist
"
}
show
Products
=
{
audience
!==
"
journalist
"
}
showParties
=
{
audience
!==
"
journalist
"
}
showPrintouts
=
{
audience
!==
"
journalist
"
}
showDonation
=
{
audience
!==
"
journalist
"
}
questions
=
{
questions
}
products
=
{
products
}
onSubmit
=
{
setFormData
}
className
=
{
classNames
({
hidden
:
!!
formData
})}
/
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment