feat: Frontend - Startdatum field in goal form
All checks were successful
Deploy Development / deploy (push) Successful in 44s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s

Added start_date field to goal creation/editing form:

1. New "Startdatum" input field before "Zieldatum"
   - Defaults to today
   - Hint: "Startwert wird automatisch aus historischen Daten ermittelt"

2. Display start_date in goals list
   - Shows next to start_value: "85 kg (01.01.26)"
   - Compact format for better readability

3. Updated formData state
   - Added start_date with today as default
   - API calls automatically include it

User can now:
- Set historical start date (e.g., 3 months ago)
- Backend auto-populates start_value from that date
- See exact start date and value for each goal

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lars 2026-03-28 13:15:56 +01:00
parent efde158dd4
commit 327319115d

View File

@ -89,6 +89,7 @@ export default function GoalsPage() {
priority: 2, priority: 2,
target_value: '', target_value: '',
unit: 'kg', unit: 'kg',
start_date: new Date().toISOString().split('T')[0], // Default to today
target_date: '', target_date: '',
name: '', name: '',
description: '', description: '',
@ -666,6 +667,11 @@ export default function GoalsPage() {
<div> <div>
<span style={{ color: 'var(--text2)' }}>Start:</span>{' '} <span style={{ color: 'var(--text2)' }}>Start:</span>{' '}
<strong>{goal.start_value} {goal.unit}</strong> <strong>{goal.start_value} {goal.unit}</strong>
{goal.start_date && (
<span style={{ fontSize: 12, color: 'var(--text3)', marginLeft: 4 }}>
({dayjs(goal.start_date).format('DD.MM.YY')})
</span>
)}
</div> </div>
<div> <div>
<span style={{ color: 'var(--text2)' }}>Aktuell:</span>{' '} <span style={{ color: 'var(--text2)' }}>Aktuell:</span>{' '}
@ -1085,6 +1091,29 @@ export default function GoalsPage() {
</div> </div>
</div> </div>
{/* Startdatum */}
<div style={{ marginBottom: 16 }}>
<label style={{
display: 'block',
fontSize: 13,
fontWeight: 500,
marginBottom: 4,
color: 'var(--text2)'
}}>
Startdatum
</label>
<input
type="date"
className="form-input"
style={{ width: '100%', textAlign: 'left' }}
value={formData.start_date || new Date().toISOString().split('T')[0]}
onChange={e => setFormData(f => ({ ...f, start_date: e.target.value }))}
/>
<div style={{ fontSize: 12, color: 'var(--text3)', marginTop: 4 }}>
Startwert wird automatisch aus historischen Daten ermittelt
</div>
</div>
{/* Zieldatum */} {/* Zieldatum */}
<div style={{ marginBottom: 16 }}> <div style={{ marginBottom: 16 }}>
<label style={{ <label style={{