Browse Source

adding dropdown menus to adjuncts and beer create blade, mkI

master
jk 3 years ago
parent
commit
118a4d2fc1
  1. 5
      app/Http/Controllers/AdjunctAdditionController.php
  2. 5
      app/Http/Controllers/SummarieController.php
  3. 24
      resources/views/adjunctadditions/create.blade.php
  4. 8
      resources/views/beers/create.blade.php
  5. 8
      resources/views/fermentations/create.blade.php

5
app/Http/Controllers/AdjunctAdditionController.php

@ -81,7 +81,10 @@ class AdjunctAdditionController extends Controller
}
public function create()
{
return view('adjunctadditions.create');
$beers = Summarie::orderBy('name')->get();
$adjuncts = Adjunct::orderBy('name')->get();
$data = array('beers'=>$beers, 'adjuncts'=>$adjuncts);
return view('adjunctadditions.create')->with($data);
}
public function destroy($id)
{

5
app/Http/Controllers/SummarieController.php

@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Summarie;
use App\Models\Brewerie;
use Illuminate\Support\Facades\DB;
class SummarieController extends Controller
@ -115,7 +116,9 @@ class SummarieController extends Controller
{
$lastID = Summarie::orderBy('beer_id','desc')->take(1)->value('beer_id');
$beer_id = number_format($lastID) + 1;
return view('beers.create')->with('beer_id', $beer_id);
$breweries = Brewerie::orderBy('name')->get()
$data = array('beer_id'=>$beer_id, 'breweries'=>$breweries);
return view('beers.create')->with($data);
}
public function destroy($id)

24
resources/views/adjunctadditions/create.blade.php

@ -17,12 +17,20 @@
<form method="post" action="{{ route('adjunctadditions.store') }}">
@csrf
<div class="form-group">
<label for="beer_id">Beer ID</label>
<input type="text" class="form-control" name="beer_id">
<label for="beer_id">Beer</label>
<select>
@foreach ($beers as $beer)
<option name="beer_id" value="{{$beer->beer_id}}">{{$beer->name}}</option>
@endforeach
</select>
</div>
<div class="form-group">
<label for="adjunct_id">Adjunct ID</label>
<input type="text" class="form-control" name="adjunct_id" >
<label for="adjunct_id">Adjunct</label>
<select>
@foreach ($adjuncts as $adjunct)
<option name="adjunct_id" value="{{$adjunct->id}}">{{$adjunct->name}}</option>
@endforeach
</select>
</div>
<div class="form-group">
<label for="amount">Amount</label>
@ -33,8 +41,12 @@
<input type="text" maxlength="10" class="form-control" name="timing">
</div>
<div class="form-group">
<label for="alternative">Alternative (ID)</label>
<input type="text" class="form-control" name="alternative">
<label for="alternative">Alternative</label>
<select>
@foreach ($adjuncts as $adjunct)
<option name="alternative" value="{{$adjunct->id}}">{{$adjunct->name}}</option>
@endforeach
</select>
</div>
<div class="form-group">
<label for="notes">Notes</label>

8
resources/views/beers/create.blade.php

@ -53,8 +53,12 @@
<textarea type="text" class="form-control" name="notes"></textarea>
</div>
<div class="form-group">
<label for="brewery_id">Brewery ID</label>
<input type="text" class="form-control" name="brewery_id">
<label for="brewery_id">Brewery</label>
<select>
@foreach ($breweries as $brewery)
<option name="brewery_id" value="{{$brewery->id}}">{{$brewery->name}}</option>
@endforeach
</select>
</div>
<div class="form-group">
<label for="batch">Batch Size (L)</label>

8
resources/views/fermentations/create.blade.php

@ -41,8 +41,12 @@
<textarea type="text" class="form-control" name="duration"></textarea>
</div>
<div class="form-group">
<label for="alternative">Alternative (ID)</label>
<input type="text" class="form-control" name="alternative">
<label for="alternative">Alternative</label>
<select>
@foreach ($yeasts as $yeast)
<option name="alternative" value="{{$yeast->id}}">{{$yeast->name}}</option>
@endforeach
</select>
</div>
<button type="submit" class="btn btn-primary">Add Fermentation Step</button>
</form>

Loading…
Cancel
Save