jk
3 years ago
6 changed files with 204 additions and 92 deletions
-
54app/Http/Controllers/YeastController.php
-
83resources/views/yeasts.blade.php
-
48resources/views/yeasts/create.blade.php
-
47resources/views/yeasts/edit.blade.php
-
49resources/views/yeasts/index.blade.php
-
7routes/web.php
@ -1,87 +1,8 @@ |
|||
@extends('layouts.app') |
|||
|
|||
@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> -> {{ __('Yeast 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 Yeast |
|||
</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">Profile</th> |
|||
</tr> |
|||
</thead> |
|||
|
|||
<tbody> |
|||
@foreach ($yeasts as $yeast) |
|||
<tr> |
|||
<td><a href="/yeast/{{$yeast->id}}">{{$yeast->name}}</a> </td> |
|||
<td>{{str_replace(' ,',',',str_replace('"',' ',str_replace(',',', ',str_replace('}', '', str_replace('{','',$yeast->profile)))))}} </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 yeast</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('yeasts.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="">Profile</label> |
|||
<textarea type="text" class="form-control" name="profile" ></textarea> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label for="">Attenuation</label> |
|||
<input type="text" class="form-control" name="attenuation"> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label for="">Flocculation</label> |
|||
<input type="text" class="form-control" name="flocculation"> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label for="">Alcohol Tolerance</label> |
|||
<input type="text" class="form-control" name="tolerance"> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label for="">Temperature Range °C</label> |
|||
<input type="text" class="form-control" name="temp_range"> |
|||
</div> |
|||
<input type="submit" name="submit" value="Submit" class="btn btn-success"> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="container"> |
|||
@yield('main') |
|||
</div> |
|||
|
|||
|
|||
@endsection |
@ -0,0 +1,48 @@ |
|||
@extends('yeasts') |
|||
|
|||
@section('main') |
|||
<div class="row"> |
|||
<div class="col-sm-8 offset-sm-2"> |
|||
<h1 class="display-3">Add a Yeast</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('yeasts.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="profile">Profile</label> |
|||
<textarea type="text" class="form-control" name="profile" ></textarea> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label for="attenuation">Attenuation</label> |
|||
<input type="text" class="form-control" name="attenuation"> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label for="flocculation">Flocculation</label> |
|||
<input type="text" class="form-control" name="flocculation"> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label for="tolerance">Alcohol Tolerance</label> |
|||
<input type="text" class="form-control" name="tolerance"> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label for="temp_range">Temperature Range °C</label> |
|||
<input type="text" class="form-control" name="temp_range"> |
|||
</div> |
|||
<button type="submit" class="btn btn-primary">Add Yeast</button> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@endsection |
@ -0,0 +1,47 @@ |
|||
@extends('yeasts') |
|||
@section('main') <div class="row"> |
|||
<div class="col-sm-8 offset-sm-2"> |
|||
<h1 class="display-3">Update Yeast</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('yeasts.update', $yeast->id) }}"> |
|||
@method('PATCH') |
|||
@csrf |
|||
<div class="form-group"> |
|||
<label for="name">Name</label> |
|||
<input type="text" class="form-control" name="name" value="{{$yeast->name}}" /> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label for="profile">Profile</label> |
|||
<textarea type="text" class="form-control" name="profile" >{{$yeast->profile}}</textarea> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label for="attenuation">Attenuation</label> |
|||
<input type="text" class="form-control" name="attenuation" value="{{$yeast->attenuation}}" /> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label for="flocculation">Flocculation</label> |
|||
<input type="text" class="form-control" name="flocculation" value="{{$yeast->flocculation}}" /> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label for="tolerance">Alcohol Tolerance</label> |
|||
<input type="text" class="form-control" name="tolerance" value="{{$yeast->tolerance}}" /> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label for="temp_range">Temperature Range °C</label> |
|||
<input type="text" class="form-control" name="temp_range" value="{{$yeast->temp_range}}" /> |
|||
</div> |
|||
<button type="submit" class="btn btn-primary">Update</button> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
@endsection |
@ -0,0 +1,49 @@ |
|||
@extends('yeasts') |
|||
|
|||
@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> -> {{ __('Yeast List') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div> |
|||
|
|||
<div class="card-body"> |
|||
@if (Auth::user()->isAdmin()) |
|||
<a href="{{ route('yeasts.create') }}" class="btn btn-primary">Add Yeast</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">Name</th> |
|||
<th scope="col">Profile</th> |
|||
@if (Auth::user()->isAdmin())<th colspan="2" scope="col">Admin</th>@endif |
|||
</tr> |
|||
</thead> |
|||
|
|||
<tbody> |
|||
@foreach ($yeasts as $yeast) |
|||
<tr> |
|||
<td><a href="/yeast/{{$yeast->id}}">{{$yeast->name}}</a> </td> |
|||
<td>{{str_replace(' ,',',',str_replace('"',' ',str_replace(',',', ',str_replace('}', '', str_replace('{','',$yeast->profile)))))}} </td> |
|||
@if (Auth::user()->isAdmin()) |
|||
<td><a href="{{ route('yeasts.edit',$yeast->id)}}" class="btn btn-primary">Edit</a></td> |
|||
<td><form action="{{ route('yeasts.destroy', $yeast->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