2018-09-09 04:03:41 +00:00
|
|
|
@extends('layouts.app')
|
|
|
|
|
|
|
|
@section('content')
|
|
|
|
<div class="container">
|
|
|
|
<div class="row justify-content-center">
|
|
|
|
<div class="col-md-8">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-header">Dashboard</div>
|
|
|
|
|
|
|
|
<div class="card-body">
|
|
|
|
@if (session('status'))
|
|
|
|
<div class="alert alert-success" role="alert">
|
|
|
|
{{ session('status') }}
|
|
|
|
</div>
|
|
|
|
@endif
|
|
|
|
|
2018-09-10 04:23:32 +00:00
|
|
|
<h4>Your itens</h4>
|
|
|
|
@forelse ($items as $item)
|
2018-09-13 00:25:48 +00:00
|
|
|
<hr class="ml-5 mr-5">
|
|
|
|
<li class="mt-1 mb-1">
|
|
|
|
<strong>{{$item->name}}</strong> ({{$item->product->name}})
|
2018-09-12 21:24:56 +00:00
|
|
|
|
|
|
|
@if ($item->usedBy)
|
|
|
|
@if ($item->usedBy == \Auth::id())
|
|
|
|
<span class="float-right">
|
2018-09-13 00:25:48 +00:00
|
|
|
<form action="/return" method="POST">
|
|
|
|
{{ csrf_field() }}
|
|
|
|
<input type="hidden" name="item" value="{{$item->id}}">
|
|
|
|
<button type="submit" class="btn-xm btn-danger">Return It</button>
|
2018-09-12 21:24:56 +00:00
|
|
|
</form>
|
|
|
|
</span>
|
2018-09-13 00:25:48 +00:00
|
|
|
<span class="float-right mr-3"><em>{{\Carbon\Carbon::parse($item->updated_at)->diffForHumans()}}</em></span>
|
2018-09-12 21:24:56 +00:00
|
|
|
@else
|
2018-09-13 00:25:48 +00:00
|
|
|
<div class="alert alert-danger" role="alert">In use by {{$item->usedBy}}, since {{$item->updated_at->diffForHumans()}}</div>
|
2018-09-12 21:24:56 +00:00
|
|
|
@endif
|
2018-09-11 23:48:09 +00:00
|
|
|
@else
|
2018-09-12 21:24:56 +00:00
|
|
|
<span class="float-right">
|
2018-09-13 00:25:48 +00:00
|
|
|
<form action="/take" method="POST">
|
|
|
|
{{ csrf_field() }}
|
|
|
|
<input type="hidden" name="item" value="{{$item->id}}">
|
|
|
|
<button type="submit" class="btn-xm btn-success">Take It</button>
|
2018-09-12 21:24:56 +00:00
|
|
|
</form>
|
|
|
|
</span>
|
2018-09-11 23:48:09 +00:00
|
|
|
@endif
|
|
|
|
</li>
|
2018-09-10 04:23:32 +00:00
|
|
|
@empty
|
2018-09-11 23:48:09 +00:00
|
|
|
<p>There are no items for you yet. Include a product or an item <a href="/product">here.</a></p>
|
2018-09-10 04:23:32 +00:00
|
|
|
@endforelse
|
2018-09-09 04:03:41 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@endsection
|