jk
3 years ago
9 changed files with 289 additions and 142 deletions
-
127app/Http/Controllers/SummarieController.php
-
106resources/views/beers.blade.php
-
68resources/views/beers/create.blade.php
-
67resources/views/beers/edit.blade.php
-
55resources/views/beers/index.blade.php
-
0resources/views/summaries/create.blade.php
-
0resources/views/summaries/edit.blade.php
-
0resources/views/summaries/index.blade.php
-
8routes/web.php
@ -1,110 +1,8 @@ |
|||||
@extends('layouts.app') |
@extends('layouts.app') |
||||
|
|
||||
@section('content') |
@section('content') |
||||
<div class="container"> |
|
||||
<div class="row justify-content-center"> |
|
||||
<div class="col-md-8"> |
|
||||
<div class="card"> |
|
||||
@include('inc.navbar') |
|
||||
<div class="card-header"><a href="/home">Home</a> -> {{ __('Beer List') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div> |
|
||||
|
|
||||
<div class="card-body"> |
|
||||
@if (Auth::user()->isAdmin()) |
|
||||
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#addModal" type="button" name="button" > |
|
||||
Add Beer |
|
||||
</button> |
|
||||
<hr /> |
|
||||
@endif |
|
||||
<table class="table table-striped table-dark" id="table-programs"> |
|
||||
<!-- This piece of code is for error messages display purposes --> |
|
||||
@include('inc.messages') |
|
||||
<thead> |
|
||||
<tr> |
|
||||
<th scope="col">Name</th> |
|
||||
<th scope="col">Brewery</th> |
|
||||
<th scope="col">Style</th> |
|
||||
</tr> |
|
||||
</thead> |
|
||||
|
|
||||
<tbody> |
|
||||
@foreach ($summaries as $summary) |
|
||||
<tr> |
|
||||
<td><a href="/beer/{{$summary->beer_id}}">{{$summary->name}}</a> </td> |
|
||||
<td><a href="/brewery/{{$summary->brewery_id}}">{{$summary->brewery}}</a> </td> |
|
||||
<td>{{$summary->type}} </td> |
|
||||
</tr> |
|
||||
@endforeach |
|
||||
</tbody> |
|
||||
</table> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
<!-- this code if for the modal --> |
|
||||
<div class="modal fade bg-primary text-dark" tabindex="-1" role="dialog" id="addModal"> |
|
||||
<div class="modal-dialog" role="document"> |
|
||||
<div class="modal-content"> |
|
||||
<div class="modal-header"> |
|
||||
<h5 class="modal-title">Add Beer</h5> |
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close" > |
|
||||
<span aria-hidden="true">x</span> |
|
||||
</button> |
|
||||
</div> |
|
||||
<div class="modal-body"> |
|
||||
<form class="" action="{{route('beers.store')}}" method="post"> |
|
||||
{{csrf_field()}} |
|
||||
<div class="form-group"> |
|
||||
<label for="">Name</label> |
|
||||
<input type="text" class="form-control" name="name"> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<label for="">Keywords</label> |
|
||||
<textarea type="text" class="form-control" name="keywords" ></textarea> |
|
||||
</div> |
|
||||
<div class="Type"> |
|
||||
<label for="">Colour</label> |
|
||||
<input type="text" class="form-control" name="type"> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<label for="">ABV %</label> |
|
||||
<input type="text" class="form-control" name="abv"> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<label for="">Original Gravity (OG)</label> |
|
||||
<input type="text" class="form-control" name="og"> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<label for="">Final Gravity (FG)</label> |
|
||||
<input type="text" class="form-control" name="fg"> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<label for="">Source</label> |
|
||||
<input type="text" class="form-control" name="source"> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<label for="">Notes</label> |
|
||||
<textarea type="text" class="form-control" name="notes"></textarea> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<label for="">Brewery ID</label> |
|
||||
<input type="text" class="form-control" name="brewery_id"> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<label for="">Batch Size (L)</label> |
|
||||
<input type="text" class="form-control" name="batch"> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<label for="">Mine?</label> |
|
||||
<input type="checkbox" class="form-control" name="mine" checked> |
|
||||
</div> |
|
||||
<input type="submit" name="submit" value="Submit" class="btn btn-success"> |
|
||||
</form> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
<div class="container"> |
||||
|
@yield('main') |
||||
</div> |
</div> |
||||
|
|
||||
|
|
||||
@endsection |
@endsection |
@ -0,0 +1,68 @@ |
|||||
|
@extends('beers') |
||||
|
|
||||
|
@section('main') |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-8 offset-sm-2"> |
||||
|
<h1 class="display-3">Add a Beer</h1> |
||||
|
<div> |
||||
|
@if ($errors->any()) |
||||
|
<div class="alert alert-danger"> |
||||
|
<ul> |
||||
|
@foreach ($errors->all() as $error) |
||||
|
<li>{{ $error }}</li> |
||||
|
@endforeach |
||||
|
</ul> |
||||
|
</div><br /> |
||||
|
@endif |
||||
|
<form method="post" action="{{ route('beers.store') }}"> |
||||
|
@csrf |
||||
|
<div class="form-group"> |
||||
|
<label for="name">Name</label> |
||||
|
<input type="text" class="form-control" name="name"> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="keywords">Keywords</label> |
||||
|
<textarea type="text" class="form-control" name="keywords" ></textarea> |
||||
|
</div> |
||||
|
<div class="Type"> |
||||
|
<label for="type">Style</label> |
||||
|
<input type="text" class="form-control" name="type"> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="abv">ABV %</label> |
||||
|
<input type="text" class="form-control" name="abv"> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="og">Original Gravity (OG)</label> |
||||
|
<input type="text" class="form-control" name="og"> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="fg">Final Gravity (FG)</label> |
||||
|
<input type="text" class="form-control" name="fg"> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="source">Source</label> |
||||
|
<input type="text" class="form-control" name="source"> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="notes">Notes</label> |
||||
|
<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"> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="batch">Batch Size (L)</label> |
||||
|
<input type="text" class="form-control" name="batch"> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="mine">Mine?</label> |
||||
|
<input type="checkbox" class="form-control" name="mine" checked> |
||||
|
</div> |
||||
|
<button type="submit" class="btn btn-primary">Add brewery</button> |
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
@endsection |
@ -0,0 +1,67 @@ |
|||||
|
@extends('beers') |
||||
|
@section('main') <div class="row"> |
||||
|
<div class="col-sm-8 offset-sm-2"> |
||||
|
<h1 class="display-3">Update Beer</h1> |
||||
|
|
||||
|
@if ($errors->any()) |
||||
|
<div class="alert alert-danger"> |
||||
|
<ul> |
||||
|
@foreach ($errors->all() as $error) |
||||
|
<li>{{ $error }}</li> |
||||
|
@endforeach |
||||
|
</ul> |
||||
|
</div> |
||||
|
<br /> |
||||
|
@endif |
||||
|
<form method="post" action="{{ route('beers.update', $beer->beer_id) }}"> |
||||
|
@method('PATCH') |
||||
|
@csrf |
||||
|
<div class="form-group"> |
||||
|
<label for="name">Name</label> |
||||
|
<input type="text" class="form-control" name="name" value={{ $beer->name }} />> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="keywords">Keywords</label> |
||||
|
<textarea type="text" class="form-control" name="keywords" value={{ $beer->keywords }} /> ></textarea> |
||||
|
</div> |
||||
|
<div class="Type"> |
||||
|
<label for="type">Style</label> |
||||
|
<input type="text" class="form-control" name="type" value={{ $beer->type }} />> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="abv">ABV %</label> |
||||
|
<input type="text" class="form-control" name="abv" value={{ $beer->abv }} />> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="og">Original Gravity (OG)</label> |
||||
|
<input type="text" class="form-control" name="og" value={{ $beer->og }} />> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="fg">Final Gravity (FG)</label> |
||||
|
<input type="text" class="form-control" name="fg" value={{ $beer->fg }} />> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="source">Source</label> |
||||
|
<input type="text" class="form-control" name="source" value={{ $beer->source }} />> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="notes">Notes</label> |
||||
|
<textarea type="text" class="form-control" name="notes" value={{ $beer->notes }} />></textarea> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="brewery_id">Brewery ID</label> |
||||
|
<input type="text" class="form-control" name="brewery_id" value={{ $beer->brewery_id }} />> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="batch">Batch Size (L)</label> |
||||
|
<input type="text" class="form-control" name="batch" value={{ $beer->batch }} />> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="mine">Mine?</label> |
||||
|
<input type="checkbox" class="form-control" name="mine" value={{ $beer->mine }} />> |
||||
|
</div> |
||||
|
<button type="submit" class="btn btn-primary">Update</button> |
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
@endsection |
@ -0,0 +1,55 @@ |
|||||
|
@extends('beers') |
||||
|
|
||||
|
@section('main') |
||||
|
<div class="container"> |
||||
|
<div class="row justify-content-center"> |
||||
|
<div class="col-md-8"> |
||||
|
<div class="card"> |
||||
|
@include('inc.navbar') |
||||
|
<div class="card-header"><a href="/home">Home</a> -> {{ __('Beer List') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div> |
||||
|
|
||||
|
<div class="card-body"> |
||||
|
@if (Auth::user()->isAdmin()) |
||||
|
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#addModal" type="button" name="button" > |
||||
|
Add Beer |
||||
|
</button> |
||||
|
<hr /> |
||||
|
@endif |
||||
|
<table class="table table-striped table-dark" id="table-programs"> |
||||
|
<!-- This piece of code is for error messages display purposes --> |
||||
|
@include('inc.messages') |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th scope="col">Name</th> |
||||
|
<th scope="col">Brewery</th> |
||||
|
<th scope="col">Style</th> |
||||
|
@if (Auth::user()->isAdmin())<th colspan="2" scope="col">Admin</th>@endif |
||||
|
</tr> |
||||
|
</thead> |
||||
|
|
||||
|
<tbody> |
||||
|
@foreach ($beers as $beer) |
||||
|
<tr> |
||||
|
<td><a href="/beer/{{$beer->beer_id}}">{{$beer->name}}</a> </td> |
||||
|
<td><a href="/brewery/{{$beer->brewery_id}}">{{$beer->brewery}}</a> </td> |
||||
|
<td>{{$beer->type}} </td> |
||||
|
@if (Auth::user()->isAdmin()) |
||||
|
<td><a href="{{ route('beers.edit',$beer->beer_id)}}" class="btn btn-primary">Edit</a></td> |
||||
|
<td><form action="{{ route('beers.destroy', $beer->beer_id)}}" method="post"> |
||||
|
@csrf |
||||
|
@method('DELETE') |
||||
|
<button class="btn btn-danger" type="submit">Delete</button> |
||||
|
</form></td> |
||||
|
@endif |
||||
|
|
||||
|
</tr> |
||||
|
@endforeach |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
@endsection |
Write
Preview
Loading…
Cancel
Save
Reference in new issue