added feature for binding form to page and fixing bugs
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Filament\Components\Forms;
|
||||
use App\Enums\CustomFormStatus;
|
||||
use App\Enums\PostStatus;
|
||||
use App\Filament\Components\Forms\ItemForm\Pages\ContentBuilderItem;
|
||||
use App\Models\CustomForm;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Actions\Action;
|
||||
use Filament\Forms\Components\Section;
|
||||
@@ -142,6 +143,12 @@ class PageForm
|
||||
->label('Скрыть хлебные крошки')
|
||||
->helperText('Скрывает навигационную цепочку вверху страницы')
|
||||
->columnSpan(1),
|
||||
Select::make('settings.custom_form')->label('Прикрепить форму для страницы')
|
||||
->searchable()
|
||||
->preload()
|
||||
->options(CustomForm::query()
|
||||
->where('status', CustomFormStatus::PUBLISHED)->pluck('title', 'form_id'))
|
||||
->columnSpanFull()
|
||||
])
|
||||
->columns(2),
|
||||
]),
|
||||
|
||||
@@ -88,7 +88,6 @@ class AdditionalEducationResource extends Resource
|
||||
|
||||
TextInput::make('qualification')
|
||||
->label('Выдаваемый документ')
|
||||
->required()
|
||||
->maxLength(255)
|
||||
->placeholder('Например: "Удостоверение о повышении квалификации"')
|
||||
->columnSpanFull()
|
||||
|
||||
@@ -141,11 +141,18 @@ class ClientAdditionalEducationController extends Controller
|
||||
fn() => $this->seoPageProvider->getSeoForModel($additionalEducationModel)
|
||||
);
|
||||
|
||||
if (array_key_exists('custom_form', request()->input('settings_page'))) {
|
||||
$form = request()->input('settings_page')['custom_form'];
|
||||
} else {
|
||||
$form = null;
|
||||
}
|
||||
|
||||
$additionalEducation = new AdditionalEducationResource($additionalEducationModel);
|
||||
|
||||
|
||||
return Inertia::render('Client/Additional-educations/Show', compact(
|
||||
'additionalEducation',
|
||||
'seo'
|
||||
'seo',
|
||||
'form',
|
||||
));
|
||||
}}
|
||||
|
||||
@@ -49,7 +49,7 @@ class MainController extends Controller
|
||||
|
||||
$educations = $this->getEducationsData();
|
||||
|
||||
$posts = Cache::remember('recent_posts', now()->addHour(), function () {
|
||||
$posts = Cache::remember('posts_recent', now()->addHour(), function () {
|
||||
return $this->getRecentPosts();
|
||||
});
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ class PageController extends Controller
|
||||
->first();
|
||||
});
|
||||
|
||||
|
||||
if ($page === null) {
|
||||
abort(404);
|
||||
}
|
||||
@@ -51,6 +52,7 @@ class PageController extends Controller
|
||||
abort($page->code);
|
||||
}
|
||||
|
||||
|
||||
return Inertia::render('Page', compact('page', 'subSectionPages', 'seo'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ class AccessCheck
|
||||
abort($registeredRoute->code);
|
||||
}
|
||||
|
||||
$request->merge(['settings_page' => $registeredRoute->settings]);
|
||||
|
||||
// Если все проверки пройдены, продолжаем выполнение запроса
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
@@ -23,8 +23,9 @@ class FormTimePeriodMiddleware
|
||||
abort(Response::HTTP_NOT_FOUND, 'Form not found');
|
||||
}
|
||||
|
||||
|
||||
if (!isset($form->settings['period'])) {
|
||||
abort(Response::HTTP_BAD_REQUEST, 'Invalid form settings');
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
$period = $form->settings['period'];
|
||||
|
||||
Reference in New Issue
Block a user