Client: add notes to activities - fix 10

+ minor fix on weather
This commit is contained in:
Sam
2018-06-13 18:52:39 +02:00
parent 47fc2ab830
commit 066a05c57f
7 changed files with 59 additions and 8 deletions

View File

@ -64,6 +64,18 @@ function FormWithGpx (props) {
</label>
</div>
)}
<div className="form-group">
<label>
Notes:
<textarea
name="notes"
defaultValue={activity ? activity.notes : ''}
disabled={loading}
className="form-control input-lg"
maxLength="500"
/>
</label>
</div>
{loading ? (
<div className="loader" />
) : (
@ -100,13 +112,16 @@ export default connect(
const form = new FormData()
form.append('file', e.target.form.gpxFile.files[0])
form.append(
'data', `{"sport_id": ${e.target.form.sport.value}}`
'data',
`{"sport_id": ${e.target.form.sport.value
}, "notes": "${e.target.form.notes.value}"}`
)
dispatch(addActivity(form))
},
onEditActivity: (e, activity) => {
dispatch(editActivity({
id: activity.id,
notes: e.target.form.notes.value,
sport_id: +e.target.form.sport.value,
title: e.target.form.title.value,
}))

View File

@ -103,6 +103,17 @@ function FormWithoutGpx (props) {
/>
</label>
</div>
<div className="form-group">
<label>
Notes:
<textarea
name="notes"
defaultValue={activity ? activity.notes : ''}
className="form-control input-lg"
maxLength="500"
/>
</label>
</div>
<input
type="submit"
className="btn btn-primary btn-lg btn-block"
@ -133,6 +144,7 @@ export default connect(
activity_date: activityDate,
distance: +e.target.form.distance.value,
duration,
notes: e.target.form.notes.value,
sport_id: +e.target.form.sport_id.value,
title: e.target.form.title.value,
}