ldc-boutique-cnc/resources/views/bo/sliders/edit.blade.php
2022-03-24 20:59:26 +01:00

90 lines
4.1 KiB
PHP

@extends('layouts.bo-layout')
@section('content')
<form action="{{ route('bo.sliders.update', $slider->id) }}" method="POST" enctype="multipart/form-data">
@method('PUT')
@csrf
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2"><a href="{{route('bo.sliders.index')}}" class="h2 text-decoration-none"><</a> Slider <small class="text-muted">Edition</small></h1>
@if (session('success'))
<span class="float-center text-success">{{ session('success') }}</span>
@endif
<div class="btn-toolbar mb-2 mb-md-0">
<button type="submit" class="btn btn-sm btn-primary">Enregistrer</a>
</div>
</div>
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="row">
<div class="form-group col">
<label for="name">Label *</label>
<input type="text" id="label" name="label" class="form-control" placeholder="Label * " value="{{ old('label',$slider->label) }}" required>
</div>
<div class="form-group col">
<label for="name">Slug</label>
<input type="text" id="slug" name="slug" class="form-control" placeholder="Slug" value="{{ old('slug',$slider->slug) }}" required>
</div>
</div>
<div class="form-group">
<label for="name">Commentaire</label>
<input type="text" id="commentaire" name="commentaire" class="form-control" placeholder="Commentaire" value="{{ old('commentaire',$slider->commentaire) }}">
</div>
</form>
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h2><small class="text-muted">Slides</small></h2>
</div>
<table class="table">
<thead class="thead-dark">
<tr>
<th scope="col">Titre</th>
<th scope="col">Texte</th>
<th scope="col">Image</th>
<th scope="col">Lien</th>
<th scope="col">Début</th>
<th scope="col">Fin</th>
<th scope="col">Slider de regroupement</th>
<th scope="col">Ordre</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@foreach($slider->slides as $slide)
<tr>
<td>{{$slide->title}}</td>
<td>{!! $slide->text !!}</td>
<td><img src="{{ asset('/images/slides/' . $slide->picture) }}" height="50px"></td>
<td><a href="{{$slide->link}}" target="_slide">{{ $slide->link_label }}</a></td>
<td>{{$slide->date_start}}</td>
<td>{{$slide->date_end}}</td>
<td>{{$slide->slider->label}}</td>
<td>
@if ($loop->first)
<a href="{{route('bo.slides.change-order', ['id' => $slide->id, 'action' => 'down'])}}" class="btn-link text-decoration-none">
<i name="down_arrow" class="icon-size far fa-arrow-alt-circle-down fa-2x"></i>
</a>
@elseif($loop->last)
<a href="{{route('bo.slides.change-order', ['id' => $slide->id, 'action' => 'up'])}}" class="btn-link text-decoration-none">
<i name="up_arrow" class="icon-size far fa-arrow-alt-circle-up fa-2x"></i>
</a>
@else
<a href="{{route('bo.slides.change-order', ['id' => $slide->id, 'action' => 'up'])}}" class="btn-link text-decoration-none">
<i name="up_arrow" class="icon-size far fa-arrow-alt-circle-up fa-2x"></i>
</a>
<a href="{{route('bo.slides.change-order', ['id' => $slide->id, 'action' => 'down'])}}" class="btn-link text-decoration-none">
<i name="down_arrow" class="icon-size far fa-arrow-alt-circle-down fa-2x"></i>
</a>
@endif
</td>
<td><a href="{{route('bo.slides.edit', ['slide' => $slide->id])}}" class="btn btn-sm btn-primary">Éditer</a></td>
</tr>
@endforeach
</tbody>
</table>
@endsection