shareit/resources/views/home.blade.php
Bruno Fontes 8ae1e92a63 Refreshing and Including number of used items on Title
It was necessary to keep refreshing the page to
check if an item was returned when we did not
want to be alerted. So, now, the page refresh
itself every 2 minutes (while I do not know how
to use Laravel broadcasting) and the title shows
the number of items in use (including when used
by you).
2018-10-16 15:15:05 -03:00

52 lines
1.9 KiB
PHP

@extends('layouts.app')
@section('content')
<script type="text/javascript">
setInterval(function() {
window.location.reload(true);
}, 2*60000); //NOTE: period is passed in milliseconds
</script>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
@forelse ($products as $items)
<div class="card mb-4">
<div class="card-header">{{$items->first()->product->name}}</div>
<div class="card-body">
@forelse ($items->sortBy('name', SORT_NATURAL | SORT_FLAG_CASE) as $item)
@if (!$loop->first)
<hr class="m-3">
@endif
<div class="row align-items-center p-2">
<div class="col col-xs-auto">
@if ($item->product->url)
<a href="{{$item->product->url}}" class="link-unstyled" target="_blank" rel="noopener noreferrer">
@endif
<strong>{{$item->name}}</strong>
@if ($item->product->url)
</a>
@endif
</div>
<div class="ml-auto align-self-end text-right">
@if ($item->used_by)
@include('home.usedItem')
@else
@include('home.unusedItem')
@endif
</div>
</div>
@empty
@endforelse
</div>
</div>
@empty
<p>@lang('home.no_messages') <a href="/product">@lang('home.share_item')</a></p>
@endforelse
</div>
</div>
</div>
@endsection