Changes
This commit is contained in:
@@ -27,6 +27,21 @@ use Mohamedsabil83\FilamentFormsTinyeditor\Components\TinyEditor;
|
||||
|
||||
class ContentBuilderItem
|
||||
{
|
||||
private static function findSeoActive(array $data) : bool
|
||||
{
|
||||
$bool = false;
|
||||
|
||||
foreach ($data as $item) {
|
||||
if ($item['type'] !== 'paragraph') {
|
||||
continue;
|
||||
}
|
||||
if ($item['data']['seo_active'] === true) {
|
||||
$bool = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $bool;
|
||||
}
|
||||
public static function getItem(string $name)
|
||||
{
|
||||
return
|
||||
@@ -42,6 +57,14 @@ class ContentBuilderItem
|
||||
]),
|
||||
Builder\Block::make('paragraph')
|
||||
->schema([
|
||||
Toggle::make('seo_active')->label('Использовать блок как seo')
|
||||
->live(onBlur: true)
|
||||
->required()
|
||||
->disabled(function ($state, Forms\Get $get) {
|
||||
$data = $get('../../');
|
||||
return self::findSeoActive($data) && !$state;
|
||||
})
|
||||
->dehydrated(),
|
||||
TinyEditor::make('content')
|
||||
->label('')
|
||||
->profile('test')
|
||||
|
||||
@@ -37,21 +37,7 @@ use Symfony\Component\Finder\Finder;
|
||||
class PostForm
|
||||
{
|
||||
|
||||
private static function findSeoActive(array $data) : bool
|
||||
{
|
||||
$bool = false;
|
||||
|
||||
foreach ($data as $item) {
|
||||
if ($item['type'] !== 'paragraph') {
|
||||
continue;
|
||||
}
|
||||
if ($item['data']['seo_active'] === true) {
|
||||
$bool = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $bool;
|
||||
}
|
||||
public static function getForm(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
|
||||
@@ -134,7 +134,7 @@ class ClientAdditionalEducationController extends Controller
|
||||
$breadcrumbs = null;
|
||||
}
|
||||
|
||||
$seo = $additionalEducation->seo;
|
||||
$seo = $additionalEducation->seo ?? null;
|
||||
|
||||
return Inertia::render('Client/Additional-educations/Show', compact('additionalEducation', 'breadcrumbs', 'seo'));
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class ClientDepartmentController extends Controller
|
||||
->first());
|
||||
$directions = $this->groupProgramsByDirection($department->programs);
|
||||
|
||||
$seo = $department->seo;
|
||||
$seo = $department->seo ?? null;
|
||||
return Inertia::render('Client/Departments/Show', compact('department', 'departments', 'directions', 'seo'));
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class ClientDivisionController extends Controller
|
||||
{
|
||||
$divisions = DivisionResource::collection(Division::query()->where('is_active', true)->get());
|
||||
$division = new DivisionResource(Division::with('workers.userDetail')->where('is_active', true)->where('slug', $slug)->firstOrFail());
|
||||
$seo = $division->seo;
|
||||
$seo = $division->seo ?? null;
|
||||
return Inertia::render('Client/Divisions/Show', compact('divisions', 'division', 'seo'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ class ClientEventController extends Controller
|
||||
$breadcrumbs = null;
|
||||
}
|
||||
|
||||
$seo = $event->seo;
|
||||
$seo = $event->seo ?? null;
|
||||
|
||||
return Inertia::render('Client/Events/Show', compact('event', 'breadcrumbs', 'seo'));
|
||||
}
|
||||
|
||||
@@ -144,7 +144,8 @@ class ClientPostController extends Controller
|
||||
$breadcrumbs = null;
|
||||
}
|
||||
|
||||
$seo = $post->seo;
|
||||
$seo = $post->seo ?? null;
|
||||
|
||||
|
||||
return Inertia::render('Client/Posts/Show', compact('post', 'breadcrumbs', 'seo'));
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ class ClientProgramController extends Controller
|
||||
return [$formEducational->value => $formEducational->getLabel()];
|
||||
});
|
||||
|
||||
$seo = $program->seo;
|
||||
$seo = $program->seo ?? null;
|
||||
return Inertia::render('Client/Programs/Show', compact('program', 'formsEdu', 'seo'));
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,8 @@ class PageController extends Controller
|
||||
$breadcrumbs = null;
|
||||
}
|
||||
|
||||
$seo = $page->seo;
|
||||
$seo = $page->seo ?? null;
|
||||
|
||||
|
||||
|
||||
$page = new PageResource($page);
|
||||
|
||||
Reference in New Issue
Block a user