MyHomeCollection/resources/views/homes/home.blade.php

76 lines
4.3 KiB
PHP

@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<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
<div class="row">
<div class="col-sm-12 mt-4 mb-2">
<p>
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#filters" aria-expanded="false" aria-controls="filters">
Filtrer
</button>
</p>
<div class="collapse" id="filters">
<div class="card card-body">
<form>
<div class="row form-group">
<label class="col-lg-2" for="comment">Commentaire:</label><input type="text" name="filter[comment]" id="comment">
</div>
<div class="row form-group">
<label class="col-lg-2" for="price_min">Min prix:</label><input type="number" name="filter[price_min]" id="price_min">
<label class="col-lg-2" for="price_max">Max prix:</label><input type="number" name="filter[price_max]" id="price_max">
</div>
<div class="row form-group">
<label class="col-lg-2" for="surface_min">Min surface:</label><input type="number" name="filter[surface_min]" id="surface_min">
<label class="col-lg-2" for="surface_max">Max surface:</label><input type="number" name="filter[surface_max]" id="surface_max">
</div>
<div class="row form-group">
<label class="col-lg-2" for="garden_surface_min">Min jardin:</label><input type="number" name="filter[garden_surface_min]" id="garden_surface_min">
<label class="col-lg-2" for="garden_surface_max">Max jardin:</label><input type="number" name="filter[garden_surface_max]" id="garden_surface_max">
</div>
<button class="btn btn-secondary" type="submit">Rechercher</button>
</form>
</div>
</div>
</div>
@if(count($homes) > 0)
@foreach($homes as $home)
<div class="col-sm-4">
<div class="card">
<img class="card-img-top" src="{{ asset($home->pictures[0]) }}">
<div class="card-body">
<h5 class="card-title">
{{ $home->title }}
<small class="badge badge-@if($home->price <= 100000)primary @elseif($home->price <= 200000)success @else()warning @endif">{{ Str::currency($home->price) }}</small>
</h5>
<p class="card-text">{{ $home->excerpt() }}</p>
<a href="{{ route('home.show', ['id' => $home->id]) }}" class="btn btn-primary">Voir la maison</a>
</div>
</div>
</div>
@endforeach
<div class="col-sm-12 mt-4">
{{ $homes->links() }}
</div>
@else
Aucune maison enregistrée :(
@endif
</div>
</div>
</div>
</div>
</div>
</div>
@endsection