initial commit
This commit is contained in:
117
views/goals.ejs
Normal file
117
views/goals.ejs
Normal file
@@ -0,0 +1,117 @@
|
||||
<h1 class="text-3xl font-bold mb-6">Goals & Settings</h1>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<!-- Personal Info Form -->
|
||||
<div class="glass rounded-xl p-6">
|
||||
<h2 class="text-xl font-semibold mb-4 text-primary">Personal Information</h2>
|
||||
<form method="POST" action="/goals">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-2">Age</label>
|
||||
<input type="number" name="age" value="<%= current_user.age || 25 %>" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" required>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-2">Gender</label>
|
||||
<select name="gender" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" required>
|
||||
<option value="male" <%= current_user.gender === 'male' ? 'selected' : '' %>>Male</option>
|
||||
<option value="female" <%= current_user.gender === 'female' ? 'selected' : '' %>>Female</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-2">Height (cm)</label>
|
||||
<input type="number" step="0.1" name="height_cm" value="<%= current_user.height_cm || 170 %>" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" required>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-2">Weight (kg)</label>
|
||||
<input type="number" step="0.1" name="weight_kg" value="<%= current_user.weight_kg || 70 %>" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block text-sm font-medium mb-2">Activity Level</label>
|
||||
<select name="activity_level" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" required>
|
||||
<option value="sedentary" <%= current_user.activity_level === 'sedentary' ? 'selected' : '' %>>Sedentary (Office job)</option>
|
||||
<option value="light" <%= current_user.activity_level === 'light' ? 'selected' : '' %>>Light (Exercise 1-3 days/week)</option>
|
||||
<option value="moderate" <%= current_user.activity_level === 'moderate' ? 'selected' : '' %>>Moderate (Exercise 3-5 days/week)</option>
|
||||
<option value="active" <%= current_user.activity_level === 'active' ? 'selected' : '' %>>Active (Exercise 6-7 days/week)</option>
|
||||
<option value="very_active" <%= current_user.activity_level === 'very_active' ? 'selected' : '' %>>Very Active (Physical job/training)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<hr class="my-6 border-gray-200">
|
||||
|
||||
<h2 class="text-xl font-semibold mb-4 text-primary">Goals</h2>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block text-sm font-medium mb-2">Goal Type</label>
|
||||
<select name="goal_type" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" required>
|
||||
<option value="weight_loss" <%= goals && goals.goal_type === 'weight_loss' ? 'selected' : '' %>>Weight Loss</option>
|
||||
<option value="recomp" <%= (!goals || goals.goal_type === 'recomp') ? 'selected' : '' %>>Maintain / Recomposition</option>
|
||||
<option value="muscle_gain" <%= goals && goals.goal_type === 'muscle_gain' ? 'selected' : '' %>>Muscle Gain</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-2">Target Weight (kg)</label>
|
||||
<input type="number" step="0.1" name="target_weight_kg" value="<%= goals ? goals.target_weight_kg : 70 %>" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" required>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-2">Target Water (ml)</label>
|
||||
<input type="number" name="target_water_ml" value="<%= goals ? goals.target_water_ml : 2000 %>" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="w-full bg-primary text-white font-bold py-3 px-4 rounded-lg hover:bg-red-700 transition duration-300">
|
||||
Update Goals & Recalculate Macros
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Calculated Stats -->
|
||||
<div class="space-y-6">
|
||||
<div class="glass rounded-xl p-6">
|
||||
<h2 class="text-xl font-semibold mb-4 text-primary">Your Stats</h2>
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<div class="p-4 bg-red-50 rounded-lg">
|
||||
<p class="text-sm text-gray-500 mb-1">BMR</p>
|
||||
<p class="text-2xl font-bold text-gray-800"><%= bmr || '-' %></p>
|
||||
<p class="text-xs text-gray-400">Calories burned at rest</p>
|
||||
</div>
|
||||
<div class="p-4 bg-green-50 rounded-lg">
|
||||
<p class="text-sm text-gray-500 mb-1">TDEE</p>
|
||||
<p class="text-2xl font-bold text-gray-800"><%= tdee || '-' %></p>
|
||||
<p class="text-xs text-gray-400">Total daily energy expenditure</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if (goals) { %>
|
||||
<div class="glass rounded-xl p-6">
|
||||
<h2 class="text-xl font-semibold mb-4 text-primary">Daily Targets</h2>
|
||||
<div class="space-y-4">
|
||||
<div class="flex justify-between items-center p-3 border-b">
|
||||
<span class="text-gray-600">Calories</span>
|
||||
<span class="font-bold text-lg"><%= current_user.target_daily_calories %></span>
|
||||
</div>
|
||||
<div class="flex justify-between items-center p-3 border-b">
|
||||
<span class="text-gray-600">Protein</span>
|
||||
<span class="font-bold"><%= goals.target_protein_g %>g</span>
|
||||
</div>
|
||||
<div class="flex justify-between items-center p-3 border-b">
|
||||
<span class="text-gray-600">Carbs</span>
|
||||
<span class="font-bold"><%= goals.target_carbs_g %>g</span>
|
||||
</div>
|
||||
<div class="flex justify-between items-center p-3 border-b">
|
||||
<span class="text-gray-600">Fat</span>
|
||||
<span class="font-bold"><%= goals.target_fat_g %>g</span>
|
||||
</div>
|
||||
<div class="flex justify-between items-center p-3">
|
||||
<span class="text-gray-600">Water</span>
|
||||
<span class="font-bold"><%= goals.target_water_ml %>ml</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user