Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kszkepzes-frontend
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Köpeczi-Bócz Gergely
kszkepzes-frontend
Commits
bcbe0fc1
Commit
bcbe0fc1
authored
6 years ago
by
Chif Gergő
Browse files
Options
Downloads
Patches
Plain Diff
Using table instead of Dropdown to select the visitors
parent
ca9332fb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/pages/EventDetail.js
+89
-30
89 additions, 30 deletions
src/components/pages/EventDetail.js
with
89 additions
and
30 deletions
src/components/pages/EventDetail.js
+
89
−
30
View file @
bcbe0fc1
import
React
,
{
Component
}
from
'
react
'
;
import
React
,
{
Component
}
from
'
react
'
;
import
{
Container
,
Item
,
Dropdown
,
Button
,
Label
,
Comment
,
Form
,
Header
}
from
'
semantic-ui-react
'
;
import
{
Container
,
Item
,
Button
,
Comment
,
Form
,
Header
,
Table
,
Icon
,
Checkbox
,
}
from
'
semantic-ui-react
'
;
import
{
connect
}
from
'
react-redux
'
;
import
{
connect
}
from
'
react-redux
'
;
import
moment
from
'
moment
'
;
import
moment
from
'
moment
'
;
import
{
getEventById
,
getTrainees
,
visitorChange
,
getNotesByEvent
,
submitVisitors
}
from
'
../../actions/statistics
'
;
import
{
getEventById
,
getTrainees
,
visitorChange
,
getNotesByEvent
,
submitVisitors
}
from
'
../../actions/statistics
'
;
class
EventDetail
extends
Component
{
class
EventDetail
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
edit
:
false
,
};
}
componentWillMount
()
{
componentWillMount
()
{
this
.
props
.
getEventById
(
this
.
props
.
match
.
params
.
id
);
this
.
props
.
getEventById
(
this
.
props
.
match
.
params
.
id
);
this
.
props
.
getTrainees
();
this
.
props
.
getTrainees
();
this
.
props
.
getNotesByEvent
(
this
.
props
.
match
.
params
.
id
);
this
.
props
.
getNotesByEvent
(
this
.
props
.
match
.
params
.
id
);
}
}
renderEvent
()
{
const
{
id
,
name
,
date
,
visitors
}
=
this
.
props
.
selectedEvent
;
renderTrainees
()
{
const
usernames
=
this
.
props
.
trainees
.
map
((
item
)
=>
{
return
this
.
props
.
trainees
.
map
((
item
)
=>
{
return
({
const
isVisitor
=
this
.
props
.
selectedEvent
.
visitors
.
find
(
i
=>
i
===
item
.
id
);
key
:
item
.
id
,
return
(
text
:
item
.
full_name
,
<
Table
.
Row
>
value
:
item
.
id
,
<
Table
.
Cell
>
});
{
item
.
full_name
}
<
/Table.Cell
>
{
!
this
.
state
.
edit
?
<
Table
.
Cell
textAlign
=
'
center
'
>
{
isVisitor
?
<
Icon
color
=
'
green
'
name
=
'
checkmark
'
/>
:
<
Icon
color
=
'
green
'
name
=
'
cancel
'
/>
}
<
/Table.Cell
>
:
<
Table
.
Cell
textAlign
=
'
center
'
>
<
Checkbox
defaultChecked
=
{
isVisitor
?
true
:
false
}
onChange
=
{()
=>
this
.
props
.
visitorChange
(
item
)}
/
>
<
/Table.Cell
>
}
<
Table
.
Cell
>
<
/Table.Cell
>
<
/Table.Row
>
);
});
});
}
renderEvent
()
{
const
{
id
,
name
,
date
,
visitors
}
=
this
.
props
.
selectedEvent
;
return
(
return
(
<
Item
>
<
Item
>
<
Item
.
Header
as
=
'
h2
'
>
{
name
}
<
/Item.Header
>
<
Item
.
Header
as
=
'
h2
'
>
{
name
}
<
/Item.Header
>
<
Item
.
Header
as
=
'
h3
'
>
Dátum
:
{
moment
(
date
).
format
(
'
LL
'
)}
<
/Item.Header
>
<
Item
.
Header
as
=
'
h3
'
>
Dátum
:
{
moment
(
date
).
format
(
'
LL
'
)}
<
/Item.Header
>
<
Label
>
Jelen
voltak
:
<
/Label
>
<
Dropdown
multiple
selection
placeholder
=
'
Újoncok hozzáadása
'
style
=
{{
minWidth
:
'
150px
'
,
maxWidth
:
'
200px
'
,
}}
onChange
=
{(
_
,
v
)
=>
this
.
props
.
visitorChange
(
v
.
value
)}
defaultValue
=
{
visitors
}
options
=
{
usernames
}
/
>
<
Button
onCLick
=
{
this
.
props
.
submitVisitors
({
id
,
visitors
})}
>
Megerősítés
<
/Button
>
<
/Item
>
<
/Item
>
);
);
}
}
renderComments
()
{
renderComments
()
{
const
notes
=
this
.
props
.
eventNotes
;
const
notes
=
this
.
props
.
eventNotes
;
...
@@ -59,8 +85,7 @@ class EventDetail extends Component {
...
@@ -59,8 +85,7 @@ class EventDetail extends Component {
<
/Comment.Text
>
<
/Comment.Text
>
<
/Comment.Content
>
<
/Comment.Content
>
<
/Comment
>
<
/Comment
>
)
));
);
}
}
render
()
{
render
()
{
...
@@ -75,9 +100,43 @@ class EventDetail extends Component {
...
@@ -75,9 +100,43 @@ class EventDetail extends Component {
<
/Container
>
<
/Container
>
<
Container
<
Container
style
=
{{
style
=
{{
padding
:
'
80px
'
padding
:
'
80px
'
,
}}
}}
>
>
<
Table
celled
centered
>
<
Table
.
Header
>
<
Table
.
Row
>
<
Table
.
HeaderCell
>
Név
<
/Table.HeaderCell
>
<
Table
.
HeaderCell
>
Jelen
volt
<
/Table.HeaderCell
>
<
Table
.
HeaderCell
>
Megjegyzések
<
/Table.HeaderCell
>
<
/Table.Row
>
<
/Table.Header
>
<
Table
.
Body
>
{
this
.
props
.
trainees
&&
this
.
props
.
selectedEvent
?
this
.
renderTrainees
()
:
''
}
<
/Table.Body
>
<
/Table
>
<
Button
onClick
=
{()
=>
this
.
setState
({
edit
:
true
})}
>
Edit
<
/Button
>
{
this
.
state
.
edit
?
<
Button
onClick
=
{()
=>
{
this
.
setState
({
edit
:
false
});
this
.
props
.
submitVisitors
(
this
.
props
.
selectedEvent
);
}
}
>
Save
<
/Button
>
:
''
}
<
Comment
.
Group
>
<
Comment
.
Group
>
<
Header
dividing
>
<
Header
dividing
>
Megjegyzések
Megjegyzések
...
...
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
register
or
sign in
to comment