Files
rootandClaude Sonnet 5 ebd0578dc9 Add multi-week workout programs
A Workout was a single flat session with no way to schedule several
across weeks/days as a structured plan (e.g. Push/Pull/Legs over 4
weeks) - every user started from a blank builder each time, and there
was no template concept at all.

Adds a Program (title, description, week count) that Workouts can
optionally belong to via nullable program_id/week_number/day_number
columns, reusing all existing workout and session-tracking
infrastructure rather than building a parallel system. The program show
page lays out the schedule week by week and derives progress (completed
vs total) from the user's existing WorkoutSession completions - no new
enrollment/progress-tracking concept needed. Deleting a program
unschedules its workouts (nullOnDelete) rather than destroying them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-10 12:21:47 +03:00

37 lines
2.5 KiB
PHP

<x-app-layout>
<section class="bg-white dark:bg-gray-900 border-b border-gray-100 dark:border-gray-800">
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-8">
<h1 class="text-2xl sm:text-3xl font-extrabold tracking-tight text-gray-900 dark:text-white">New Program</h1>
<p class="mt-2 text-gray-600 dark:text-gray-300">Give it a name and how many weeks it runs for. You'll add workouts to specific weeks next.</p>
</div>
</section>
<section class="mx-auto max-w-2xl px-4 sm:px-6 lg:px-8 py-8">
@if ($errors->any())
<div class="mb-4 rounded-xl bg-red-50 text-red-700 px-4 py-3">
<ul class="list-disc ms-5 text-sm">
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form method="POST" action="{{ route('programs.store') }}" class="space-y-5 bg-white dark:bg-gray-800 rounded-2xl p-6 ring-1 ring-gray-200 dark:ring-gray-700">
@csrf
<div>
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300">Title</label>
<input type="text" name="title" value="{{ old('title') }}" required placeholder="e.g. Push Pull Legs" class="mt-1 w-full rounded-xl border-gray-300 dark:border-gray-700 bg-white/80 dark:bg-gray-900 text-gray-900 dark:text-gray-100 px-3 py-2">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300">Weeks</label>
<input type="number" name="weeks" min="1" max="52" value="{{ old('weeks', 4) }}" required class="mt-1 w-32 rounded-xl border-gray-300 dark:border-gray-700 bg-white/80 dark:bg-gray-900 text-gray-900 dark:text-gray-100 px-3 py-2">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300">Description</label>
<textarea name="description" rows="3" class="mt-1 w-full rounded-xl border-gray-300 dark:border-gray-700 bg-white/80 dark:bg-gray-900 text-gray-900 dark:text-gray-100 px-3 py-2">{{ old('description') }}</textarea>
</div>
<button type="submit" class="inline-flex items-center rounded-xl bg-gradient-to-r from-fuchsia-600 to-indigo-600 px-4 py-2 text-sm font-semibold text-white shadow hover:from-fuchsia-500 hover:to-indigo-500">Create Program</button>
</form>
</section>
</x-app-layout>