Add SlidesController

This commit is contained in:
Sebastien Hattry 2021-12-06 16:27:44 +01:00
parent 8837dd4f58
commit 400ebc164b
22 changed files with 224 additions and 238 deletions

View file

@ -6,8 +6,6 @@ use App\Http\Controllers\Controller;
use App\Http\Requests\StoreSlideRequest;
use App\Models\Slide;
use App\Models\Slider;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
class SlidesController extends Controller
@ -28,17 +26,15 @@ class SlidesController extends Controller
*
* @return \Illuminate\Http\Response
*/
public function create()
public function create(Slide $slide)
{
$sliders = Slider::all();
return view('back.slides.create', compact('sliders'));
return view('back.slides.create', compact('sliders', 'slide'));
}
/**
* Store a newly created resource in storage.
*
* @todo : validation des dates
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
@ -77,9 +73,8 @@ class SlidesController extends Controller
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
public function edit(Slide $slide)
{
$slide = Slide::findOrFail($id);
$sliders = Slider::all();
return view('back.slides.edit', compact('slide', 'sliders'));
}
@ -91,13 +86,11 @@ class SlidesController extends Controller
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(StoreSlideRequest $request, $id)
public function update(StoreSlideRequest $request, Slide $slide)
{
$picture = $request->picture;
// $request->validated()
$slide = Slide::findOrFail($id);
// $slide->save();
$slide->fill($request->validated());
if ($picture !== null) {
if (file_exists(public_path() . 'images/slides/' . $slide->picture)) {
@ -107,47 +100,47 @@ class SlidesController extends Controller
$picture->move(public_path('images/slides'), $imageName);
$slide->picture = $imageName;
}
$slide->save();
return redirect()->route('bo.slides.edit', $slide->id)->with('success', 'Modifications enregistrées !');
if (!$slide->saveOrFail()) {
return redirect()->route('bo.slides.edit', $slide->id)->with('error', trans('La modification a échoué'));
}
return redirect()->route('bo.slides.edit', $slide->id)->with('success', trans('Modifications enregistrées !'));
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @param Slide $slide
* @return \Illuminate\Http\Response
*/
public function destroy($id)
public function destroy(Slide $slide)
{
$s = Slide::findOrFail($id);
if (!$slide->delete()) {
return redirect()->route('bo.slides.index')->with('error', trans('La suppression a échoué'));
}
$s->delete();
return redirect()->route('bo.slides.index');
return redirect()->route('bo.slides.index')->with('success', trans('Suppression faite avec succès'));
}
public function changeOrder($id, $action)
public function changeOrder(Slide $slide, $action)
{
$current = Slide::findOrFail($id);
if ($action === 'up') {
$tmp = Slide::where('order', '<', $current->order)->orderBy('order', 'DESC')->first();
$tmp = Slide::where('order', '<', $slide->order)->orderBy('order', 'DESC')->first();
$newOrder = $tmp->order;
$tmp->order = $current->order;
$current->order = $newOrder;
$tmp->order = $slide->order;
$slide->order = $newOrder;
} else {
$tmp = Slide::where('order', '>', $current->order)->orderBy('order', 'ASC')->first();
$tmp = Slide::where('order', '>', $slide->order)->orderBy('order', 'ASC')->first();
$newOrder = $tmp->order;
$tmp->order = $current->order;
$current->order = $newOrder;
$tmp->order = $slide->order;
$slide->order = $newOrder;
}
$tmp->save();
$current->save();
$slide->save();
return back();
//return redirect()->route('back.slides.index');
}
/**

View file

@ -5,7 +5,6 @@ namespace App\Http\Requests;
use Carbon\Exceptions\InvalidFormatException;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Carbon;
use Illuminate\Validation\Rule;
class StoreSlideRequest extends FormRequest
{

36
package-lock.json generated
View file

@ -11,7 +11,7 @@
},
"devDependencies": {
"axios": "^0.21",
"bootstrap": "^4.6.0",
"bootstrap": "^5.1.3",
"clean-webpack-plugin": "^3.0.0",
"jquery": "^3.6",
"laravel-mix": "^6.0.6",
@ -1757,6 +1757,17 @@
"node": ">= 8"
}
},
"node_modules/@popperjs/core": {
"version": "2.11.0",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.0.tgz",
"integrity": "sha512-zrsUxjLOKAzdewIDRWy9nsV1GQsKBCWaGwsZQlCgr6/q+vjyZhFgqedLfFBuI9anTPEUT4APq9Mu0SZBTzIcGQ==",
"dev": true,
"peer": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/popperjs"
}
},
"node_modules/@trysound/sax": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz",
@ -2702,17 +2713,17 @@
"dev": true
},
"node_modules/bootstrap": {
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.6.1.tgz",
"integrity": "sha512-0dj+VgI9Ecom+rvvpNZ4MUZJz8dcX7WCX+eTID9+/8HgOkv3dsRzi8BGeZJCQU6flWQVYxwTQnEZFrmJSEO7og==",
"version": "5.1.3",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.1.3.tgz",
"integrity": "sha512-fcQztozJ8jToQWXxVuEyXWW+dSo8AiXWKwiSSrKWsRB/Qt+Ewwza+JWoLKiTuQLaEPhdNAJ7+Dosc9DOIqNy7Q==",
"dev": true,
"license": "MIT",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/bootstrap"
},
"peerDependencies": {
"jquery": "1.9.1 - 3",
"popper.js": "^1.16.1"
"@popperjs/core": "^2.10.2"
}
},
"node_modules/brace-expansion": {
@ -10822,6 +10833,13 @@
"fastq": "^1.6.0"
}
},
"@popperjs/core": {
"version": "2.11.0",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.0.tgz",
"integrity": "sha512-zrsUxjLOKAzdewIDRWy9nsV1GQsKBCWaGwsZQlCgr6/q+vjyZhFgqedLfFBuI9anTPEUT4APq9Mu0SZBTzIcGQ==",
"dev": true,
"peer": true
},
"@trysound/sax": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz",
@ -11645,9 +11663,9 @@
"dev": true
},
"bootstrap": {
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.6.1.tgz",
"integrity": "sha512-0dj+VgI9Ecom+rvvpNZ4MUZJz8dcX7WCX+eTID9+/8HgOkv3dsRzi8BGeZJCQU6flWQVYxwTQnEZFrmJSEO7og==",
"version": "5.1.3",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.1.3.tgz",
"integrity": "sha512-fcQztozJ8jToQWXxVuEyXWW+dSo8AiXWKwiSSrKWsRB/Qt+Ewwza+JWoLKiTuQLaEPhdNAJ7+Dosc9DOIqNy7Q==",
"dev": true,
"requires": {}
},

View file

@ -11,7 +11,7 @@
},
"devDependencies": {
"axios": "^0.21",
"bootstrap": "^4.6.0",
"bootstrap": "^5.1.3",
"clean-webpack-plugin": "^3.0.0",
"jquery": "^3.6",
"laravel-mix": "^6.0.6",

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

View file

@ -0,0 +1,5 @@
@if($errors->has($inputName))
<div class="col-12">
<small class="text-danger">{{ implode(',', $errors->get($inputName)) }}</small>
</div>
@endif

View file

@ -0,0 +1,46 @@
@if ($message = Session::get('success'))
<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong>{!! nl2br(e($message)) !!}</strong>
<button type="button" class="close" data-dismiss="alert" aria-label="{{ __('Fermer') }}">
<span aria-hidden="true">&times;</span>
</button>
</div>
@endif
@if ($message = Session::get('error'))
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<strong>{!! nl2br(e($message)) !!}</strong>
<button type="button" class="close" data-dismiss="alert" aria-label="{{ __('Fermer') }}">
<span aria-hidden="true">&times;</span>
</button>
</div>
@endif
@if ($message = Session::get('warning'))
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<strong>{!! nl2br(e($message)) !!}</strong>
<button type="button" class="close" data-dismiss="alert" aria-label="{{ __('Fermer') }}">
<span aria-hidden="true">&times;</span>
</button>
</div>
@endif
@if ($message = Session::get('info'))
<div class="alert alert-info alert-dismissible fade show" role="alert">
<strong>{!! nl2br(e($message)) !!}</strong>
<button type="button" class="close" data-dismiss="alert" aria-label="{{ __('Fermer') }}">
<span aria-hidden="true">&times;</span>
</button>
</div>
@endif
@if ($errors->any())
<div class="alert alert-danger alert-dismissible fade show" role="alert">
@if ($errors->any())
<ul class="list-unstyled">
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
@endif
<button type="button" class="close" data-dismiss="alert" aria-label="{{ __('Fermer') }}">
<span aria-hidden="true">&times;</span>
</button>
</div>
@endif

View file

@ -5,9 +5,9 @@
@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> Sliders <small class="text-muted">Création</small></h1>
< </a> {{ __('Sliders') }} <small class="text-muted">{{ __('Création') }}</small></h1>
<div class="btn-toolbar mb-2 mb-md-0">
<button type="submit" class="btn btn-sm btn-primary">Enregistrer</a>
<button type="submit" class="btn btn-sm btn-primary">{{ __('Enregistrer') }}</a>
</div>
</div>
@if ($errors->any())
@ -21,17 +21,17 @@
@endif
<div class="form-group">
<label for="name">Label *</label>
<input type="text" id="label" name="label" class="form-control" placeholder="Label * " value="{{ old('label') }}" required>
<label for="name">{{ __('Label') }} *</label>
<input type="text" id="label" name="label" class="form-control" placeholder="{{ __('Label') }} * " value="{{ old('label') }}" required>
</div>
<div class="form-group">
<label for="name">Slug</label>
<input type="text" id="slug" name="slug" class="form-control" placeholder="Slug" value="{{ old('slug') }}">
<small class="text-muted"> laisser vide pour une génération automatique </small>
<label for="name">{{ __('Slug') }}</label>
<input type="text" id="slug" name="slug" class="form-control" placeholder="{{ __('Slug') }}" value="{{ old('slug') }}">
<small class="text-muted"> {{ __('laisser vide pour une génération automatique') }} </small>
</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') }}">
<label for="name">{{ __('Commentaire') }}</label>
<input type="text" id="commentaire" name="commentaire" class="form-control" placeholder="{{ __('Commentaire') }}" value="{{ old('commentaire') }}">
</div>
</form>
@endsection

View file

@ -5,81 +5,13 @@
@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.slides.index')}}" class="h2 text-decoration-none">
< </a> Slides <small class="text-muted">Création</small></h1>
< </a> {{ __('Slides') }} <small class="text-muted">{{ __('Création') }}</small></h1>
<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="form-group">
<label for="name">Titre *</label>
<input type="text" id="title" name="title" class="form-control" placeholder="Titre * " value="{{ old('title') }}" required>
</div>
<div class="form-group">
<label for="name">Texte</label>
<textarea class="form-control" id="text" name="text" placeholder="Texte">{{ old('text') }}</textarea>
</div>
<div class="form-group">
<label for="picture">Image <small class="text-muted">- JPEG/PNG, 2Mo max. Dimensions {{ Config::get('theme.slide_image_maxwidth') }} px par {{ Config::get('theme.slide_image_maxheight') }} px</small></label></br>
<input type="file" id="picture" name="picture" accept="image/png, image/jpeg">
</div>
<div class="form-row">
<div class="form-group col">
<label for="slider_id">Slider de regroupement</label>
<select class="custom-select" id="slider_id" name="slider_id">
@foreach($sliders as $slider)
<option value="{{$slider->id}}">{{$slider->label}}</option>
@endforeach
</select>
</div>
<div class="form-group col"></div>
<div class="form-group col"></div>
<div class="form-group col"></div>
</div>
<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">Période de parution</small></h2>
</div>
<div class="form-row">
<div class="form-group col">
<label for="date_start_date">Début <small class="text-muted"> de l'affichage</small></label>
<input type="date" id="date_start_date" name="date_start_date" class="form-control" value="{{ old('date_start_date') }}">
<input type="time" id="date_start_time" name="date_start_time" class="form-control" value="{{ old('date_start_time') }}">
<small class="text-muted">Laisser vide pour un affichage immédiat</small>
</div>
<div class="form-group col">
<label for="date_end_date">Fin <small class="text-muted"> de l'affichage' </small></label>
<input type="date" id="date_end_date" name="date_end_date" class="form-control" value="{{ old('date_end_date') }}">
<input type="time" id="date_end_time" name="date_end_time" class="form-control" value="{{ old('date_end_time') }}">
<small class="text-muted">Laisser vide pour un affichage permanent</small>
<button type="submit" class="btn btn-sm btn-primary">{{ __('Enregistrer') }}</a>
</div>
</div>
<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">Options de lien</small></h2>
</div>
<div class="form-group">
<label for="name">Texte du lien</label>
<input type="text" class="form-control" name="link_label" placeholder="Texte du lien" value="{{ old('link_label') }}">
</div>
<div class="form-group">
<label for="name">Cible du lien</label>
<input type="text" class="form-control" name="link" placeholder="Cible du Lien" value="{{ old('link') }}">
</div>
<div class="form-group text-center">
<input class="form-check-input" type="checkbox" id="new_tab_cb" name="link_new_tab" @if (old('link_new_tab') !==null)checked @endif>
<label class="form-check-label" for="new_tab_cb">Ouvrir dans un nouvel onglet</label>
</div>
@include('back.slides.form-inputs')
</form>
@endsection

View file

@ -6,99 +6,13 @@
@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.slides.index')}}" class="h2 text-decoration-none">
< </a> Slides <small class="text-muted">Création</small></h1>
@if (session('success'))
<span class="float-center text-success">{{ session('success') }}</span>
@endif
< </a> {{ __('Slides') }} <small class="text-muted">{{ __('Création') }}</small></h1>
<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="form-group">
<label for="name">Titre *</label>
<input type="text" id="title" name="title" class="form-control" placeholder="Titre * " value="{{ old('title', $slide->title) }}" required>
</div>
<div class="form-group">
<label for="name">Texte</label>
<textarea class="form-control" id="text" name="text" placeholder="Texte">{{ old('text', $slide->text) }}</textarea>
</div>
<div class="form-group">
<label for="picture">Image <small class="text-muted">- JPEG/PNG, 2Mo max. Dimensions {{ Config::get('theme.slide_image_maxwidth') }} px par {{ Config::get('theme.slide_image_maxheight') }} px</small></label></br>
<input type="file" id="picture" name="picture" accept="image/png, image/jpeg">
@if ($slide->picture !== null)
<br />
<br />
<img src="/images/slides/{{$slide->picture}}" alt="{{$slide->title}}" style="max-height: 100px;">
@endif
</div>
<div class="form-row">
<div class="form-group col">
<label for="slider_id">Slider de regroupement</label>
<select class="custom-select" id="slider_id" name="slider_id">
@foreach($sliders as $slider)
<option value="{{$slider->id}}" @if ($slider->id === $slide->slider_id) selected @endif>{{$slider->label}}</option>
@endforeach
</select>
</div>
<div class="form-group col"></div>
<div class="form-group col"></div>
<div class="form-group col"></div>
</div>
<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">Période de parution</small></h2>
</div>
<div class="form-row">
<div class="form-group col">
<label for="date_start_date">Début <small class="text-muted"> de l'affichage</small></label>
@if($slide->date_start !== null)
<input type="date" id="date_start_date" name="date_start_date" class="form-control" value="{{ old('date_start_date', date_format($slide->date_start, "Y-m-d")) }}">
<input type="time" id="date_start_time" name="date_start_time" class="form-control" value="{{ old('date_start_time', date_format($slide->date_start, "H:i")) }}">
@else
<input type="date" id="date_start_date" name="date_start_date" class="form-control" value="{{ old('date_start_date') }}">
<input type="time" id="date_start_time" name="date_start_time" class="form-control" value="{{ old('date_start_time') }}">
@endif
<small class="text-muted">Laisser vide pour un affichage immédiat</small>
</div>
<div class="form-group col">
<label for="date_end_date">Fin <small class="text-muted"> de l'affichage' </small></label>
@if($slide->date_end !== null)
<input type="date" id="date_end_date" name="date_end_date" class="form-control" value="{{ old('date_end_date', date_format($slide->date_end, "Y-m-d")) }}">
<input type="time" id="date_end_time" name="date_end_time" class="form-control" value="{{ old('date_end_time', date_format($slide->date_end, "H:i")) }}">
@else
<input type="date" id="date_end_date" name="date_end_date" class="form-control" value="{{ old('date_end_date') }}">
<input type="time" id="date_end_time" name="date_end_time" class="form-control" value="{{ old('date_end_time') }}">
@endif
<small class="text-muted">Laisser vide pour un affichage permanent</small>
<button type="submit" class="btn btn-sm btn-primary">{{ __('Enregistrer') }}</a>
</div>
</div>
<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">Options de lien</small></h2>
</div>
<div class="form-group">
<label for="name">Texte du lien</label>
<input type="text" class="form-control" name="link_label" placeholder="Texte du lien" value="{{ old('link_label', $slide->link_label) }}">
</div>
<div class="form-group">
<label for="name">Cible du lien</label>
<input type="text" class="form-control" name="link" placeholder="Cible du Lien" value="{{ old('link', $slide->link) }}">
</div>
<div class="form-group text-center">
<input class="form-check-input" type="checkbox" id="new_tab_cb" name="link_new_tab" @if (old('link_new_tab', $slide->link_new_tab) !== 0)checked @endif>
<label class="form-check-label" for="new_tab_cb">Ouvrir dans un nouvel onglet</label>
</div>
@include('back.slides.form-inputs')
</form>
@endsection

View file

@ -0,0 +1,76 @@
<div class="form-group">
<label for="name">{{ __('Titre') }} *</label>
<input type="text" id="title" name="title" class="form-control" placeholder="{{ __('Titre') }} *" value="{{ old('title', $slide->title ?? '') }}" required>
@include('back.modules.input-error', ['inputName'=>'title'])
</div>
<div class="form-group">
<label for="name">{{ __('Texte') }}</label>
<textarea class="form-control" id="text" name="text" placeholder="{{ __('Texte') }}">{{ old('text', $slide->text) }}</textarea>
</div>
<div class="form-group">
<label for="picture">{{ __('Image') }} <small class="text-muted">- JPEG/PNG, 2Mo max. Dimensions {{ Config::get('theme.slide_image_maxwidth') }} px par {{ Config::get('theme.slide_image_maxheight') }} px</small></label></br>
<input type="file" id="picture" name="picture" accept="image/png, image/jpeg">
@if ($slide->picture !== null)
<br />
<br />
<img src="/images/slides/{{$slide->picture}}" alt="{{$slide->title}}" style="max-height: 100px;">
@endif
</div>
<div class="form-row">
<div class="form-group col">
<label for="slider_id">{{ __('Slider de regroupement') }}</label>
<select class="custom-select" id="slider_id" name="slider_id">
@foreach($sliders as $slider)
<option value="{{$slider->id}}" @if ($slider->id === $slide->slider_id) selected @endif>{{$slider->label}}</option>
@endforeach
</select>
</div>
<div class="form-group col"></div>
<div class="form-group col"></div>
<div class="form-group col"></div>
</div>
<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">{{ __('Période de parution') }}</small></h2>
</div>
<div class="form-row">
<div class="form-group col">
<label for="date_start_date">{{ __('Début') }} <small class="text-muted">{{ __('de l\'affichage') }}</small></label>
@if($slide->date_start !== null)
<input type="date" id="date_start_date" name="date_start_date" class="form-control" value="{{ old('date_start_date', date_format($slide->date_start, "Y-m-d")) }}">
<input type="time" id="date_start_time" name="date_start_time" class="form-control" value="{{ old('date_start_time', date_format($slide->date_start, "H:i")) }}">
@else
<input type="date" id="date_start_date" name="date_start_date" class="form-control" value="{{ old('date_start_date') }}">
<input type="time" id="date_start_time" name="date_start_time" class="form-control" value="{{ old('date_start_time') }}">
@endif
<small class="text-muted">{{ __('Laisser vide pour un affichage immédiat') }}</small>
</div>
<div class="form-group col">
<label for="date_end_date">{{ __('Fin') }} <small class="text-muted">{{ __('de l\'affichage') }}</small></label>
@if($slide->date_end !== null)
<input type="date" id="date_end_date" name="date_end_date" class="form-control" value="{{ old('date_end_date', date_format($slide->date_end, "Y-m-d")) }}">
<input type="time" id="date_end_time" name="date_end_time" class="form-control" value="{{ old('date_end_time', date_format($slide->date_end, "H:i")) }}">
@else
<input type="date" id="date_end_date" name="date_end_date" class="form-control" value="{{ old('date_end_date') }}">
<input type="time" id="date_end_time" name="date_end_time" class="form-control" value="{{ old('date_end_time') }}">
@endif
<small class="text-muted">{{ __('Laisser vide pour un affichage permanent') }}</small>
</div>
</div>
<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">{{ __('Options de lien') }}</small></h2>
</div>
<div class="form-group">
<label for="name">{{ __('Texte du lien') }}</label>
<input type="text" class="form-control" name="link_label" placeholder="{{ __('Texte du lien') }}" value="{{ old('link_label', $slide->link_label) }}">
</div>
<div class="form-group">
<label for="name">{{ __('Cible du lien') }}</label>
<input type="text" class="form-control" name="link" placeholder="{{ __('Cible du lien') }}" value="{{ old('link', $slide->link) }}">
</div>
<div class="form-group text-center">
<input class="form-check-input" type="checkbox" id="new_tab_cb" name="link_new_tab" @if (old('link_new_tab', $slide->link_new_tab) !== 0)checked @endif>
<label class="form-check-label" for="new_tab_cb">{{ __('Ouvrir dans un nouvel onglet') }}</label>
</div>

View file

@ -2,26 +2,26 @@
@section('content')
<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">Slides <small class="text-muted">Liste</small></h1>
<h1 class="h2">{{ __('Slides') }} <small class="text-muted">{{ __('Liste') }}</small></h1>
@if ($errors->any())
@foreach($errors->all() as $error)
<span class="float-center text-danger">{{ $error }}</span>
@endforeach
@endif
<a href="{{route('bo.slides.create')}}" class="btn btn-primary float-right">Créer un slide</a>
<a href="{{route('bo.slides.create')}}" class="btn btn-primary float-right">{{ __('Créer un slide') }}</a>
</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">{{ __('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>
@ -37,24 +37,24 @@
<td><a href="{{route('bo.sliders.edit', $slide->slider->id) }}">{{$slide->slider->label}}</a></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 href="{{route('bo.slides.change-order', ['slide' => $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', ['slide' => $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', ['slide' => $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>
@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
<a href="{{route('bo.slides.change-order', ['slide' => $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>
<a href="{{route('bo.slides.edit', ['slide' => $slide->id])}}" class="btn btn-sm btn-primary">{{ __('Éditer') }}</a>
<form action="{{route('bo.slides.destroy', $slide->id)}}" method="POST" class="d-inline">
@method('DELETE')
@csrf

View file

@ -5,7 +5,7 @@
@section('content')
<section class="jumbotron">
<p class="maintitle ttu animate__animated fadeIn animate__slow">Qui sommes-nous ?</p>
<p class="maintitle ttu animate__animated fadeIn animate__slow">{{ __('Qui sommes-nous')}} ?</p>
<img class="img-zoom" src="{{ asset('assets/images/a-propos.jpg') }}" alt="A propos de nous">
<div class="banner">
<svg id="Calque_1" data-name="Calque 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1919.76 59.99">

View file

@ -11,6 +11,9 @@
<div id="app">
@include('layouts.backend.navbar')
<div class="container-fluid">
<div class="row">
@include('back.modules.message')
</div>
<div class="row">
{{-- @if(isset($modelsClasses)) --}}
@auth

View file

@ -69,7 +69,7 @@ Route::prefix('bo')
]
);
Route::get(
'/slide/change-order/{id}/{action}',
'/slide/change-order/{slide}/{action}',
[
SlidesController::class,
'changeOrder'