jk
3 years ago
6 changed files with 130 additions and 62 deletions
-
35app/Http/Controllers/AdjunctController.php
-
56resources/views/adjuncts.blade.php
-
28resources/views/adjuncts/create.blade.php
-
27resources/views/adjuncts/edit.blade.php
-
41resources/views/adjuncts/index.blade.php
-
5routes/web.php
@ -1,60 +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> -> {{ __('Adjunct 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 Adjunct |
|
||||
</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') |
|
||||
<tbody> |
|
||||
@foreach ($adjuncts as $adjunct) |
|
||||
<tr> |
|
||||
<td><a href="/adjunct/{{$adjunct->id}}">{{$adjunct->name}}</a> </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 Adjunct</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('adjuncts.store')}}" method="post"> |
|
||||
{{csrf_field()}} |
|
||||
<div class="form-group"> |
|
||||
<label for="">Name</label> |
|
||||
<input type="text" class="form-control" name="name"> |
|
||||
</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,28 @@ |
|||||
|
@extends('adjuncts') |
||||
|
|
||||
|
@section('main') |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-8 offset-sm-2"> |
||||
|
<h1 class="display-3">Add an Adjunct</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('adjuncts.store') }}"> |
||||
|
@csrf |
||||
|
<div class="form-group"> |
||||
|
<label for="">Name</label> |
||||
|
<input type="text" class="form-control" name="name"> |
||||
|
</div> |
||||
|
<button type="submit" class="btn btn-primary">Add Adjunct</button> |
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
@endsection |
@ -0,0 +1,27 @@ |
|||||
|
@extends('adjuncts') |
||||
|
@section('main') <div class="row"> |
||||
|
<div class="col-sm-8 offset-sm-2"> |
||||
|
<h1 class="display-3">Update Adjunct</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('adjuncts.update', $adjunct->id) }}"> |
||||
|
@method('PATCH') |
||||
|
@csrf |
||||
|
<div class="form-group"> |
||||
|
<label for="name">Name</label> |
||||
|
<input type="text" class="form-control" name="name" value="{{$adjunct->name}}" /> |
||||
|
</div> |
||||
|
<button type="submit" class="btn btn-primary">Update</button> |
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
@endsection |
@ -0,0 +1,41 @@ |
|||||
|
@extends('adjuncts') |
||||
|
|
||||
|
@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> -> {{ __('Adjunct List') }}<span class="backlink"><a href="{{url()->previous()}}">Go Back</a></span></div> |
||||
|
|
||||
|
<div class="card-body"> |
||||
|
@if (Auth::user()->isAdmin()) |
||||
|
<a href="{{ route('adjuncts.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') |
||||
|
<tbody> |
||||
|
@foreach ($adjuncts as $adjunct) |
||||
|
<tr> |
||||
|
<td><a href="/adjunct/{{$adjunct->id}}">{{$adjunct->name}}</a> </td> |
||||
|
@if (Auth::user()->isAdmin()) |
||||
|
<td><a href="{{ route('adjuncts.edit',$adjunct->id)}}" class="btn btn-primary">Edit</a></td> |
||||
|
<td><form action="{{ route('adjuncts.destroy', $adjunct->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