Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cicer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
meskio
cicer
Commits
54dca2a8
Commit
54dca2a8
authored
4 years ago
by
meskio
Browse files
Options
Downloads
Patches
Plain Diff
Use member picker for topups
parent
816b60cb
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/Topup.js
+48
-70
48 additions, 70 deletions
src/Topup.js
with
48 additions
and
70 deletions
src/Topup.js
+
48
−
70
View file @
54dca2a8
import
React
from
"
react
"
;
import
{
Redirect
}
from
"
react-router-dom
"
;
import
Fetch
er
from
"
./
Fetch
er
"
;
import
MemberPick
er
from
"
./
MemberPick
er
"
;
import
{
Container
,
Form
,
...
...
@@ -11,7 +11,6 @@ import {
Spinner
,
InputGroup
,
}
from
"
react-bootstrap
"
;
import
{
Typeahead
}
from
"
react-bootstrap-typeahead
"
;
import
AuthContext
from
"
./AuthContext
"
;
class
Topup
extends
React
.
Component
{
...
...
@@ -20,11 +19,9 @@ class Topup extends React.Component {
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
member
s
:
[]
,
member
:
null
,
numInvalid
:
false
,
amount
:
0
,
num
:
null
,
name
:
""
,
comment
:
""
,
transactionId
:
null
,
isLoading
:
false
,
...
...
@@ -57,6 +54,10 @@ class Topup extends React.Component {
send
(
e
)
{
e
.
preventDefault
();
if
(
!
this
.
state
.
member
)
{
this
.
setState
({
error
:
"
Falta seleccionar una socia
"
});
return
;
}
this
.
setState
({
isLoading
:
true
,
error
:
null
});
const
body
=
JSON
.
stringify
({
...
...
@@ -103,73 +104,50 @@ class Topup extends React.Component {
}
return
(
<
Fetcher
url
=
"
/api/member
"
onFetch
=
{(
members
)
=>
this
.
setState
({
members
})}
>
<
Container
>
{
alert
}
<
Form
onSubmit
=
{(
e
)
=>
this
.
send
(
e
)}
>
<
Form
.
Group
as
=
{
Row
}
>
<
Form
.
Label
as
=
"
legend
"
column
sm
=
{
2
}
>
Socia
<
/Form.Label
>
<
Col
sm
=
{
5
}
>
<
Form
.
Control
placeholder
=
"
numero de socia
"
value
=
{
this
.
state
.
num
}
onChange
=
{(
e
)
=>
this
.
setNum
(
e
.
target
.
value
)}
isInvalid
=
{
this
.
state
.
numInvalid
}
/
>
<
/Col
>
<
Col
sm
=
{
5
}
>
<
Typeahead
id
=
"
name
"
labelKey
=
"
name
"
options
=
{
this
.
state
.
members
}
onChange
=
{(
m
)
=>
this
.
setName
(
m
[
0
])}
selected
=
{
this
.
state
.
name
?
[
this
.
state
.
name
]
:
[]}
/
>
<
/Col
>
<
/Form.Group
>
<
Form
.
Group
as
=
{
Row
}
>
<
Form
.
Label
as
=
"
legend
"
column
sm
=
{
2
}
>
Recarga
<
/Form.Label
>
<
Col
sm
=
{
10
}
>
<
InputGroup
>
<
Form
.
Control
type
=
"
number
"
placeholder
=
"
euros
"
value
=
{
this
.
state
.
amount
}
onChange
=
{(
e
)
=>
this
.
setState
({
amount
:
e
.
target
.
value
})}
/
>
<
InputGroup
.
Append
>
<
InputGroup
.
Text
>
.
00
€
<
/InputGroup.Text
>
<
/InputGroup.Append
>
<
/InputGroup
>
<
/Col
>
<
/Form.Group
>
<
Form
.
Group
as
=
{
Row
}
>
<
Form
.
Label
as
=
"
legend
"
column
sm
=
{
2
}
>
Comentario
<
/Form.Label
>
<
Col
sm
=
{
10
}
>
<
Container
>
{
alert
}
<
MemberPicker
member
=
{
this
.
state
.
member
}
onChange
=
{(
member
)
=>
this
.
setState
({
member
})}
/
>
<
Form
onSubmit
=
{(
e
)
=>
this
.
send
(
e
)}
>
<
Form
.
Group
as
=
{
Row
}
>
<
Form
.
Label
as
=
"
legend
"
column
sm
=
{
2
}
>
Recarga
<
/Form.Label
>
<
Col
sm
=
{
10
}
>
<
InputGroup
>
<
Form
.
Control
placeholder
=
"
...
"
value
=
{
this
.
state
.
comment
}
onChange
=
{(
e
)
=>
this
.
setState
({
comment
:
e
.
target
.
value
})}
type
=
"
number
"
placeholder
=
"
euros
"
value
=
{
this
.
state
.
amount
}
onChange
=
{(
e
)
=>
this
.
setState
({
amount
:
e
.
target
.
value
})}
/
>
<
/Col
>
<
/Form.Group
>
<
Form
.
Group
as
=
{
Row
}
>
<
Col
sm
=
{{
span
:
10
,
offset
:
2
}}
>
<
Button
type
=
"
submit
"
>
Recarga
<
/Button
>
<
/Col
>
<
/Form.Group
>
<
/Form
>
<
/Container
>
<
/Fetcher
>
<
InputGroup
.
Append
>
<
InputGroup
.
Text
>
.
00
€
<
/InputGroup.Text
>
<
/InputGroup.Append
>
<
/InputGroup
>
<
/Col
>
<
/Form.Group
>
<
Form
.
Group
as
=
{
Row
}
>
<
Form
.
Label
as
=
"
legend
"
column
sm
=
{
2
}
>
Comentario
<
/Form.Label
>
<
Col
sm
=
{
10
}
>
<
Form
.
Control
placeholder
=
"
...
"
value
=
{
this
.
state
.
comment
}
onChange
=
{(
e
)
=>
this
.
setState
({
comment
:
e
.
target
.
value
})}
/
>
<
/Col
>
<
/Form.Group
>
<
Form
.
Group
as
=
{
Row
}
>
<
Col
sm
=
{{
span
:
10
,
offset
:
2
}}
>
<
Button
type
=
"
submit
"
>
Recarga
<
/Button
>
<
/Col
>
<
/Form.Group
>
<
/Form
>
<
/Container
>
);
}
}
...
...
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