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

123 lines
8.0 KiB
PHP

@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">{{ $home->title }}</div>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
<form method="post">
@csrf
<div class="row">
<div class="form-group mx-sm-3 mb-2">
<label for="url" class="sr-only">URL</label>
<input type="text" name="url" class="form-control" id="url" placeholder="URL" value="{{ $home->url }}">
</div>
</div>
<div class="form-group">
<label for="title">Titre</label>
<input type="text" class="form-control" name="title" id="title" value="{{ $home->title }}" readonly>
</div>
<div class="form-group">
<label for="lat">Latitude</label>
<input type="text" name="map[lat]" id="lat" value="{{ $home->map['lat'] }}">
<label for="lng">Longitude</label>
<input type="text" name="map[lng]" id="lng" value="{{ $home->map['lng'] }}">
</div>
<div class="form-group">
<label for="description">Description</label>
<textarea class="form-control" name="description" id="description" rows="6">{{ $home->description }}</textarea>
</div>
<div class="form-group">
<label for="comment">Mon commentaire</label>
<textarea class="form-control" name="comment" id="comment" rows="3">{{ $home->comment }}</textarea>
</div>
<div class="form-group" id="photo-wrapper"></div>
<div class="row">
<div class="col-lg-4">
<div class="form-group">
<label for="city">Ville</label>
<input type="text" class="form-control" name="city" id="city" value="{{ $home->city }}">
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label for="price">Prix</label>
<input type="number" class="form-control" name="price" id="price" value="{{ $home->price }}">
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label for="surface">Surface</label>
<input type="number" class="form-control" id="surface" name="surface" value="{{ $home->surface }}">
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label for="garden_surface">Surface de jardin</label>
<input type="number" class="form-control" id="garden_surface" name="garden_surface" value="{{ $home->garden_surface }}">
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label for="rooms">Nombre de pièces</label>
<input type="number" class="form-control" id="rooms" name="rooms" value="{{ $home->rooms }}">
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label for="energy">Énergie</label>
<select class="form-control" id="energy" name="energy">
<option @if($home->energy === "A") selected @endif>A</option>
<option @if($home->energy === "B") selected @endif>B</option>
<option @if($home->energy === "C") selected @endif>C</option>
<option @if($home->energy === "D") selected @endif>D</option>
<option @if($home->energy === "E") selected @endif>E</option>
<option @if($home->energy === "F") selected @endif>F</option>
<option @if($home->energy === "G") selected @endif>G</option>
</select>
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label for="ges">GES</label>
<select class="form-control" id="ges" name="ges">
<option @if($home->ges === "A") selected @endif>A</option>
<option @if($home->ges === "B") selected @endif>B</option>
<option @if($home->ges === "C") selected @endif>C</option>
<option @if($home->ges === "D") selected @endif>D</option>
<option @if($home->ges === "E") selected @endif>E</option>
<option @if($home->ges === "F") selected @endif>F</option>
<option @if($home->ges === "G") selected @endif>G</option>
</select>
</div>
</div>
<div class="col-lg-4">
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="slug" id="slug-non" value="" @if(empty($home->slug)) checked @endif>
<label class="form-check-label" for="slug-non">Non</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="slug" id="slug-oui" @if(!empty($home->slug)) checked @endif value="@if(!empty($home->slug)) {{ $home->slug }} @else {{ \Illuminate\Support\Str::uuid() }} @endif">
<label class="form-check-label" for="slug-oui">Oui</label>
</div>
</div>
<div class="col-lg-4">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection