jk
3 years ago
7 changed files with 180 additions and 69 deletions
-
47app/Http/Controllers/GrainbillController.php
-
60resources/views/grainbills.blade.php
-
40resources/views/grainbills/create.blade.php
-
39resources/views/grainbills/edit.blade.php
-
50resources/views/grainbills/index.blade.php
-
4resources/views/hops/create.blade.php
-
3routes/web.php
@ -1,64 +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> -> {{ __('Grain Bills') }}<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 Adjunct |
|
||||
</button> |
|
||||
<hr /> |
|
||||
@endif |
|
||||
<!-- This piece of code is for error messages display purposes --> |
|
||||
@include('inc.messages') |
|
||||
</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 Grain Bill</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('grainbills.store')}}" method="post"> |
|
||||
{{csrf_field()}} |
|
||||
<div class="form-group"> |
|
||||
<label for="">Beer ID</label> |
|
||||
<input type="text" class="form-control" name="beer_id"> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<label for="">Grain ID</label> |
|
||||
<input type="text" class="form-control" name="grain_id" > |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<label for="">Amount</label> |
|
||||
<input type="text" class="form-control" name="amount"> |
|
||||
</div> |
|
||||
<div class="form-group"> |
|
||||
<label for="">% of Total Grain Bill</label> |
|
||||
<input type="text" class="form-control" name="grain_bill"> |
|
||||
</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,40 @@ |
|||||
|
@extends('grainbills') |
||||
|
|
||||
|
@section('main') |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-8 offset-sm-2"> |
||||
|
<h1 class="display-3">Add a Grain</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('grainbills.store') }}"> |
||||
|
@csrf |
||||
|
<div class="form-group"> |
||||
|
<label for="beer_id">Beer ID</label> |
||||
|
<input type="text" class="form-control" name="beer_id"> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="grain_id">Grain ID</label> |
||||
|
<input type="text" class="form-control" name="grain_id" > |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="amount">Amount</label> |
||||
|
<input type="text" class="form-control" name="amount"> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="grain_bill">% of Total Grain Bill</label> |
||||
|
<input type="text" class="form-control" name="grain_bill"> |
||||
|
</div> |
||||
|
<button type="submit" class="btn btn-primary">Add Grain</button> |
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
@endsection |
@ -0,0 +1,39 @@ |
|||||
|
@extends('grainbills') |
||||
|
@section('main') <div class="row"> |
||||
|
<div class="col-sm-8 offset-sm-2"> |
||||
|
<h1 class="display-3">Update Grain Bill</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('grainbills.update', $grainbill->id) }}"> |
||||
|
@method('PATCH') |
||||
|
@csrf |
||||
|
<div class="form-group"> |
||||
|
<label for="beer_id">Beer ID</label> |
||||
|
<input type="text" class="form-control" name="beer_id" value="{{$grainbill->beer_id}}" /> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="grain_id">Grain ID</label> |
||||
|
<input type="text" class="form-control" name="grain_id" value="{{$grainbill->grain_id}}" /> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="amount">Amount</label> |
||||
|
<input type="text" class="form-control" name="amount" value="{{$grainbill->amount}}" /> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label for="grain_bill">% of Total Grain Bill</label> |
||||
|
<input type="text" class="form-control" name="grain_bill" value="{{$grainbill->grain_bill}}" /> |
||||
|
</div> |
||||
|
<button type="submit" class="btn btn-primary">Update</button> |
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
@endsection |
@ -0,0 +1,50 @@ |
|||||
|
@extends('grainbills') |
||||
|
|
||||
|
@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> -> {{ __('Grain Bills') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div> |
||||
|
|
||||
|
<div class="card-body"> |
||||
|
@if (Auth::user()->isAdmin()) |
||||
|
<a href="{{ route('grainbills.create') }}" class="btn btn-primary">Add Grain</a> |
||||
|
<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">Grain</th> |
||||
|
<th scope="col">Beer</th> |
||||
|
<th scope="col">Amount</th> |
||||
|
<th scope="col">% of Grain Bill</th> |
||||
|
@if (Auth::user()->isAdmin())<th colspan="2" scope="col">Admin</th>@endif |
||||
|
<tbody> |
||||
|
@foreach ($grainbills as $grainbill) |
||||
|
<tr> |
||||
|
<td><a href="/grain/{{$grainbill->grain_id}}">{{$grainbill->name}}</a> </td> |
||||
|
<td><a href="/beer/{{$grainbill->beer_id}}">{{$grainbill->beer}}</a> </td> |
||||
|
<td>{{$grainbill->amount}} </td> |
||||
|
<td>{{$grainbill->grain_bill}} </td> |
||||
|
@if (Auth::user()->isAdmin()) |
||||
|
<td><a href="{{ route('grainbills.edit',$grainbill->id)}}" class="btn btn-primary">Edit</a></td> |
||||
|
<td><form action="{{ route('grainbills.destroy', $grainbill->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