ldc-legaulois/resources/views/bo/ranges/edit.blade.php

94 lines
5.3 KiB
PHP

@extends('layouts.bo')
@section('content')
<div class="card">
<div class="card-header">
Gammes
<a href="{{route('bo.ranges.index')}}" class="btn btn-sm btn-primary float-right ml-2">Retour</a>
<form action="{{route('bo.ranges.destroy', ['range' => $r->id])}}" method="POST" class="d-inline">
@method('DELETE')
@csrf
<input type="submit" class="btn btn-sm btn-danger float-right" value="Supprimer"
onclick="return confirm('Êtes-vous sûr(e) ?')">
</form>
</div>
<div class="card-body">
<form action="{{route('bo.ranges.update', ['range' => $r->id])}}" method="POST" enctype="multipart/form-data">
@method('PUT')
@csrf
<div class="row">
<div class="col-md-8 offset-md-2">
@if (session('success'))
<div class="alert alert-success">
{{ session('success') }}
</div>
@endif
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="form-group">
<input type="text" class="form-control" name="name" placeholder="Nom *" value="{{$r->name}}" required>
</div>
<div class="form-group">
<label>Produit phare *</label>
<select name="flagship_product" class="form-control">
<option value=""></option>
@foreach ($products as $product)
<option value="{{ $product->id }}" @if ($r->flagship_product === $product->id)selected @endif>{{ $product->name }}</option>
@endforeach
</select>
</div>
<div class="form-group">
<input type="text" class="form-control" name="description" placeholder="Description *" value="{{$r->description}}" required>
</div>
<div class="form-group">
<label>Couleur *</label>
<select name="color" class="form-control" required>
<option value="color-1" @if ($r->color === 'color-1')selected @endif>color-1</option>
<option value="color-2" @if ($r->color === 'color-2')selected @endif>color-2</option>
<option value="color-3" @if ($r->color === 'color-3')selected @endif>color-3</option>
<option value="color-4" @if ($r->color === 'color-4')selected @endif>color-4</option>
<option value="color-5" @if ($r->color === 'color-5')selected @endif>color-5</option>
<option value="color-6" @if ($r->color === 'color-6')selected @endif>color-6</option>
<option value="color-7" @if ($r->color === 'color-7')selected @endif>color-7</option>
<option value="color-8" @if ($r->color === 'color-8')selected @endif>color-8</option>
</select>
</div>
<div class="form-group">
<label>Visuel de type JPEG/PNG - 2Mo max. - 640 x 564px</label>
<input type="file" name="picture" accept="image/png, image/jpeg">
<br><br>
<img src="{{ asset($r->picture) }}" style="max-height: 200px;">
</div>
<div class="form-group">
<label>Visuel rectangulaire de type JPEG/PNG - 2Mo max. - 1366 x 563px</label>
<input type="file" name="picture_r" accept="image/png, image/jpeg">
<br><br>
<img src="{{ asset($r->picture_r) }}" style="max-height: 200px;">
</div>
<div class="form-group">
<label>
@if ($r->status === 1)
<input type="checkbox" name="status" value="1" checked>
@else
<input type="checkbox" name="status" value="1">
@endif
Publié ?
</label>
</div>
<div class="form-group text-center">
<input type="submit" class="btn btn-secondary" value="Modifier">
</div>
</div>
</div>
</form>
</div>
</div>
@endsection