mirror of https://github.com/kcal-app/kcal.git
80 lines
4.2 KiB
PHP
80 lines
4.2 KiB
PHP
<x-app-layout>
|
|
<x-slot name="header">
|
|
<div class="flex justify-between items-center">
|
|
<h2 class="font-semibold text-xl text-gray-800 leading-tight">Add Entry</h2>
|
|
<a href="{{ route('journal-entries.create', ['date' => $default_date->format('Y-m-d')]) }}" class="inline-flex items-center rounded-md font-semibold text-white p-2 bg-green-500 tracking-widest hover:bg-green-700 active:bg-green-900 focus:outline-none focus:border-green-900 focus:ring ring-green-600 disabled:opacity-25 transition ease-in-out duration-150">
|
|
Add by Recipes/Food
|
|
</a>
|
|
</div>
|
|
</x-slot>
|
|
|
|
<div class="py-6">
|
|
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
|
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
|
|
<div class="p-6 bg-white border-b border-gray-200">
|
|
<form method="POST" action="{{ route('journal-entries.store.from-nutrients') }}">
|
|
@csrf
|
|
<div class="flex flex-col space-y-4 md:flex-row md:space-x-4 md:space-y-0 w-full mb-4">
|
|
<!-- Date -->
|
|
<div class="w-full sm:w-auto">
|
|
<x-inputs.label for="date" value="Date"/>
|
|
|
|
<x-inputs.input name="date"
|
|
type="date"
|
|
class="block w-full"
|
|
:value="old('date', $default_date->toDateString())"
|
|
required />
|
|
</div>
|
|
|
|
<!-- Meal -->
|
|
<div class="w-full sm:w-auto">
|
|
<x-inputs.label for="meal" value="Meal"/>
|
|
|
|
<x-inputs.select name="meal"
|
|
class="block w-full"
|
|
:options="$meals"
|
|
:selectedValue="old('meal')"
|
|
required>
|
|
<option value=""></option>
|
|
</x-inputs.select>
|
|
</div>
|
|
|
|
<!-- Summary -->
|
|
<div class="flex-auto">
|
|
<x-inputs.label for="summary" value="Summary"/>
|
|
|
|
<x-inputs.input name="summary"
|
|
type="text"
|
|
class="block w-full"
|
|
:value="old('summary')"
|
|
required />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex flex-col space-y-4 md:flex-row md:space-x-4 md:space-y-0 w-full">
|
|
@foreach (\App\Support\Nutrients::all()->sortBy('weight') as $nutrient)
|
|
<!-- {{ ucfirst($nutrient['value']) }} -->
|
|
<div class="flex-auto">
|
|
<x-inputs.label for="{{ $nutrient['value'] }}"
|
|
:value="ucfirst($nutrient['value']) . ($nutrient['unit'] ? ' (' . $nutrient['unit'] . ')' : '')"/>
|
|
|
|
<x-inputs.input id="{{ $nutrient['value'] }}"
|
|
class="block w-full"
|
|
type="number"
|
|
step="any"
|
|
name="{{ $nutrient['value'] }}"
|
|
:value="old($nutrient['value'])"/>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
|
|
<div class="flex items-center justify-end mt-4">
|
|
<x-inputs.button class="ml-3">Add Entry</x-inputs.button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</x-app-layout>
|