Merge branch 'crud-explorerpage' into '2.0.0'
Crud explorerpage See merge request ldc-web/projets/agis!10
This commit is contained in:
commit
3e64820fb8
16 changed files with 615 additions and 21 deletions
95
app/Http/Controllers/Bo/ExplorerpageController.php
Normal file
95
app/Http/Controllers/Bo/ExplorerpageController.php
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Bo\Explorerpage\UpdateExplorerpageRequest;
|
||||
use App\Models\Explorerpage;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ExplorerpageController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create the controller instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->authorizeResource(Explorerpage::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index(Request $request): \Illuminate\Contracts\View\View
|
||||
{
|
||||
/** @var \Illuminate\Database\Eloquent\Builder $explorerpageModels */
|
||||
$explorerpageModels = Explorerpage::query();
|
||||
|
||||
/** @var string $search Search field */
|
||||
$search = $request->search;
|
||||
if ($search) {
|
||||
$this->searchQuery(
|
||||
$explorerpageModels,
|
||||
$search,
|
||||
null,
|
||||
'picture_1_title',
|
||||
'picture_2_title',
|
||||
'picture_3_title'
|
||||
);
|
||||
}
|
||||
$searchFields = \implode(', ', [
|
||||
Str::ucfirst(trans('validation.attributes.title'))
|
||||
]);
|
||||
|
||||
/** Sort columns with a query */
|
||||
$this->sortQuery($explorerpageModels);
|
||||
|
||||
/** Custom pagination */
|
||||
$explorerpageModels = $this->paginate($explorerpageModels);
|
||||
|
||||
return view('bo.pages.explorerpages.index', compact('explorerpageModels', 'search', 'searchFields'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param App\Models\Explorerpage $explorerpage
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit(Explorerpage $explorerpage): \Illuminate\Contracts\View\View
|
||||
{
|
||||
return view('bo.pages.explorerpages.edit', ['explorerpageModel' => $explorerpage]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\Bo\Explorerpages\UpdateExplorerpageRequest $request
|
||||
* @param \App\Models\Explorerpage $explorerpage
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(
|
||||
UpdateExplorerpageRequest $request,
|
||||
Explorerpage $explorerpage
|
||||
): \Illuminate\Http\RedirectResponse {
|
||||
return DB::transaction(function () use ($request, $explorerpage) {
|
||||
$explorerpage->fill($request->validated());
|
||||
|
||||
if ($explorerpage->saveOrFail()) {
|
||||
return redirect()->route('bo.explorerpages.edit', $explorerpage)
|
||||
->with('success', __('crud.messages.has_been_updated', [
|
||||
'model' => Str::ucfirst(__('models.classes.explorerpage'))
|
||||
]));
|
||||
}
|
||||
return redirect()->route('bo.explorerpages.edit', $explorerpage)
|
||||
->with('error', __('crud.messages.cannot_be_updated', [
|
||||
'model' => Str::ucfirst(__('models.classes.explorerpage'))
|
||||
]));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Bo\Explorerpage;
|
||||
|
||||
use App\Traits\Requests\HasPicture;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreExplorerpageRequest extends FormRequest
|
||||
{
|
||||
use HasPicture;
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return auth('backend')->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
$this->mergePicture('picture_1');
|
||||
$this->mergePicture('picture_2');
|
||||
$this->mergePicture('picture_3');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$rules = [
|
||||
'picture_1_alt' => 'required|string|between:3,255',
|
||||
'picture_1_title' => 'required|string|between:3,255',
|
||||
'picture_2_alt' => 'required|string|between:3,255',
|
||||
'picture_2_title' => 'required|string|between:3,255',
|
||||
'picture_3_alt' => 'required|string|between:3,255',
|
||||
'picture_3_title' => 'required|string|between:3,255',
|
||||
];
|
||||
|
||||
return \array_merge(
|
||||
$rules,
|
||||
$this->pictureRules('picture_1', 265, 364, 265, 364, false),
|
||||
$this->pictureRules('picture_2', 265, 364, 265, 364, false),
|
||||
$this->pictureRules('picture_3', 265, 364, 265, 364, false),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Bo\Explorerpage;
|
||||
|
||||
class UpdateExplorerpageRequest extends StoreExplorerpageRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return \array_merge(
|
||||
parent::rules()
|
||||
);
|
||||
}
|
||||
}
|
||||
43
app/Policies/ExplorerpagePolicy.php
Normal file
43
app/Policies/ExplorerpagePolicy.php
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Enums\Users\RoleEnum;
|
||||
use App\Models\User;
|
||||
use App\Policies\Rules\UserStaticRules;
|
||||
|
||||
class ExplorerpagePolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*
|
||||
* @param \App\Models\User $authUser
|
||||
* @return boolean
|
||||
*/
|
||||
public function viewAny(User $authUser): bool
|
||||
{
|
||||
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*
|
||||
* @param \App\Models\User $authUser
|
||||
* @return boolean
|
||||
*/
|
||||
public function view(User $authUser): bool
|
||||
{
|
||||
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*
|
||||
* @param \App\Models\User $authUser
|
||||
* @return boolean
|
||||
*/
|
||||
public function update(User $authUser): bool
|
||||
{
|
||||
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Providers;
|
||||
|
||||
use App\Models\Commitment;
|
||||
use App\Models\Explorerpage;
|
||||
use App\Models\Homepage;
|
||||
use App\Models\Range;
|
||||
use App\Models\News;
|
||||
|
|
@ -55,6 +56,7 @@ class RouteServiceProvider extends ServiceProvider
|
|||
Route::model('homepage', Homepage::class);
|
||||
Route::model('stamp', Stamp::class);
|
||||
Route::model('news', News::class);
|
||||
Route::model('explorerpage', Explorerpage::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ return [
|
|||
'stamp' => 'stamp',
|
||||
'commitment' => 'commitment',
|
||||
'range' => 'range',
|
||||
'homepage' => 'homepage'
|
||||
'homepage' => 'home page',
|
||||
'explorerpage' => 'explorer page',
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -242,6 +242,9 @@ return [
|
|||
'unpublish_at' => 'end of publication date',
|
||||
'background' => 'background',
|
||||
'picture' => 'picture',
|
||||
'picture_1' => 'picture one',
|
||||
'picture_2' => 'picture two',
|
||||
'picture_3' => 'picture three',
|
||||
'presentation_title' => 'presentation title',
|
||||
'title_part1' => 'title part one',
|
||||
'title_part2' => 'title part two',
|
||||
|
|
|
|||
|
|
@ -11,5 +11,6 @@ return [
|
|||
'homepage' => 'page d\'accueil',
|
||||
'news' => 'actualité',
|
||||
'stamp' => 'tampon',
|
||||
'explorerpage' => 'page explorateur',
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -244,6 +244,9 @@ return [
|
|||
'unpublish_at' => 'date de fin de publication',
|
||||
'background' => 'fond',
|
||||
'picture' => 'image',
|
||||
'picture_1' => 'image une',
|
||||
'picture_2' => 'image deux',
|
||||
'picture_3' => 'image trois',
|
||||
'presentation_title' => 'titre de présentation',
|
||||
'title_part1' => 'première partie du titre',
|
||||
'title_part2' => 'seconde partie du titre',
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
<li>
|
||||
<a class="nav-link @if (request()->routeIs('bo.homepages.*')) active @endif" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.homepages.index') }}"
|
||||
title="{{ __('crud.helpers.list_all', ['model' => Str::of(__('models.classes.commitment'))->plural()]) }}">
|
||||
title="{{ __('crud.helpers.list_all', ['model' => Str::of(__('models.classes.homepage'))->plural()]) }}">
|
||||
{{ Str::of(__('models.classes.homepage'))->plural()->ucfirst() }}
|
||||
</a>
|
||||
</li>
|
||||
|
|
@ -66,11 +66,12 @@
|
|||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
@can('viewAny', \App\Models\News::class)
|
||||
<li class="nav-item">
|
||||
<a class="nav-link @if (request()->routeIs('bo.news.*')) active @endif" data-bs-toggle="tooltip" href="{{ route('bo.news.index') }}"
|
||||
title="{{ __('crud.helpers.list_all', ['model' => Str::of(__('models.classes.news'))->plural()->title()]) }}">
|
||||
{{ Str::of(__('models.classes.news'))->plural()->title() }}
|
||||
@can('viewAny', \App\Models\Explorerpage::class)
|
||||
<li>
|
||||
<a class="nav-link @if (request()->routeIs('bo.explorerpages.*')) active @endif" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.explorerpages.index') }}"
|
||||
title="{{ __('crud.helpers.list_all', ['model' => Str::of(__('models.classes.explorerpage'))->plural()]) }}">
|
||||
{{ Str::of(__('models.classes.explorerpage'))->plural()->ucfirst() }}
|
||||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
|
|
|
|||
39
resources/views/bo/pages/explorerpages/edit.blade.php
Normal file
39
resources/views/bo/pages/explorerpages/edit.blade.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
@extends('bo.layout', ['brParam' => $explorerpageModel])
|
||||
|
||||
@section('title', trans_choice('crud.meta.title.edit', 0, ['model' => __('models.classes.explorerpage')]))
|
||||
@section('description', trans_choice('crud.meta.description.edit', 0, ['model' => __('models.classes.explorerpage')]))
|
||||
@section('breadcrumb',
|
||||
request()->route()->getName())
|
||||
|
||||
@section('content')
|
||||
<div class="d-flex justify-content-between flex-md-nowrap align-items-center flex-wrap pb-3">
|
||||
<div class="d-flex align-items-start flex-row">
|
||||
<a class="btn btn-primary text-decoration-none m-0" data-bs-toggle="tooltip" href="{{ route('bo.explorerpages.index') }}"
|
||||
title="{{ __('crud.helpers.list_all', ['model' => Str::plural(__('models.classes.explorerpage'))]) }}">
|
||||
<i class="fa-solid fa-arrow-left"></i>
|
||||
</a>
|
||||
@include('modules.breadcrumbs.breadcrumb-body', ['brParam' => $explorerpageModel])
|
||||
</div>
|
||||
<div class="mb-md-0 mb-2">
|
||||
<form class="btn-group confirmDeleteTS" action="{{ route('bo.explorerpages.edit', $explorerpageModel) }}" method="POST" novalidate>
|
||||
<button class="btn btn-primary" id="formSubmitClone" data-bs-toggle="tooltip" type="submit"
|
||||
title="{{ __('crud.helpers.save_model', ['model' => __('models.classes.explorerpage')]) }}">
|
||||
{{ Str::ucfirst(__('crud.actions.save')) }}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<form action="{{ route('bo.explorerpages.update', $explorerpageModel) }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
@include('bo.pages.explorerpages.form')
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit"
|
||||
title="{{ __('crud.helpers.save_model', ['model' => __('models.classes.explorerpage')]) }}">
|
||||
{{ Str::ucfirst(__('crud.actions.save')) }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@endsection
|
||||
243
resources/views/bo/pages/explorerpages/form.blade.php
Normal file
243
resources/views/bo/pages/explorerpages/form.blade.php
Normal file
|
|
@ -0,0 +1,243 @@
|
|||
<div class="row">
|
||||
{{-- PICTURE 1 --}}
|
||||
<div class="col-12 pb-3">
|
||||
<fieldset class="h-100 border p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.custom.picture')) }}</legend>
|
||||
<div class="row mb-3">
|
||||
{{-- PICTURE_1_ALT --}}
|
||||
<div class="col-12 col-md-6 m-md-0 mb-3">
|
||||
@include('bo.partials.inputs.varchar', [
|
||||
'id' => 'explorerpagePicture1Alt',
|
||||
'label' => __(':field1 :inter1:field2 :inter2:model', [
|
||||
'field1' => Str::ucfirst(__('validation.custom.attribute_alt')),
|
||||
'inter1' => __('validation.custom.of_the.vowel'),
|
||||
'field2' => __('validation.custom.picture'),
|
||||
'inter2' => __('validation.custom.of_the.female'),
|
||||
'model' => __('models.classes.explorerpage'),
|
||||
]),
|
||||
'hasWordCounter' => true,
|
||||
'name' => 'picture_1_alt',
|
||||
'required' => true,
|
||||
'model' => $explorerpageModel ?? null,
|
||||
'helper' => __('crud.minicrud.picture_alt_helper'),
|
||||
'placeholder' => __(':field1 :inter1:field2 :inter2:model', [
|
||||
'field1' => Str::ucfirst(__('validation.custom.attribute_alt')),
|
||||
'inter1' => __('validation.custom.of_the.vowel'),
|
||||
'field2' => __('validation.custom.picture'),
|
||||
'inter2' => __('validation.custom.of_the.female'),
|
||||
'model' => __('models.classes.explorerpage'),
|
||||
]),
|
||||
])
|
||||
</div>
|
||||
{{-- PICTURE_1_TITLE --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
@include('bo.partials.inputs.varchar', [
|
||||
'id' => 'explorerpagePicture1Title',
|
||||
'label' => __(':field1 :inter1:field2 :inter2:model', [
|
||||
'field1' => Str::ucfirst(__('validation.custom.attribute_title')),
|
||||
'inter1' => __('validation.custom.of_the.vowel'),
|
||||
'field2' => __('validation.custom.picture'),
|
||||
'inter2' => __('validation.custom.of_the.female'),
|
||||
'model' => __('models.classes.explorerpage'),
|
||||
]),
|
||||
'hasWordCounter' => true,
|
||||
'name' => 'picture_1_title',
|
||||
'required' => true,
|
||||
'model' => $explorerpageModel ?? null,
|
||||
'helper' => __('crud.minicrud.picture_title_helper'),
|
||||
'placeholder' => __(':field1 :inter1:field2 :inter2:model', [
|
||||
'field1' => Str::ucfirst(__('validation.custom.attribute_title')),
|
||||
'inter1' => __('validation.custom.of_the.vowel'),
|
||||
'field2' => __('validation.custom.picture'),
|
||||
'inter2' => __('validation.custom.of_the.female'),
|
||||
'model' => __('models.classes.explorerpage'),
|
||||
]),
|
||||
])
|
||||
</div>
|
||||
{{-- PICTURE_1 --}}
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.varchar-picture', [
|
||||
'id' => 'explorerpagePicture1',
|
||||
'name' => 'picture_1',
|
||||
'width' => 265,
|
||||
'height' => 364,
|
||||
'model' => $explorerpageModel ?? null,
|
||||
'helper' => __('crud.minicrud.dimensions_must_be', [
|
||||
'widthpx' => '265px',
|
||||
'heightpx' => '364px',
|
||||
]),
|
||||
'required' => true,
|
||||
'preview' => true,
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- PICTURE 2 --}}
|
||||
<div class="col-12 pb-3">
|
||||
<fieldset class="h-100 border p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.custom.picture')) }}</legend>
|
||||
<div class="row mb-3">
|
||||
{{-- PICTURE_2_ALT --}}
|
||||
<div class="col-12 col-md-6 m-md-0 mb-3">
|
||||
@include('bo.partials.inputs.varchar', [
|
||||
'id' => 'explorerpagePicture2Alt',
|
||||
'label' => __(':field1 :inter1:field2 :inter2:model', [
|
||||
'field1' => Str::ucfirst(__('validation.custom.attribute_alt')),
|
||||
'inter1' => __('validation.custom.of_the.vowel'),
|
||||
'field2' => __('validation.custom.picture'),
|
||||
'inter2' => __('validation.custom.of_the.female'),
|
||||
'model' => __('models.classes.explorerpage'),
|
||||
]),
|
||||
'hasWordCounter' => true,
|
||||
'name' => 'picture_2_alt',
|
||||
'required' => true,
|
||||
'model' => $explorerpageModel ?? null,
|
||||
'helper' => __('crud.minicrud.picture_alt_helper'),
|
||||
'placeholder' => __(':field1 :inter1:field2 :inter2:model', [
|
||||
'field1' => Str::ucfirst(__('validation.custom.attribute_alt')),
|
||||
'inter1' => __('validation.custom.of_the.vowel'),
|
||||
'field2' => __('validation.custom.picture'),
|
||||
'inter2' => __('validation.custom.of_the.female'),
|
||||
'model' => __('models.classes.explorerpage'),
|
||||
]),
|
||||
])
|
||||
</div>
|
||||
{{-- PICTURE_2_TITLE --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
@include('bo.partials.inputs.varchar', [
|
||||
'id' => 'explorerpagePicture2Title',
|
||||
'label' => __(':field1 :inter1:field2 :inter2:model', [
|
||||
'field1' => Str::ucfirst(__('validation.custom.attribute_title')),
|
||||
'inter1' => __('validation.custom.of_the.vowel'),
|
||||
'field2' => __('validation.custom.picture'),
|
||||
'inter2' => __('validation.custom.of_the.female'),
|
||||
'model' => __('models.classes.explorerpage'),
|
||||
]),
|
||||
'hasWordCounter' => true,
|
||||
'name' => 'picture_2_title',
|
||||
'required' => true,
|
||||
'model' => $explorerpageModel ?? null,
|
||||
'helper' => __('crud.minicrud.picture_title_helper'),
|
||||
'placeholder' => __(':field1 :inter1:field2 :inter2:model', [
|
||||
'field1' => Str::ucfirst(__('validation.custom.attribute_title')),
|
||||
'inter1' => __('validation.custom.of_the.vowel'),
|
||||
'field2' => __('validation.custom.picture'),
|
||||
'inter2' => __('validation.custom.of_the.female'),
|
||||
'model' => __('models.classes.explorerpage'),
|
||||
]),
|
||||
])
|
||||
</div>
|
||||
{{-- PICTURE_2 --}}
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.varchar-picture', [
|
||||
'id' => 'explorerpagePicture2',
|
||||
'name' => 'picture_2',
|
||||
'width' => 265,
|
||||
'height' => 364,
|
||||
'model' => $explorerpageModel ?? null,
|
||||
'helper' => __('crud.minicrud.dimensions_must_be', [
|
||||
'widthpx' => '265px',
|
||||
'heightpx' => '364px',
|
||||
]),
|
||||
'required' => true,
|
||||
'preview' => true,
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- PICTURE 3 --}}
|
||||
<div class="col-12 pb-3">
|
||||
<fieldset class="h-100 border p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.custom.picture')) }}</legend>
|
||||
<div class="row mb-3">
|
||||
{{-- PICTURE_3_ALT --}}
|
||||
<div class="col-12 col-md-6 m-md-0 mb-3">
|
||||
@include('bo.partials.inputs.varchar', [
|
||||
'id' => 'explorerpagePicture3Alt',
|
||||
'label' => __(':field1 :inter1:field2 :inter2:model', [
|
||||
'field1' => Str::ucfirst(__('validation.custom.attribute_alt')),
|
||||
'inter1' => __('validation.custom.of_the.vowel'),
|
||||
'field2' => __('validation.custom.picture'),
|
||||
'inter2' => __('validation.custom.of_the.female'),
|
||||
'model' => __('models.classes.explorerpage'),
|
||||
]),
|
||||
'hasWordCounter' => true,
|
||||
'name' => 'picture_3_alt',
|
||||
'required' => true,
|
||||
'model' => $explorerpageModel ?? null,
|
||||
'helper' => __('crud.minicrud.picture_alt_helper'),
|
||||
'placeholder' => __(':field1 :inter1:field2 :inter2:model', [
|
||||
'field1' => Str::ucfirst(__('validation.custom.attribute_alt')),
|
||||
'inter1' => __('validation.custom.of_the.vowel'),
|
||||
'field2' => __('validation.custom.picture'),
|
||||
'inter2' => __('validation.custom.of_the.female'),
|
||||
'model' => __('models.classes.explorerpage'),
|
||||
]),
|
||||
])
|
||||
</div>
|
||||
{{-- PICTURE_3_TITLE --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
@include('bo.partials.inputs.varchar', [
|
||||
'id' => 'explorerpagePicture3Title',
|
||||
'label' => __(':field1 :inter1:field2 :inter2:model', [
|
||||
'field1' => Str::ucfirst(__('validation.custom.attribute_title')),
|
||||
'inter1' => __('validation.custom.of_the.vowel'),
|
||||
'field2' => __('validation.custom.picture'),
|
||||
'inter2' => __('validation.custom.of_the.female'),
|
||||
'model' => __('models.classes.explorerpage'),
|
||||
]),
|
||||
'hasWordCounter' => true,
|
||||
'name' => 'picture_3_title',
|
||||
'required' => true,
|
||||
'model' => $explorerpageModel ?? null,
|
||||
'helper' => __('crud.minicrud.picture_title_helper'),
|
||||
'placeholder' => __(':field1 :inter1:field2 :inter2:model', [
|
||||
'field1' => Str::ucfirst(__('validation.custom.attribute_title')),
|
||||
'inter1' => __('validation.custom.of_the.vowel'),
|
||||
'field2' => __('validation.custom.picture'),
|
||||
'inter2' => __('validation.custom.of_the.female'),
|
||||
'model' => __('models.classes.explorerpage'),
|
||||
]),
|
||||
])
|
||||
</div>
|
||||
{{-- PICTURE --}}
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.varchar-picture', [
|
||||
'id' => 'explorerpagePicture3',
|
||||
'name' => 'picture_3',
|
||||
'width' => 265,
|
||||
'height' => 364,
|
||||
'model' => $explorerpageModel ?? null,
|
||||
'helper' => __('crud.minicrud.dimensions_must_be', [
|
||||
'widthpx' => '265px',
|
||||
'heightpx' => '364px',
|
||||
]),
|
||||
'required' => true,
|
||||
'preview' => true,
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<p><b>* {{ __('crud.helpers.required_fields') }}</b></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
// Submit button clone.
|
||||
const submit = document.getElementById('formSubmit')
|
||||
submitClone = document.getElementById('formSubmitClone');
|
||||
submitClone.addEventListener('click', (event) => {
|
||||
event.preventDefault();
|
||||
submit.click('');
|
||||
})
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
68
resources/views/bo/pages/explorerpages/index-list.blade.php
Normal file
68
resources/views/bo/pages/explorerpages/index-list.blade.php
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<table class="table-hover table-fix-action m-0 table">
|
||||
@if (count($explorerpageModels) > 0)
|
||||
<thead>
|
||||
@include('bo.modules.table-col-sorter', [
|
||||
'cols' => [
|
||||
'picture_1' => Str::ucfirst(__('validation.custom.picture_1')),
|
||||
'picture_1_title' => Str::ucfirst(__('validation.attributes.title')),
|
||||
'picture_2' => Str::ucfirst(__('validation.custom.picture_2')),
|
||||
'picture_2_title' => Str::ucfirst(__('validation.attributes.title')),
|
||||
'picture_3' => Str::ucfirst(__('validation.custom.picture_3')),
|
||||
'picture_3_title' => Str::ucfirst(__('validation.attributes.title')),
|
||||
'updated_at' => Str::ucfirst(__('validation.attributes.updated_at')),
|
||||
],
|
||||
])
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($explorerpageModels as $explorerpageModel)
|
||||
<tr class="border-bottom list-item">
|
||||
<td class="text-center align-middle">
|
||||
<img src="{{ asset($explorerpageModel->picture_1) }}" title="{{ $explorerpageModel->picture_1_title }}"
|
||||
alt="{{ $explorerpageModel->picture_1_alt }}" height="50px">
|
||||
</td>
|
||||
<td class="text-center align-middle">{{ $explorerpageModel->picture_1_title }}1</td>
|
||||
<td class="text-center align-middle">
|
||||
<img src="{{ asset($explorerpageModel->picture_2) }}" title="{{ $explorerpageModel->picture_2_title }}"
|
||||
alt="{{ $explorerpageModel->picture_2_alt }}" height="50px">
|
||||
</td>
|
||||
<td class="text-center align-middle">{{ $explorerpageModel->picture_2_title }}2</td>
|
||||
<td class="text-center align-middle">
|
||||
<img src="{{ asset($explorerpageModel->picture_3) }}" title="{{ $explorerpageModel->picture_3_title }}"
|
||||
alt="{{ $explorerpageModel->picture_3_alt }}" height="50px">
|
||||
</td>
|
||||
<td class="text-center align-middle">{{ $explorerpageModel->picture_3_title }}</td>
|
||||
<td class="text-center align-middle">
|
||||
<span class="badge bg-secondary">{{ $explorerpageModel->updated_at->isoFormat('LLLL') }}</span>
|
||||
</td>
|
||||
@php
|
||||
$routeName = request()
|
||||
->route()
|
||||
->getName();
|
||||
@endphp
|
||||
<td class="text-end align-middle">
|
||||
@canAny(['update'], $explorerpageModel)
|
||||
<form class="btn-group confirmDeleteTS" action="{{ route('bo.explorerpages.edit', $explorerpageModel) }}"
|
||||
method="POST" novalidate>
|
||||
@can('update', $explorerpageModel)
|
||||
<a class="btn btn-sm btn-primary" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.explorerpages.edit', ['explorerpage' => $explorerpageModel]) }}"
|
||||
title="{{ Str::ucfirst(__('crud.actions.update')) }}">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@endcan
|
||||
</form>
|
||||
@else
|
||||
<span class="text-danger" data-bs-toggle="tooltip" title="{{ __('list.right') }}">
|
||||
<i class="fa-solid fa-ban"></i>
|
||||
</span>
|
||||
@endcan
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
@else
|
||||
<tr>
|
||||
<td class="border-0">{{ __('crud.other.no_model_found', ['model' => __('models.classes.explorerpage')]) }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
</table>
|
||||
16
resources/views/bo/pages/explorerpages/index.blade.php
Normal file
16
resources/views/bo/pages/explorerpages/index.blade.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
@extends('bo.layout')
|
||||
|
||||
@section('title',
|
||||
Str::of(__('models.classes.explorerpage'))->plural()->ucfirst())
|
||||
@section('description', trans_choice('crud.meta.description.index', 0, ['model' => Str::plural(__('models.classes.explorerpage'))]))
|
||||
|
||||
@section('content')
|
||||
<div class="d-flex justify-content-between flex-md-nowrap align-items-center flex-wrap">
|
||||
@include('modules.breadcrumbs.breadcrumb-body')
|
||||
</div>
|
||||
@include('bo.modules.search-bar')
|
||||
<div class="table-responsive mb-3">
|
||||
@include('bo.pages.explorerpages.index-list')
|
||||
</div>
|
||||
{{ $explorerpageModels->links() }}
|
||||
@endsection
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use App\Models\ActivityLog;
|
||||
use App\Models\Commitment;
|
||||
use App\Models\Explorerpage;
|
||||
use App\Models\Homepage;
|
||||
use App\Models\Range;
|
||||
use App\Models\News;
|
||||
|
|
@ -149,6 +150,18 @@ Breadcrumbs::for('bo.homepages.edit', function (Generator $trail, Homepage $home
|
|||
$trail->push(Str::ucfirst(trans('crud.actions.edit')), route('bo.homepages.edit', $homepage));
|
||||
});
|
||||
|
||||
// * EXPLORERPAGES
|
||||
Breadcrumbs::for('bo.explorerpages.index', function (Generator $trail) {
|
||||
$trail->push(
|
||||
Str::of(trans('models.classes.explorerpage'))->plural()->ucfirst(),
|
||||
route('bo.explorerpages.index', ['sort_col' => 'updated_at', 'sort_way' => 'desc'])
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('bo.explorerpages.edit', function (Generator $trail, Explorerpage $explorerpage) {
|
||||
$trail->parent('bo.explorerpages.index');
|
||||
$trail->push(Str::ucfirst(trans('crud.actions.edit')), route('bo.explorerpages.edit', $explorerpage));
|
||||
});
|
||||
|
||||
// * STAMPS
|
||||
Breadcrumbs::for('bo.stamps.index', function (Generator $trail) {
|
||||
$trail->push(
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
use App\Http\Controllers\Bo\ActivityLogsController;
|
||||
use App\Http\Controllers\Bo\CommitmentController;
|
||||
use App\Http\Controllers\Bo\DashboardController;
|
||||
use App\Http\Controllers\Bo\ExplorerpageController;
|
||||
use App\Http\Controllers\Bo\HomepageController;
|
||||
use App\Http\Controllers\Bo\NewsController;
|
||||
use App\Http\Controllers\Bo\StaticPageController;
|
||||
|
|
@ -112,7 +113,7 @@ Route::prefix('bo')
|
|||
->withoutMiddleware('htmlsanitize')
|
||||
->middleware('htmlsanitize:presentation_content');
|
||||
|
||||
// * RANGES.
|
||||
// * STAMPS
|
||||
Route::resource('stamps', StampController::class)->except('show')
|
||||
->withoutMiddleware('htmlsanitize')
|
||||
->middleware('htmlsanitize:description');
|
||||
|
|
@ -126,19 +127,9 @@ Route::prefix('bo')
|
|||
StampController::class, 'duplicate'
|
||||
])->name('stamps.duplicate');
|
||||
|
||||
// * NEWS.
|
||||
Route::resource('news', NewsController::class)->except('show')
|
||||
->withoutMiddleware('htmlsanitize')
|
||||
->middleware('htmlsanitize:content');
|
||||
Route::patch('/news/{news}/change-published', [
|
||||
NewsController::class, 'changePublished'
|
||||
])->name('news.change-published');
|
||||
Route::patch('/news/{news}/change-order/{direction}', [
|
||||
RangeController::class, 'changeOrder'
|
||||
])->where('direction', 'up|down')->name('news.change-order');
|
||||
Route::get('/news/{news}/duplicate', [
|
||||
NewsController::class, 'duplicate'
|
||||
])->name('news.duplicate');
|
||||
// * EXPLORERPAGE
|
||||
Route::resource('explorerpages', ExplorerpageController::class)->only(['index', 'edit', 'update'])
|
||||
->withoutMiddleware('htmlsanitize');
|
||||
|
||||
Route::middleware('can:isConceptor')->group(function () {
|
||||
// * ACTIVITY LOGS.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue