Added JobVideo CRUD
This commit is contained in:
parent
4be4dddda0
commit
1ea003521c
19 changed files with 685 additions and 16 deletions
|
|
@ -6,15 +6,12 @@ use App\Http\Controllers\Controller;
|
|||
use App\Http\Requests\Bo\HistoricalMilestones\StoreHistoricalMilestoneRequest;
|
||||
use App\Http\Requests\Bo\HistoricalMilestones\UpdateHistoricalMilestoneRequest;
|
||||
use App\Models\HistoricalMilestone;
|
||||
use App\Traits\Controllers\UpdateModelPublished;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class HistoricalMilestoneController extends Controller
|
||||
{
|
||||
use UpdateModelPublished;
|
||||
|
||||
/**
|
||||
* Create the controller instance.
|
||||
*/
|
||||
|
|
|
|||
167
app/Http/Controllers/Bo/JobVideoController.php
Normal file
167
app/Http/Controllers/Bo/JobVideoController.php
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bo;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Bo\JobVideos\StoreJobVideoRequest;
|
||||
use App\Http\Requests\Bo\JobVideos\UpdateJobVideoRequest;
|
||||
use App\Models\JobVideo;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class JobVideoController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create the controller instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->authorizeResource(JobVideo::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 $jobVideoModels */
|
||||
$jobVideoModels = JobVideo::query();
|
||||
|
||||
/** @var string $search Search field */
|
||||
$search = $request->search;
|
||||
if ($search) {
|
||||
$this->searchQuery(
|
||||
$jobVideoModels,
|
||||
$search,
|
||||
null,
|
||||
'title',
|
||||
'place',
|
||||
);
|
||||
}
|
||||
$searchFields = \implode(', ', [
|
||||
Str::ucfirst(trans('validation.attributes.title')),
|
||||
trans('validation.custom.place'),
|
||||
]);
|
||||
|
||||
/** Sort columns with a query */
|
||||
$this->sortQuery($jobVideoModels);
|
||||
|
||||
/** Custom pagination */
|
||||
$jobVideoModels = $this->paginate($jobVideoModels);
|
||||
|
||||
return view(
|
||||
'bo.pages.job_videos.index',
|
||||
compact('jobVideoModels', 'search', 'searchFields')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param \App\Models\JobVideo $jobVideo
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function create(JobVideo $jobVideo): \Illuminate\Contracts\View\View
|
||||
{
|
||||
return view('bo.pages.job_videos.create', ['jobVideoModel' => $jobVideo]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\Bo\JobVideos\StoreJobVideoRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store(StoreJobVideoRequest $request): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
return DB::transaction(function () use ($request) {
|
||||
$jobVideo = new JobVideo();
|
||||
$jobVideo->fill($request->validated());
|
||||
|
||||
if ($jobVideo->saveOrFail()) {
|
||||
return redirect()->route('bo.jobvideos.edit', $jobVideo)
|
||||
->with('success', __('crud.messages.has_been_created', [
|
||||
'model' => Str::ucfirst(trans_choice('models.classes.job_video', '1'))
|
||||
]));
|
||||
}
|
||||
return redirect()->back()
|
||||
->with('error', __('crud.messages.cannot_be_created', [
|
||||
'model' => Str::ucfirst(trans_choice('models.classes.job_video', '1'))
|
||||
]));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param App\Models\JobVideo $jobVideo
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function edit(JobVideo $jobVideo): \Illuminate\Contracts\View\View
|
||||
{
|
||||
return view('bo.pages.job_videos.edit', ['jobVideoModel' => $jobVideo]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\Bo\JobVideos\UpdateJobVideoRequest $request
|
||||
* @param \App\Models\JobVideo $jobVideo
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(
|
||||
UpdateJobVideoRequest $request,
|
||||
JobVideo $jobVideo
|
||||
): \Illuminate\Http\RedirectResponse {
|
||||
return DB::transaction(function () use ($request, $jobVideo) {
|
||||
$jobVideo->fill($request->validated());
|
||||
|
||||
if ($jobVideo->saveOrFail()) {
|
||||
return redirect()->route('bo.jobvideos.edit', $jobVideo)
|
||||
->with('success', __('crud.messages.has_been_updated', [
|
||||
'model' => Str::ucfirst(trans_choice('models.classes.job_video', '1'))
|
||||
]));
|
||||
}
|
||||
return redirect()->route('bo.jobvideos.edit', $jobVideo)
|
||||
->with('error', __('crud.messages.cannot_be_updated', [
|
||||
'model' => Str::ucfirst(trans_choice('models.classes.job_video', '1'))
|
||||
]));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\JobVideo $jobVideo
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function destroy(JobVideo $jobVideo): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
if ($jobVideo->deleteOrFail()) {
|
||||
return redirect()->route('bo.jobvideos.index')
|
||||
->with('success', __('crud.messages.has_been_deleted', [
|
||||
'model' => Str::ucfirst(trans_choice('models.classes.job_video', '1'))
|
||||
]));
|
||||
}
|
||||
return redirect()->back()
|
||||
->with('error', __('crud.messages.cannot_be_deleted', [
|
||||
'model' => Str::ucfirst(trans_choice('models.classes.job_video', '1'))
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicate the specified resource.
|
||||
*
|
||||
* @param \App\Models\JobVideo $jobVideo
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function duplicate(JobVideo $jobVideo): \Illuminate\Contracts\View\View
|
||||
{
|
||||
return $this->create($jobVideo->replicate());
|
||||
}
|
||||
}
|
||||
|
|
@ -6,17 +6,12 @@ use App\Http\Controllers\Controller;
|
|||
use App\Http\Requests\Bo\Logos\StoreLogoRequest;
|
||||
use App\Http\Requests\Bo\Logos\UpdateLogoRequest;
|
||||
use App\Models\Logo;
|
||||
use App\Traits\Controllers\ChangesModelOrder;
|
||||
use App\Traits\Controllers\UpdateModelPublished;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class LogoController extends Controller
|
||||
{
|
||||
use UpdateModelPublished;
|
||||
use ChangesModelOrder;
|
||||
|
||||
/**
|
||||
* Create the controller instance.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -8,14 +8,12 @@ use App\Http\Requests\Bo\Sites\UpdateSiteRequest;
|
|||
use App\Models\Logo;
|
||||
use App\Models\Site;
|
||||
use App\Traits\Controllers\ChangesModelOrder;
|
||||
use App\Traits\Controllers\UpdateModelPublished;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class SiteController extends Controller
|
||||
{
|
||||
use UpdateModelPublished;
|
||||
use ChangesModelOrder;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -6,17 +6,12 @@ use App\Http\Controllers\Controller;
|
|||
use App\Http\Requests\Bo\Slides\StoreSlideRequest;
|
||||
use App\Http\Requests\Bo\Slides\UpdateSlideRequest;
|
||||
use App\Models\Slide;
|
||||
use App\Traits\Controllers\ChangesModelOrder;
|
||||
use App\Traits\Controllers\UpdateModelPublished;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class SlideController extends Controller
|
||||
{
|
||||
use UpdateModelPublished;
|
||||
use ChangesModelOrder;
|
||||
|
||||
/**
|
||||
* Create the controller instance.
|
||||
*/
|
||||
|
|
|
|||
49
app/Http/Requests/Bo/JobVideos/StoreJobVideoRequest.php
Normal file
49
app/Http/Requests/Bo/JobVideos/StoreJobVideoRequest.php
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Bo\JobVideos;
|
||||
|
||||
use App\Traits\Requests\HasPicture;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreJobVideoRequest extends FormRequest
|
||||
{
|
||||
use HasPicture;
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return auth('backend')->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'required|string|between:3,255',
|
||||
'place' => 'required|string|between:3,255',
|
||||
'video_id' => 'required|string|regex:%([^"&?\/\s]{11})%i',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom attributes for validator errors.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'title' => trans('validation.attributes.title'),
|
||||
'place' => trans('validation.custom.place'),
|
||||
'video_id' => trans('validation.custom.video_id'),
|
||||
];
|
||||
}
|
||||
}
|
||||
7
app/Http/Requests/Bo/JobVideos/UpdateJobVideoRequest.php
Normal file
7
app/Http/Requests/Bo/JobVideos/UpdateJobVideoRequest.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Bo\JobVideos;
|
||||
|
||||
class UpdateJobVideoRequest extends StoreJobVideoRequest
|
||||
{
|
||||
}
|
||||
120
app/Policies/JobVideoPolicy.php
Normal file
120
app/Policies/JobVideoPolicy.php
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Enums\Users\RoleEnum;
|
||||
use App\Models\User;
|
||||
use App\Policies\Rules\UserStaticRules;
|
||||
|
||||
class JobVideoPolicy
|
||||
{
|
||||
/**
|
||||
* 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 create models.
|
||||
*
|
||||
* @param \App\Models\User $authUser
|
||||
* @return boolean
|
||||
*/
|
||||
public function create(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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*
|
||||
* @param \App\Models\User $authUser
|
||||
* @return boolean
|
||||
*/
|
||||
public function delete(User $authUser): bool
|
||||
{
|
||||
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*
|
||||
* @param \App\Models\User $authUser
|
||||
* @return boolean
|
||||
*/
|
||||
public function restore(User $authUser): bool
|
||||
{
|
||||
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*
|
||||
* @param \App\Models\User $authUser
|
||||
* @return boolean
|
||||
*/
|
||||
public function forceDelete(User $authUser): bool
|
||||
{
|
||||
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can duplicate the model.
|
||||
*
|
||||
* @param \App\Models\User $authUser
|
||||
* @return boolean
|
||||
*/
|
||||
public function duplicate(User $authUser): bool
|
||||
{
|
||||
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can publish/unpublish the model.
|
||||
*
|
||||
* @param \App\Models\User $authUser
|
||||
* @return boolean
|
||||
*/
|
||||
public function changePublished(User $authUser): bool
|
||||
{
|
||||
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can change the order of the model.
|
||||
*
|
||||
* @param \App\Models\User $authUser
|
||||
* @return boolean
|
||||
*/
|
||||
public function changeOrder(User $authUser): bool
|
||||
{
|
||||
return UserStaticRules::atLeastRole($authUser, RoleEnum::admin);
|
||||
}
|
||||
}
|
||||
|
|
@ -11,5 +11,6 @@ return [
|
|||
'logo' => 'logo',
|
||||
'historicalMilestone' => 'jalon historique|jalons historiques',
|
||||
'slide' => 'slide',
|
||||
'job_video' => 'vidéo métier|vidéos métiers',
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -270,5 +270,6 @@ return [
|
|||
'video_id' => 'ID de la vidéo',
|
||||
'youtube_video' => 'vidéo YouTube',
|
||||
'slider' => 'slider',
|
||||
'place' => 'lieu',
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -85,6 +85,15 @@
|
|||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
@can('viewAny', \App\Models\JobVideo::class)
|
||||
<li class="nav-item">
|
||||
<a class="nav-link @if (request()->routeIs('bo.jobvideos.*')) active @endif" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.jobvideos.index') }}"
|
||||
title="{{ __('crud.helpers.list_all', ['model' => Str::of(trans_choice('models.classes.job_video', '*'))->title()]) }}">
|
||||
{{ Str::of(trans_choice('models.classes.job_video', '*'))->ucfirst()->plural() }}
|
||||
</a>
|
||||
</li>
|
||||
@endcan
|
||||
@can('viewAny', \App\Models\HistoricalMilestone::class)
|
||||
<li class="nav-item">
|
||||
<a class="nav-link @if (request()->routeIs('bo.historicalmilestones.*')) active @endif" data-bs-toggle="tooltip"
|
||||
|
|
|
|||
36
resources/views/bo/pages/job_videos/create.blade.php
Normal file
36
resources/views/bo/pages/job_videos/create.blade.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
@extends('bo.layout', ['brParam' => $jobVideoModel])
|
||||
|
||||
@section('title', __('Création d\'une :model', ['model' => trans_choice('models.classes.job_video', '1')]))
|
||||
@section('description', __('Création d\'une tout nouvelle :model', ['model' => trans_choice('models.classes.job_video', '1')]))
|
||||
@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.jobvideos.index') }}"
|
||||
title="{{ __('crud.helpers.list_all', ['model' => trans_choice('models.classes.job_video', '1')]) }}">
|
||||
<i class="fa-solid fa-arrow-left"></i>
|
||||
</a>
|
||||
@include('modules.breadcrumbs.breadcrumb-body', ['brParam' => $jobVideoModel])
|
||||
</div>
|
||||
<div class="mb-md-0 mb-2">
|
||||
<button class="btn btn-primary" id="formSubmitClone" data-bs-toggle="tooltip" type="submit"
|
||||
title="{{ __('crud.helpers.save_model', ['model' => trans_choice('models.classes.job_video', '1')]) }}">
|
||||
{{ Str::ucfirst(__('crud.actions.save')) }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<form action="{{ route('bo.jobvideos.store') }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@include('bo.pages.job_videos.form')
|
||||
<div class="row mt-3">
|
||||
<div class="col text-center">
|
||||
<button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit"
|
||||
title="{{ __('crud.helpers.save_model', ['model' => trans_choice('models.classes.job_video', '1')]) }}">
|
||||
{{ Str::ucfirst(__('crud.actions.save')) }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@endsection
|
||||
53
resources/views/bo/pages/job_videos/edit.blade.php
Normal file
53
resources/views/bo/pages/job_videos/edit.blade.php
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
@extends('bo.layout', ['brParam' => $jobVideoModel])
|
||||
|
||||
@section('title', __('Édition d\'un :model', ['model' => trans_choice('models.classes.job_video', '1')]))
|
||||
@section('description', __('Édition d\'un :model déjà existant', ['model' => trans_choice('models.classes.job_video', '1')]))
|
||||
@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.jobvideos.index') }}"
|
||||
title="{{ __('crud.helpers.list_all', ['model' => trans_choice('models.classes.job_video', '*')]) }}">
|
||||
<i class="fa-solid fa-arrow-left"></i>
|
||||
</a>
|
||||
@include('modules.breadcrumbs.breadcrumb-body', ['brParam' => $jobVideoModel])
|
||||
</div>
|
||||
<div class="mb-md-0 mb-2">
|
||||
<form class="btn-group confirmDeleteTS" action="{{ route('bo.jobvideos.destroy', $jobVideoModel) }}" method="POST" novalidate>
|
||||
@can('duplicate', $jobVideoModel)
|
||||
<a class="btn btn-secondary" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.jobvideos.duplicate', ['job_video' => $jobVideoModel]) }}"
|
||||
title="{{ Str::ucfirst(__('crud.actions.duplicate')) }}">
|
||||
<i class="fa-solid fa-copy"></i>
|
||||
</a>
|
||||
@endcan
|
||||
<button class="btn btn-primary" id="formSubmitClone" data-bs-toggle="tooltip" type="submit"
|
||||
title="{{ __('crud.helpers.save_model', ['model' => trans_choice('models.classes.job_video', '1')]) }}">
|
||||
{{ Str::ucfirst(__('crud.actions.save')) }}
|
||||
</button>
|
||||
@can('delete', $jobVideoModel)
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button class="btn btn-danger" data-bs-toggle="tooltip" type="submit" title="{{ Str::ucfirst(__('crud.actions.delete')) }}">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
@endcan
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<form action="{{ route('bo.jobvideos.update', $jobVideoModel) }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
@include('bo.pages.job_videos.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' => trans_choice('models.classes.job_video', '1')]) }}">
|
||||
{{ Str::ucfirst(__('crud.actions.save')) }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@endsection
|
||||
119
resources/views/bo/pages/job_videos/form.blade.php
Normal file
119
resources/views/bo/pages/job_videos/form.blade.php
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
<div class="row">
|
||||
{{-- TITLE --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="h-100 border p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.title')) }} *</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.varchar', [
|
||||
'id' => 'jobVideoTitle',
|
||||
'label' => __(':field :inter:model', [
|
||||
'field' => Str::ucfirst(__('validation.attributes.title')),
|
||||
'inter' => __('validation.custom.of_the.female'),
|
||||
'model' => trans_choice('models.classes.job_video', '1'),
|
||||
]),
|
||||
'hasWordCounter' => true,
|
||||
'name' => 'title',
|
||||
'required' => true,
|
||||
'model' => $jobVideoModel ?? null,
|
||||
'helper' => __('validation.between.string', [
|
||||
'attribute' => __(':field :inter:model', [
|
||||
'field' => __('validation.attributes.title'),
|
||||
'inter' => __('validation.custom.of_the.female'),
|
||||
'model' => trans_choice('models.classes.job_video', '1'),
|
||||
]),
|
||||
'min' => 3,
|
||||
'max' => 255,
|
||||
]),
|
||||
'placeholder' => __('Un titre clair et concis'),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- PLACE --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="h-100 border p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.custom.place')) }} *</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.varchar', [
|
||||
'id' => 'jobVideoPlace',
|
||||
'label' => __(':field :inter:model', [
|
||||
'field' => Str::ucfirst(__('validation.custom.place')),
|
||||
'inter' => __('validation.custom.of_the.female'),
|
||||
'model' => trans_choice('models.classes.job_video', '1'),
|
||||
]),
|
||||
'hasWordCounter' => true,
|
||||
'name' => 'place',
|
||||
'required' => true,
|
||||
'model' => $jobVideoModel ?? null,
|
||||
'helper' => __('validation.between.string', [
|
||||
'attribute' => __(':field :inter:model', [
|
||||
'field' => __('validation.attributes.title'),
|
||||
'inter' => __('validation.custom.of_the.male'),
|
||||
'model' => trans_choice('models.classes.job_video', '1'),
|
||||
]),
|
||||
'min' => 3,
|
||||
'max' => 255,
|
||||
]),
|
||||
'placeholder' => __('Un nom clair et concis'),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- VIDEO ID --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="h-100 border p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.custom.youtube_video')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.varchar', [
|
||||
'id' => 'jobVideoId',
|
||||
'label' => __(':field :inter:model', [
|
||||
'field' => Str::ucfirst(__('validation.custom.video_id')),
|
||||
'inter' => __('validation.custom.of_the.female'),
|
||||
'model' => trans_choice('models.classes.job_video', '1'),
|
||||
]),
|
||||
'hasWordCounter' => true,
|
||||
'name' => 'video_id',
|
||||
'required' => true,
|
||||
'model' => $jobVideoModel ?? null,
|
||||
'helper' =>
|
||||
__('validation.between.string', [
|
||||
'attribute' => __(':field :inter:model', [
|
||||
'field' => __('validation.custom.video_id'),
|
||||
'inter' => __('validation.custom.of_the.female'),
|
||||
'model' => trans_choice('models.classes.job_video', '1'),
|
||||
]),
|
||||
'min' => 3,
|
||||
'max' => 11,
|
||||
]) . __(' Doit être l\'id de la vidéo.'),
|
||||
'placeholder' => __('6B4O-_1CQoI'),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<p><b>{{ __('* Champs obligatoires') }}</b></p>
|
||||
</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
|
||||
70
resources/views/bo/pages/job_videos/index-list.blade.php
Normal file
70
resources/views/bo/pages/job_videos/index-list.blade.php
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
<table class="table-hover table-fix-action m-0 table">
|
||||
@if (count($jobVideoModels) > 0)
|
||||
<thead>
|
||||
@include('bo.modules.table-col-sorter', [
|
||||
'cols' => [
|
||||
'title' => Str::ucfirst(__('validation.attributes.title')),
|
||||
'place' => Str::ucfirst(__('validation.custom.place')),
|
||||
'video_id' => Str::ucfirst(__('validation.custom.youtube_video')),
|
||||
'updated_at' => Str::ucfirst(__('validation.attributes.updated_at')),
|
||||
],
|
||||
])
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($jobVideoModels as $jobVideoModel)
|
||||
<tr class="border-bottom list-item">
|
||||
<td class="text-center align-middle">{{ $jobVideoModel->title }}</td>
|
||||
<td class="text-center align-middle">{{ $jobVideoModel->place }}</td>
|
||||
<td class="text-center align-middle">
|
||||
<a href="https://www.youtube.com/watch?v={{ $jobVideoModel->video_id }}"
|
||||
title="{{ __('Ouvrir la vidéo ') . $jobVideoModel->title }}">
|
||||
{{ __('Ouvrir la vidéo') }}
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<td class="text-center align-middle">
|
||||
<span class="badge bg-secondary">{{ $jobVideoModel->updated_at->isoFormat('LLLL') }}</span>
|
||||
</td>
|
||||
<td class="text-end align-middle">
|
||||
@canAny(['delete', 'duplicate', 'update'], $jobVideoModel)
|
||||
<form class="btn-group confirmDeleteTS" action="{{ route('bo.jobvideos.destroy', $jobVideoModel) }}" method="POST"
|
||||
novalidate>
|
||||
@can('duplicate', $jobVideoModel)
|
||||
<a class="btn btn-sm btn-secondary" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.jobvideos.duplicate', ['job_video' => $jobVideoModel]) }}"
|
||||
title="{{ Str::ucfirst(__('crud.actions.duplicate')) }}">
|
||||
<i class="fa-solid fa-copy"></i>
|
||||
</a>
|
||||
@endcan
|
||||
@can('update', $jobVideoModel)
|
||||
<a class="btn btn-sm btn-primary" data-bs-toggle="tooltip"
|
||||
href="{{ route('bo.jobvideos.edit', ['job_video' => $jobVideoModel]) }}"
|
||||
title="{{ Str::ucfirst(__('crud.actions.update')) }}">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</a>
|
||||
@endcan
|
||||
@can('delete', $jobVideoModel)
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button class="btn btn-sm btn-danger" data-bs-toggle="tooltip" type="submit"
|
||||
title="{{ Str::ucfirst(__('crud.actions.delete')) }}">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
</button>
|
||||
@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' => trans_choice('models.classes.job_video', '1')]) }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
</table>
|
||||
21
resources/views/bo/pages/job_videos/index.blade.php
Normal file
21
resources/views/bo/pages/job_videos/index.blade.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
@extends('bo.layout')
|
||||
|
||||
@section('title', Str::ucfirst(trans_choice('models.classes.job_video', '1')))
|
||||
@section('description', trans_choice('crud.meta.description.index', 0, ['model' => trans_choice('models.classes.job_video', '*')]))
|
||||
|
||||
@section('content')
|
||||
<div class="d-flex justify-content-between flex-md-nowrap align-items-center flex-wrap">
|
||||
@include('modules.breadcrumbs.breadcrumb-body')
|
||||
@can('create', \App\Models\JobVideo::class)
|
||||
<a class="btn btn-primary float-right" data-bs-toggle="tooltip" href="{{ route('bo.jobvideos.create') }}"
|
||||
title="{{ __('crud.helpers.create_model', ['model' => trans_choice('models.classes.job_video', '1')]) }}">
|
||||
<i class="fa-solid fa-plus"></i>
|
||||
</a>
|
||||
@endcan
|
||||
</div>
|
||||
@include('bo.modules.search-bar')
|
||||
<div class="table-responsive mb-3">
|
||||
@include('bo.pages.job_videos.index-list')
|
||||
</div>
|
||||
{{ $jobVideoModels->links() }}
|
||||
@endsection
|
||||
|
|
@ -107,7 +107,7 @@
|
|||
'model' => __('models.classes.slide'),
|
||||
]),
|
||||
'min' => 3,
|
||||
'max' => 255,
|
||||
'max' => 11,
|
||||
]) . __(' Doit être l\'id de la vidéo.'),
|
||||
'placeholder' => __('crud.placeholders.beautiful', ['field' => __('validation.attributes.url')]),
|
||||
])
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use App\Models\ActivityLog;
|
||||
use App\Models\HistoricalMilestone;
|
||||
use App\Models\JobVideo;
|
||||
use App\Models\Logo;
|
||||
use App\Models\News;
|
||||
use App\Models\Section;
|
||||
|
|
@ -157,6 +158,27 @@ Breadcrumbs::for('bo.slides.duplicate', function (Generator $trail) {
|
|||
$trail->push(Str::ucfirst(trans('crud.actions.duplicate')));
|
||||
});
|
||||
|
||||
// * JOB VIDEOS
|
||||
Breadcrumbs::for('bo.jobvideos.index', function (Generator $trail) {
|
||||
$trail->push(
|
||||
Str::of(trans_choice('models.classes.job_video', '*'))->ucfirst(),
|
||||
route('bo.jobvideos.index', ['sort_col' => 'updated_at', 'sort_way' => 'desc'])
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('bo.jobvideos.create', function (Generator $trail) {
|
||||
$trail->parent('bo.jobvideos.index');
|
||||
$trail->push(Str::ucfirst(trans('crud.actions.create')), route('bo.jobvideos.create'));
|
||||
});
|
||||
Breadcrumbs::for('bo.jobvideos.edit', function (Generator $trail, JobVideo $jobVideo) {
|
||||
$trail->parent('bo.jobvideos.index');
|
||||
$trail->push(Str::ucfirst(trans('crud.actions.edit')), route('bo.jobvideos.edit', $jobVideo));
|
||||
});
|
||||
Breadcrumbs::for('bo.jobvideos.duplicate', function (Generator $trail) {
|
||||
$trail->parent('bo.jobvideos.index');
|
||||
$trail->push(Str::ucfirst(trans('crud.actions.duplicate')));
|
||||
});
|
||||
|
||||
|
||||
// * SECTIONS
|
||||
Breadcrumbs::for('bo.sections.index', function (Generator $trail) {
|
||||
$trail->push(
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
use App\Http\Controllers\Bo\ActivityLogController;
|
||||
use App\Http\Controllers\Bo\DashboardController;
|
||||
use App\Http\Controllers\Bo\HistoricalMilestoneController;
|
||||
use App\Http\Controllers\Bo\JobVideoController;
|
||||
use App\Http\Controllers\Bo\LogoController;
|
||||
use App\Http\Controllers\Bo\NewsController;
|
||||
use App\Http\Controllers\Bo\SectionController;
|
||||
|
|
@ -103,6 +104,14 @@ Route::prefix('bo')
|
|||
->withoutMiddleware('htmlsanitize')
|
||||
->middleware(['htmlsanitize:text,data']);
|
||||
|
||||
// * JOB VIDEOS.
|
||||
Route::resource('jobvideos', JobVideoController::class)->except('show')
|
||||
->parameters(['jobvideos' => 'job_video']);
|
||||
Route::get('/jobvideos/{job_video}/duplicate', [
|
||||
JobVideoController::class, 'duplicate'
|
||||
])->name('jobvideos.duplicate');
|
||||
|
||||
|
||||
Route::middleware('can:isConceptor')->group(function () {
|
||||
// * ACTIVITY LOGS.
|
||||
Route::resource('activity_logs', ActivityLogController::class)->only(['index', 'show']);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue