feat: flexible meal planning wizard — plan 1 meal, 1 day, several days, or a week

Backend:
- migration 005: expand menu_items.meal_type CHECK to all 6 types (second_breakfast, afternoon_snack, snack)
- ai/types.go: add Days and MealTypes to MenuRequest for partial generation
- openai/menu.go: parametrize GenerateMenu — use requested meal types and day count; add caloric fractions for all 6 meal types
- menu/repository.go: add UpsertItemsInTx for partial upsert (preserves existing slots); fix meal_type sort order in GetByWeek
- menu/handler.go: add dates+meal_types path to POST /ai/generate-menu; extract fetchImages/saveRecipes helpers; returns {"plans":[...]} for dates mode; backward-compatible with week mode

Client:
- PlanMenuSheet: bottom sheet with 4 planning horizon options
- PlanDatePickerSheet: adaptive sheet with date strip (single day/meal) or custom CalendarRangePicker (multi-day/week); sliding 7-day window for week mode
- menu_service.dart: add generateForDates
- menu_provider.dart: add PlanMenuService (generates + invalidates week providers), lastPlannedDateProvider
- home_screen.dart: add _PlanMenuButton card below quick actions; opens planning wizard
- l10n: 16 new keys for planning UI across all 12 languages

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
dbastrikin
2026-03-22 12:10:52 +02:00
parent 5096df2102
commit 9580bff54e
35 changed files with 2025 additions and 136 deletions

View File

@@ -373,4 +373,52 @@ class AppLocalizationsHi extends AppLocalizations {
@override
String get weekPlannedLabel => 'सप्ताह की योजना बनाई गई';
@override
String get planMenuButton => 'भोजन की योजना बनाएं';
@override
String get planMenuTitle => 'क्या योजना बनानी है?';
@override
String get planOptionSingleMeal => 'एक भोजन';
@override
String get planOptionSingleMealDesc => 'दिन और भोजन का प्रकार चुनें';
@override
String get planOptionDay => 'एक दिन';
@override
String get planOptionDayDesc => 'एक दिन के सभी भोजन';
@override
String get planOptionDays => 'कई दिन';
@override
String get planOptionDaysDesc => 'अवधि अनुकूलित करें';
@override
String get planOptionWeek => 'एक सप्ताह';
@override
String get planOptionWeekDesc => 'एक बार में 7 दिन';
@override
String get planSelectDate => 'तारीख चुनें';
@override
String get planSelectMealType => 'भोजन का प्रकार';
@override
String get planSelectRange => 'अवधि चुनें';
@override
String get planGenerateButton => 'योजना बनाएं';
@override
String get planGenerating => 'योजना बना रहे हैं…';
@override
String get planSuccess => 'मेनू की योजना बनाई गई!';
}