This commit is contained in:
f4ilji
2024-11-17 01:33:09 +05:00
parent 7b9dc03420
commit af69b48247
33 changed files with 367 additions and 210 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ RUN apt-get update && apt-get install -y \
zip \ zip \
unzip \ unzip \
git && \ git && \
docker-php-ext-configure gd --with-webp --with-jpeg && \ docker-php-ext-configure gd --with-webp --with-jpeg --with-png && \
docker-php-ext-install gd && \ docker-php-ext-install gd && \
docker-php-ext-install pdo_mysql && \ docker-php-ext-install pdo_mysql && \
docker-php-ext-install bcmath && \ docker-php-ext-install bcmath && \
+3 -3
View File
@@ -66,11 +66,11 @@ class PageForm
Forms\Components\Grid::make(2)->schema([ Forms\Components\Grid::make(2)->schema([
TextInput::make('title')->label('Заголовок')->required() TextInput::make('title')->label('Заголовок')->required()
->live(onBlur: true) ->live(onBlur: true)
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set) { ->afterStateUpdated(function (string $operation, string|null $state, Forms\Set $set) {
$set('slug', Str::slug($state)); $set('slug', Str::slug($state));
$set('path', Str::slug($state)); $set('path', Str::slug($state));
}), }),
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->required() TextInput::make('slug')->label('Текстовый идентификатор страницы')->unique(ignoreRecord: true)->required()
->live(onBlur: true) ->live(onBlur: true)
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set, $get) { ->afterStateUpdated(function (string $operation, string $state, Forms\Set $set, $get) {
$set('path', Str::slug($state)); $set('path', Str::slug($state));
@@ -98,7 +98,7 @@ class PageForm
ContentBuilderItem::getItem('content') ContentBuilderItem::getItem('content')
]), ]),
Forms\Components\Tabs\Tab::make('Настройки')->schema([ Forms\Components\Tabs\Tab::make('Настройки')->schema([
Select::make('template')->options(self::getPageTemplates())->required(), Select::make('template')->label('Шаблон')->options(self::getPageTemplates())->required(),
]), ]),
]), ]),
@@ -50,8 +50,8 @@ class UserDetailForm
Forms\Components\FileUpload::make('photo') Forms\Components\FileUpload::make('photo')
->label('Фотография') ->label('Фотография')
->image() ->image()
->optimize('jpg') // ->optimize('jpg')
->resize(30) // ->resize(30)
->disk('public') ->disk('public')
->imageEditor() ->imageEditor()
->directory('images') ->directory('images')
@@ -423,15 +423,15 @@ class AcademicJournalResource extends Resource
Tabs\Tab::make('Редакция') Tabs\Tab::make('Редакция')
->schema([ ->schema([
Forms\Components\Section::make('Главный редактор')->schema([ Forms\Components\Section::make('Главный редактор')->schema([
Forms\Components\Repeater::make('chief_editor')->schema([ Forms\Components\Repeater::make('chief_editor')->label('')->schema([
TextInput::make('name')->label('Имя'), TextInput::make('name')->label('Имя'),
TextInput::make('academicTitle')->label('Ученная степень'), TextInput::make('academicTitle')->label('Ученная степень'),
TextInput::make('position')->label('Должность'), TextInput::make('position')->label('Должность'),
TextInput::make('institution')->label('Учереждение'), TextInput::make('institution')->label('Учереждение'),
])->maxItems(1), ])->maxItems(1)->reorderable(false),
]), ]),
Forms\Components\Section::make('Редакторы')->schema([ Forms\Components\Section::make('Редакторы')->schema([
Forms\Components\Repeater::make('editors')->schema([ Forms\Components\Repeater::make('editors')->label('')->schema([
TextInput::make('name')->label('Имя'), TextInput::make('name')->label('Имя'),
TextInput::make('academicTitle')->label('Ученная степень'), TextInput::make('academicTitle')->label('Ученная степень'),
TextInput::make('position')->label('Должность'), TextInput::make('position')->label('Должность'),
@@ -20,6 +20,11 @@ class AcceptedInvitationResource extends Resource implements HasShieldPermission
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
public static ?string $label = 'Принятое приглашение';
protected static ?string $pluralLabel = 'Принятные приглашения';
public static function form(Form $form): Form public static function form(Form $form): Form
{ {
return $form return $form
@@ -11,6 +11,7 @@ use Filament\Forms\Components\TextInput;
use Filament\Forms\Form; use Filament\Forms\Form;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
@@ -32,18 +33,21 @@ class AdditionalEducationCategoryResource extends Resource
{ {
return $form return $form
->schema([ ->schema([
Forms\Components\Grid::make('2')->schema([ Forms\Components\Section::make()->schema([
TextInput::make('title')->label('Заголовок')->required() Forms\Components\Grid::make('2')->schema([
->live(onBlur: true) TextInput::make('title')->label('Заголовок')->required()
->afterStateUpdated(function (string $operation, string|null $state, Forms\Set $set) { ->live(onBlur: true)
$set('slug', Str::slug($state)); ->afterStateUpdated(function (string $operation, string|null $state, Forms\Set $set) {
$set('seo.title', $state); $set('slug', Str::slug($state));
}), $set('seo.title', $state);
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(), }),
Forms\Components\Select::make('dir_addit_educat_id')->required() TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(),
->options(DirectionAdditionalEducation::where('is_active', true)->pluck('title', 'id')) Forms\Components\Select::make('dir_addit_educat_id')->required()->label('Направление доп. образования')
->preload()
->options(DirectionAdditionalEducation::where('is_active', true)->pluck('title', 'id'))
]),
Forms\Components\Toggle::make('is_active')->label('Активно')->columnSpanFull()->inline(false)->default(true),
]), ]),
Forms\Components\Toggle::make('is_active')->columnSpanFull()->inline(false)->default(true),
]); ]);
} }
@@ -51,7 +55,11 @@ class AdditionalEducationCategoryResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
// TextColumn::make('id')->label('ID')->sortable(),
TextColumn::make('title')->label('Название')->sortable()->searchable(),
TextColumn::make('created_at')->label('Дата создания')->sortable(),
Tables\Columns\BadgeColumn::make('direction.title')->label('Направление')->sortable(),
Tables\Columns\ToggleColumn::make('is_active')->label('Активно')->sortable(),
]) ])
->filters([ ->filters([
// //
@@ -30,6 +30,7 @@ use Filament\Forms\Components\Toggle;
use Filament\Forms\Form; use Filament\Forms\Form;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
@@ -65,17 +66,17 @@ class AdditionalEducationResource extends Resource
}), }),
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(), TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(),
Forms\Components\Select::make('category_id')->required() Forms\Components\Select::make('category_id')->required()->label('Категория')
->options(AdditionalEducationCategory::where('is_active', true)->pluck('title', 'id')) ->options(AdditionalEducationCategory::where('is_active', true)->pluck('title', 'id'))
]), ]),
Forms\Components\TextInput::make('target_group')->required()->columnSpanFull(), Forms\Components\TextInput::make('target_group')->required()->columnSpanFull()->label('Целевая аудитория'),
Forms\Components\TextInput::make('qualification')->required()->columnSpanFull(), Forms\Components\TextInput::make('qualification')->required()->columnSpanFull()->label('Присваиваемая квалификация'),
Forms\Components\Grid::make('2')->schema([ Forms\Components\Grid::make('2')->schema([
Forms\Components\TextInput::make('price')->required()->integer(), Forms\Components\TextInput::make('price')->required()->integer()->label('Стоимость'),
Forms\Components\TextInput::make('learning_time')->required()->integer(), Forms\Components\TextInput::make('learning_time')->required()->integer()->label('Объем обучения'),
]), ]),
Forms\Components\Select::make('form_education')->required()->options(FormEducation::class), Forms\Components\Select::make('form_education')->label('Форма обучения')->required()->options(FormEducation::class),
Forms\Components\Toggle::make('is_active')->columnSpanFull()->inline(false)->default(true), Forms\Components\Toggle::make('is_active')->label('Активно')->columnSpanFull()->inline(false)->default(true),
]), ]),
Tabs\Tab::make('Контент') Tabs\Tab::make('Контент')
->schema([ ->schema([
@@ -446,9 +447,11 @@ class AdditionalEducationResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('id'), TextColumn::make('id')->label('ID')->sortable(),
Tables\Columns\TextColumn::make('title')->searchable()->sortable(), TextColumn::make('title')->label('Название')->sortable()->searchable(),
Tables\Columns\ToggleColumn::make('is_active'), TextColumn::make('created_at')->label('Дата создания')->sortable(),
Tables\Columns\BadgeColumn::make('category.title')->label('Категория')->sortable(),
Tables\Columns\ToggleColumn::make('is_active')->label('Активно')->sortable(),
]) ])
->filters([ ->filters([
// //
+20 -3
View File
@@ -6,12 +6,16 @@ use App\Filament\Resources\CategoryResource\Pages;
use App\Filament\Resources\CategoryResource\RelationManagers; use App\Filament\Resources\CategoryResource\RelationManagers;
use App\Models\Category; use App\Models\Category;
use Filament\Forms; use Filament\Forms;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Forms\Form; use Filament\Forms\Form;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\Str;
class CategoryResource extends Resource class CategoryResource extends Resource
{ {
@@ -33,15 +37,28 @@ class CategoryResource extends Resource
{ {
return $form return $form
->schema([ ->schema([
Forms\Components\TextInput::make('title')->required()->label('Название'), Forms\Components\Section::make()->schema([
]); Forms\Components\Grid::make(2)->schema([
TextInput::make('title')->label('Заголовок')->required()
->live(onBlur: true)
->afterStateUpdated(function (string $operation, string|null $state, Forms\Set $set) {
$set('slug', Str::slug($state));
}),
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(),
]),
Toggle::make('is_active')->default(true)->label('Активно')->inline(false),
]),
]);
} }
public static function table(Table $table): Table public static function table(Table $table): Table
{ {
return $table return $table
->columns([ ->columns([
// TextColumn::make('id')->label('ID')->sortable(),
TextColumn::make('title')->label('Название')->sortable()->searchable(),
TextColumn::make('created_at')->label('Дата создания')->sortable(),
Tables\Columns\ToggleColumn::make('is_active')->label('Активно')->sortable(),
]) ])
->filters([ ->filters([
// //
@@ -54,9 +54,9 @@ class CustomFormResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('title'), Tables\Columns\TextColumn::make('title')->label('Название')->searchable()->sortable(),
Tables\Columns\TextColumn::make('form_id'), Tables\Columns\TextColumn::make('form_id')->label('Индефикатор формы'),
Tables\Columns\TextColumn::make('status'), Tables\Columns\TextColumn::make('status')->label('Статус')->sortable(),
]) ])
->filters([ ->filters([
// //
@@ -190,6 +190,7 @@ class ResponsesRelationManager extends RelationManager
return [ return [
Tables\Columns\TextColumn::make('id')->sortable(), Tables\Columns\TextColumn::make('id')->sortable(),
Tables\Columns\ToggleColumn::make('checked')->label('Просмотрено'), Tables\Columns\ToggleColumn::make('checked')->label('Просмотрено'),
Tables\Columns\TextColumn::make('created_at')->label('Врямя создания')->sortable(),
]; ];
} }
@@ -17,7 +17,7 @@ class CustomFormResponseResource extends Resource
{ {
public static ?string $label = 'Форма'; public static ?string $label = 'Форма';
protected static ?string $pluralLabel = 'Ответы на формы'; protected static ?string $pluralLabel = 'Ответы на формы';
protected static ?string $navigationParentItem = 'Пользовательские Формы'; protected static ?string $navigationParentItem = 'nobody';
protected static ?string $model = CustomFormResponse::class; protected static ?string $model = CustomFormResponse::class;
+15 -9
View File
@@ -27,6 +27,7 @@ use Filament\Forms\Components\Toggle;
use Filament\Forms\Form; use Filament\Forms\Form;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
@@ -58,13 +59,15 @@ class DepartmentResource extends Resource
->tabs([ ->tabs([
Tabs\Tab::make('Основная информация') Tabs\Tab::make('Основная информация')
->schema([ ->schema([
TextInput::make('title')->label('Название факультета')->required() Forms\Components\Grid::make()->schema([
->live(onBlur: true) TextInput::make('title')->label('Название факультета')->required()
->afterStateUpdated(function (string $operation, string|null $state, Forms\Set $set) { ->live(onBlur: true)
$set('slug', Str::slug($state)); ->afterStateUpdated(function (string $operation, string|null $state, Forms\Set $set) {
$set('seo.title', $state); $set('slug', Str::slug($state));
}), $set('seo.title', $state);
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(), }),
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(),
]),
Toggle::make('is_active')->default(true)->label('Активный факультет')->inline(false), Toggle::make('is_active')->default(true)->label('Активный факультет')->inline(false),
Forms\Components\Select::make('faculty_id') Forms\Components\Select::make('faculty_id')
->options(Faculty::all()->pluck('title', 'id')) ->options(Faculty::all()->pluck('title', 'id'))
@@ -452,8 +455,11 @@ class DepartmentResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('title')->label('Название'), TextColumn::make('id')->label('ID')->sortable(),
Tables\Columns\TextColumn::make('faculty.title')->label('Факультет')->words(2) TextColumn::make('title')->label('Название')->sortable()->searchable(),
Tables\Columns\TextColumn::make('faculty.title')->label('Факультет')->words(2),
TextColumn::make('created_at')->label('Дата создания')->sortable(),
Tables\Columns\ToggleColumn::make('is_active')->label('Активно')->sortable(),
]) ])
->filters([ ->filters([
// //
@@ -10,6 +10,7 @@ use Filament\Forms\Components\TextInput;
use Filament\Forms\Form; use Filament\Forms\Form;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
@@ -31,14 +32,18 @@ class DirectionAdditionalEducationResource extends Resource
{ {
return $form return $form
->schema([ ->schema([
TextInput::make('title')->label('Заголовок')->required() Forms\Components\Section::make()->schema([
->live(onBlur: true) Forms\Components\Grid::make()->schema([
->afterStateUpdated(function (string $operation, string|null $state, Forms\Set $set) { TextInput::make('title')->label('Заголовок')->required()
$set('slug', Str::slug($state)); ->live(onBlur: true)
$set('seo.title', $state); ->afterStateUpdated(function (string $operation, string|null $state, Forms\Set $set) {
}), $set('slug', Str::slug($state));
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(), $set('seo.title', $state);
Forms\Components\Toggle::make('is_active')->columnSpanFull()->inline(false)->default(true), }),
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(),
]),
Forms\Components\Toggle::make('is_active')->label('Активно')->columnSpanFull()->inline(false)->default(true),
]),
]); ]);
} }
@@ -46,7 +51,10 @@ class DirectionAdditionalEducationResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
// TextColumn::make('id')->label('ID')->sortable(),
TextColumn::make('title')->label('Название')->sortable()->searchable(),
TextColumn::make('created_at')->label('Дата создания')->sortable(),
Tables\Columns\ToggleColumn::make('is_active')->label('Активно')->sortable(),
]) ])
->filters([ ->filters([
// //
+6 -2
View File
@@ -22,6 +22,7 @@ use Filament\Forms\Components\Toggle;
use Filament\Forms\Form; use Filament\Forms\Form;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@@ -420,8 +421,11 @@ class DivisionResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('title'), TextColumn::make('id')->label('ID')->sortable(),
]) TextColumn::make('title')->label('Название')->sortable()->searchable(),
TextColumn::make('created_at')->label('Дата создания')->sortable(),
Tables\Columns\ToggleColumn::make('is_active')->label('Активно')->sortable(),
])
->filters([ ->filters([
// //
]) ])
@@ -10,6 +10,7 @@ use Filament\Forms;
use Filament\Forms\Form; use Filament\Forms\Form;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
@@ -28,10 +29,12 @@ class EducationalGroupResource extends Resource
{ {
return $form return $form
->schema([ ->schema([
Forms\Components\Grid::make(2)->schema([ Forms\Components\Section::make()->schema([
Forms\Components\TextInput::make('title')->label('Название группы')->required(), Forms\Components\Grid::make(2)->schema([
Forms\Components\Select::make('faculty_id')->label('Факультет')->required() Forms\Components\TextInput::make('title')->label('Название группы')->required(),
->options(Faculty::all()->pluck('title', 'id')) Forms\Components\Select::make('faculty_id')->label('Факультет')->required()
->options(Faculty::all()->pluck('title', 'id'))
]),
]), ]),
]); ]);
} }
@@ -40,9 +43,10 @@ class EducationalGroupResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('id')->label('ID'), TextColumn::make('id')->label('ID')->sortable(),
Tables\Columns\TextColumn::make('title')->label('Название'), TextColumn::make('title')->label('Название')->sortable()->searchable(),
Tables\Columns\TextColumn::make('faculty.title')->label('Факультет'), TextColumn::make('created_at')->label('Дата создания')->sortable(),
Tables\Columns\BadgeColumn::make('faculty.title')->label('Категория')->sortable(),
]) ])
->filters([ ->filters([
// //
@@ -6,12 +6,15 @@ use App\Filament\Resources\EventCategoryResource\Pages;
use App\Filament\Resources\EventCategoryResource\RelationManagers; use App\Filament\Resources\EventCategoryResource\RelationManagers;
use App\Models\EventCategory; use App\Models\EventCategory;
use Filament\Forms; use Filament\Forms;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form; use Filament\Forms\Form;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\Str;
class EventCategoryResource extends Resource class EventCategoryResource extends Resource
{ {
@@ -29,7 +32,16 @@ class EventCategoryResource extends Resource
{ {
return $form return $form
->schema([ ->schema([
Forms\Components\TextInput::make('title')->required()->label('Название'), Forms\Components\Section::make()->schema([
Forms\Components\Grid::make()->schema([
Forms\Components\TextInput::make('title')->label('Название категории')->required()
->live(onBlur: true)
->afterStateUpdated(function (string $operation, string|null $state, Forms\Set $set) {
$set('slug', Str::slug($state));
}),
TextInput::make('slug')->label('Текстовый идентификатор категории')->unique(ignoreRecord: true)->readOnly()->required(),
]),
]),
]); ]);
} }
@@ -37,7 +49,9 @@ class EventCategoryResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
// TextColumn::make('id')->label('ID')->sortable(),
TextColumn::make('title')->label('Название')->sortable()->searchable(),
TextColumn::make('created_at')->label('Дата создания')->sortable(),
]) ])
->filters([ ->filters([
// //
+5 -2
View File
@@ -23,6 +23,7 @@ use Filament\Forms\Components\Toggle;
use Filament\Forms\Form; use Filament\Forms\Form;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@@ -182,8 +183,10 @@ class EventResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('title') TextColumn::make('id')->label('ID')->sortable(),
->searchable(), TextColumn::make('title')->label('Название')->sortable()->searchable(),
TextColumn::make('event_date_start')->label('Начало мероприятия')->sortable(),
TextColumn::make('created_at')->label('Дата создания')->sortable(),
]) ])
->filters([ ->filters([
// //
@@ -24,6 +24,7 @@ use Filament\Forms\Components\Toggle;
use Filament\Forms\Form; use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager; use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables; use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
@@ -55,6 +56,10 @@ class DepartmentsRelationManager extends RelationManager
}), }),
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(), TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(),
Toggle::make('is_active')->default(true)->label('Активный факультет')->inline(false), Toggle::make('is_active')->default(true)->label('Активный факультет')->inline(false),
Forms\Components\Select::make('faculty_id')
->options(Faculty::all()->pluck('title', 'id'))
->label('Факультет')
->required(),
]), ]),
Tabs\Tab::make('Описание факультета') Tabs\Tab::make('Описание факультета')
->schema([ ->schema([
@@ -434,8 +439,10 @@ class DepartmentsRelationManager extends RelationManager
return $table return $table
->recordTitleAttribute('title') ->recordTitleAttribute('title')
->columns([ ->columns([
Tables\Columns\TextColumn::make('title')->label('Заголовок'), TextColumn::make('id')->label('ID')->sortable(),
]) TextColumn::make('title')->label('Название')->sortable()->searchable(),
TextColumn::make('created_at')->label('Дата создания')->sortable(),
Tables\Columns\ToggleColumn::make('is_active')->label('Активно')->sortable(), ])
->filters([ ->filters([
// //
]) ])
+8 -3
View File
@@ -28,6 +28,7 @@ use Filament\Forms\Components\Toggle;
use Filament\Forms\Form; use Filament\Forms\Form;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
@@ -445,8 +446,11 @@ class FacultyResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('title')->label('Название') TextColumn::make('id')->label('ID')->sortable(),
]) TextColumn::make('title')->label('Название')->sortable()->searchable(),
TextColumn::make('created_at')->label('Дата создания')->sortable(),
Tables\Columns\ToggleColumn::make('is_active')->label('Активно')->sortable(),
])
->filters([ ->filters([
// //
]) ])
@@ -463,7 +467,8 @@ class FacultyResource extends Resource
public static function getRelations(): array public static function getRelations(): array
{ {
return [ return [
WorkersRelationManager::class WorkersRelationManager::class,
DepartmentsRelationManager::class,
]; ];
} }
@@ -0,0 +1,50 @@
<?php
namespace App\Filament\Resources\FacultyResource\RelationManagers;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class DepartmentsRelationManager extends RelationManager
{
protected static string $relationship = 'departments';
public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('title')
->required()
->maxLength(255),
]);
}
public function table(Table $table): Table
{
return $table
->recordTitleAttribute('title')
->columns([
Tables\Columns\TextColumn::make('title'),
])
->filters([
//
])
->headerActions([
Tables\Actions\CreateAction::make(),
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
}
+11 -6
View File
@@ -25,6 +25,7 @@ class MainSectionResource extends Resource
protected static ?string $navigationIcon = 'heroicon-o-folder'; protected static ?string $navigationIcon = 'heroicon-o-folder';
public static ?string $label = 'Главный раздел'; public static ?string $label = 'Главный раздел';
public static ?string $pluralLabel = 'Главные разделы'; public static ?string $pluralLabel = 'Главные разделы';
@@ -40,12 +41,16 @@ class MainSectionResource extends Resource
{ {
return $form return $form
->schema([ ->schema([
Forms\Components\TextInput::make('title')->label('Название раздела')->required() Forms\Components\Section::make()->schema([
->live(onBlur: true) Forms\Components\Grid::make()->schema([
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set) { Forms\Components\TextInput::make('title')->label('Название раздела')->required()
$set('slug', Str::slug($state)); ->live(onBlur: true)
}), ->afterStateUpdated(function (string $operation, string|null $state, Forms\Set $set) {
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(), $set('slug', Str::slug($state));
}),
TextInput::make('slug')->label('Текстовый идентификатор раздела')->unique(ignoreRecord: true)->readOnly()->required(),
]),
]),
]); ]);
} }
@@ -18,6 +18,7 @@ use Filament\Forms\Components\Toggle;
use Filament\Forms\Form; use Filament\Forms\Form;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
@@ -27,6 +28,11 @@ class PageReferenceListResource extends Resource
{ {
protected static ?string $model = PageReferenceList::class; protected static ?string $model = PageReferenceList::class;
public static ?string $label = 'Список ресурсов';
protected static ?string $pluralLabel = 'Списки ресурсов';
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
public static function form(Form $form): Form public static function form(Form $form): Form
@@ -49,9 +55,9 @@ class PageReferenceListResource extends Resource
Toggle::make('is_active')->default(true)->label('Активный ресурс')->inline(false), Toggle::make('is_active')->default(true)->label('Активный ресурс')->inline(false),
]) ])
]), ]),
Tabs\Tab::make('Содержание новости') Tabs\Tab::make('Содержание ресурса')
->schema([ ->schema([
Repeater::make('content')->schema([ Repeater::make('content')->label('Ресурсы')->schema([
Forms\Components\Section::make('Быстрая настройка ресурса')->schema([ Forms\Components\Section::make('Быстрая настройка ресурса')->schema([
Forms\Components\Grid::make()->schema([ Forms\Components\Grid::make()->schema([
Forms\Components\Select::make('model_select') Forms\Components\Select::make('model_select')
@@ -114,9 +120,9 @@ class PageReferenceListResource extends Resource
}), }),
]), ]),
]), ]),
TextInput::make('title')->label('Title')->required(), TextInput::make('title')->label('Заголовок ресурса')->required(),
FileUpload::make('image') FileUpload::make('image')
->label('Изображение') ->label('Изображение предпросмотра')
->image() ->image()
->optimize('webp') ->optimize('webp')
->resize(50) ->resize(50)
@@ -144,7 +150,10 @@ class PageReferenceListResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
// TextColumn::make('id')->label('ID')->sortable(),
TextColumn::make('title')->label('Название')->sortable()->searchable(),
TextColumn::make('created_at')->label('Дата создания')->sortable(),
Tables\Columns\ToggleColumn::make('is_active')->label('Активно')->sortable(),
]) ])
->filters([ ->filters([
// //
+4 -4
View File
@@ -59,10 +59,10 @@ class PostResource extends Resource implements HasShieldPermissions
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('id'), Tables\Columns\TextColumn::make('id')->sortable(),
Tables\Columns\TextColumn::make('title')->label('Заголовок')->searchable(), Tables\Columns\TextColumn::make('title')->label('Заголовок')->sortable()->searchable(),
Tables\Columns\TextColumn::make('status')->label('Статус')->badge(), Tables\Columns\TextColumn::make('status')->label('Статус')->sortable()->badge(),
Tables\Columns\TextColumn::make('publish_at')->sortable(), Tables\Columns\TextColumn::make('publish_at')->label('Дата публикации')->sortable(),
])->defaultSort('publish_at', 'desc') ])->defaultSort('publish_at', 'desc')
->filters([ ->filters([
+13 -6
View File
@@ -24,6 +24,8 @@ class SubSectionResource extends Resource
protected static ?string $pluralLabel = 'Подразделы'; protected static ?string $pluralLabel = 'Подразделы';
public static ?string $label = 'Подраздел';
protected static ?string $navigationGroup = 'Структура приложения'; protected static ?string $navigationGroup = 'Структура приложения';
@@ -31,12 +33,17 @@ class SubSectionResource extends Resource
{ {
return $form return $form
->schema([ ->schema([
Forms\Components\TextInput::make('title')->label('Название подраздела')->required()
->live(onBlur: true) Forms\Components\Section::make()->schema([
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set) { Forms\Components\Grid::make()->schema([
$set('slug', Str::slug($state)); Forms\Components\TextInput::make('title')->label('Название подраздела')->required()
}), ->live(onBlur: true)
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(), ->afterStateUpdated(function (string $operation, string $state, Forms\Set $set) {
$set('slug', Str::slug($state));
}),
TextInput::make('slug')->label('Текстовый идентификатор подраздела')->unique(ignoreRecord: true)->readOnly()->required(),
]),
]),
// Forms\Components\Select::make('page_ids')->options( // Forms\Components\Select::make('page_ids')->options(
// Page::query()->when(function ($query) { // Page::query()->when(function ($query) {
+4 -11
View File
@@ -65,21 +65,14 @@ class UserResource extends Resource implements HasShieldPermissions
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('name') Tables\Columns\TextColumn::make('name')->label('ФИО')
->searchable(), ->searchable()->sortable(),
Tables\Columns\TextColumn::make('email') Tables\Columns\TextColumn::make('email')->label('Email')
->searchable(), ->searchable()->sortable(),
Tables\Columns\TextColumn::make('email_verified_at')
->dateTime()
->sortable(),
Tables\Columns\TextColumn::make('created_at') Tables\Columns\TextColumn::make('created_at')
->dateTime() ->dateTime()
->sortable() ->sortable()
->toggleable(isToggledHiddenByDefault: true), ->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
]) ])
->filters([ ->filters([
// //
@@ -30,7 +30,6 @@ class UserDetailRelationManager extends RelationManager
return $table return $table
->recordTitleAttribute('user_id') ->recordTitleAttribute('user_id')
->columns([ ->columns([
Tables\Columns\TextColumn::make('user_id'),
]) ])
->filters([ ->filters([
// //
@@ -10,6 +10,7 @@ use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Hidden; use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\RichEditor; use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Section; use Filament\Forms\Components\Section;
use Filament\Forms\Components\Tabs;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Forms\Form; use Filament\Forms\Form;
use Filament\Resources\Resource; use Filament\Resources\Resource;
@@ -35,107 +36,115 @@ class VirtualExhibitionResource extends Resource
{ {
return $form return $form
->schema([ ->schema([
Forms\Components\Grid::make()->schema([ Section::make()
Forms\Components\TextInput::make('title')->required()->label('Заголовок'), ->schema([
Forms\Components\TextInput::make('category')->required()->label('Категория (Необязательно)'), Tabs::make('Tabs')
]), ->tabs([
Tabs\Tab::make('Основная информация')
->schema([
Forms\Components\Grid::make()->schema([
Forms\Components\TextInput::make('title')->required()->label('Заголовок'),
Forms\Components\TextInput::make('category')->required()->label('Категория (Необязательно)'),
]),
Forms\Components\Textarea::make('preview_text')->required()->label('Текст анонса')
->required()
->columnSpanFull(),
Forms\Components\Toggle::make('is_active')->required()->label('Активно')->default(true),
]),
Tabs\Tab::make('Содержание выставки')
->schema([
\Filament\Forms\Components\Builder::make('content')->label('')->blocks([
Builder\Block::make('heading')->label('Заголовок')
->schema([
TextInput::make('id')->hidden()->integer()->default(rand(2335235,324634264263426)),
TextInput::make('content')
->label('')
->live(onBlur: true)
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set, $get) {
}),
]),
Builder\Block::make('paragraph')
->schema([
RichEditor::make('content')
->toolbarButtons([
'blockquote',
'bold',
'bulletList',
'italic',
'link',
'orderedList',
'redo',
'strike',
'underline',
'undo',
])
->label('')
->required()
Forms\Components\Textarea::make('preview_text')->required()->label('Текст анонса') ]),
->required() Builder\Block::make('image')
->columnSpanFull(), ->schema([
FileUpload::make('url')
->label('Изображение(-я)')
->image()
->multiple()
->reorderable()
->maxFiles(5)
->disk('public')
->directory('images')
->imageEditor()
->required(),
TextInput::make('alt')
->label('Описание')
->placeholder('Необязяательно')
])->label('Изображение(-я)'),
Builder\Block::make('video')
->schema([
Hidden::make('mime'),
Section::make('Контент')->schema([ TextInput::make('title')
\Filament\Forms\Components\Builder::make('content')->label('')->blocks([ ->required()
Builder\Block::make('heading')->label('Заголовок') ->maxLength(255)
->schema([ ->autofocus(),
TextInput::make('id')->hidden()->integer()->default(rand(2335235,324634264263426)),
TextInput::make('content') FileUpload::make('path')
->label('') ->required()
->live(onBlur: true) ->acceptedFileTypes(['video/mp4','video/ogg','video/webm'])
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set, $get) { ->maxSize(512000)
}), ->disk('videos')
->visibility('public')
->afterStateUpdated(fn (callable $set, $state) => $set('mime', $state?->getMimeType())),
]),
Builder\Block::make('files')
->schema([
TextInput::make('title')
->required()
->maxLength(255)
->autofocus(),
FileUpload::make('path')
->required()
->acceptedFileTypes([
'application/pdf',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'application/zip'
])
->maxSize(512000)
->disk('public')
->directory('files')
->downloadable()
->visibility('public')
])
])
->collapsed()
->blockNumbers(false)
->collapsible()
->addActionLabel('Добавить новый блок'),
]),
]), ]),
Builder\Block::make('paragraph') ]),
->schema([
RichEditor::make('content')
->toolbarButtons([
'blockquote',
'bold',
'bulletList',
'italic',
'link',
'orderedList',
'redo',
'strike',
'underline',
'undo',
])
->label('')
->required()
]),
Builder\Block::make('image')
->schema([
FileUpload::make('url')
->label('Изображение(-я)')
->image()
->multiple()
->reorderable()
->maxFiles(5)
->disk('public')
->directory('images')
->imageEditor()
->required(),
TextInput::make('alt')
->label('Описание')
->placeholder('Необязяательно')
])->label('Изображение(-я)'),
Builder\Block::make('video')
->schema([
Hidden::make('mime'),
TextInput::make('title')
->required()
->maxLength(255)
->autofocus(),
FileUpload::make('path')
->required()
->acceptedFileTypes(['video/mp4','video/ogg','video/webm'])
->maxSize(512000)
->disk('videos')
->visibility('public')
->afterStateUpdated(fn (callable $set, $state) => $set('mime', $state?->getMimeType())),
]),
Builder\Block::make('files')
->schema([
TextInput::make('title')
->required()
->maxLength(255)
->autofocus(),
FileUpload::make('path')
->required()
->acceptedFileTypes([
'application/pdf',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'application/zip'
])
->maxSize(512000)
->disk('public')
->directory('files')
->downloadable()
->visibility('public')
])
])
->collapsed()
->blockNumbers(false)
->collapsible()
->addActionLabel('Добавить новый блок'),
]),
Forms\Components\Toggle::make('is_active')->required()->label('Активная заметка')->default(true),
]); ]);
} }
@@ -18,7 +18,7 @@ class ClientDivisionController extends Controller
public function show(string $slug) public function show(string $slug)
{ {
$divisions = DivisionResource::collection(Division::query()->where('is_active', true)->get()); $divisions = DivisionResource::collection(Division::query()->where('is_active', true)->get());
$division = new DivisionResource(Division::with('workers.userDetail')->where('is_active', true)->where('slug', $slug)->first()); $division = new DivisionResource(Division::with('workers.userDetail')->where('is_active', true)->where('slug', $slug)->firstOrFail());
$seo = $division->seo; $seo = $division->seo;
return Inertia::render('Client/Divisions/Show', compact('divisions', 'division', 'seo')); return Inertia::render('Client/Divisions/Show', compact('divisions', 'division', 'seo'));
} }
@@ -2,7 +2,7 @@
<div class="flex flex-col rounded-xl p-4 md:p-6 bg-white border border-gray-200 dark:bg-slate-900 dark:border-gray-700"> <div class="flex flex-col rounded-xl p-4 md:p-6 bg-white border border-gray-200 dark:bg-slate-900 dark:border-gray-700">
<div class="flex items-center gap-y-4 gap-x-4 md:flex-nowrap"> <div class="flex items-center gap-y-4 gap-x-4 md:flex-nowrap">
<img @click="toggler = !toggler" loading="lazy" class="rounded-xl md:w-[150px]" :src="'/storage/' + teacher.photo" alt="Image Description"> <img v-if="teacher.photo" @click="toggler = !toggler" loading="lazy" class="rounded-xl md:w-[150px]" :src="'/storage/' + teacher.photo" alt="Image Description">
<div class="grow"> <div class="grow">
<Link :href="route('client.person.show', teacher.slug)" class="font-medium text-gray-800 hover:text-gray-500 underline"> <Link :href="route('client.person.show', teacher.slug)" class="font-medium text-gray-800 hover:text-gray-500 underline">
{{ teacher.position }}: {{ teacher.name }} {{ teacher.position }}: {{ teacher.name }}
@@ -2,7 +2,7 @@
<div class="flex flex-col rounded-xl p-4 md:p-6 bg-white border border-gray-200 dark:bg-slate-900 dark:border-gray-700"> <div class="flex flex-col rounded-xl p-4 md:p-6 bg-white border border-gray-200 dark:bg-slate-900 dark:border-gray-700">
<div class="flex items-center gap-y-4 gap-x-4 md:flex-nowrap"> <div class="flex items-center gap-y-4 gap-x-4 md:flex-nowrap">
<img @click="toggler = !toggler" loading="lazy" class="rounded-xl md:w-[150px]" :src="'/storage/' + worker.photo" alt="Image Description"> <img v-if="worker.photo" @click="toggler = !toggler" loading="lazy" class="rounded-xl md:w-[150px]" :src="'/storage/' + worker.photo" alt="Image Description">
<div class="grow"> <div class="grow">
<Link :href="route('client.person.show', worker.slug)" class="font-medium text-gray-800 hover:text-gray-500 underline"> <Link :href="route('client.person.show', worker.slug)" class="font-medium text-gray-800 hover:text-gray-500 underline">
{{ worker.position }}: {{ worker.name }} {{ worker.position }}: {{ worker.name }}
@@ -2,7 +2,7 @@
<div class="flex flex-col rounded-xl p-4 md:p-6 bg-white border border-gray-200 dark:bg-slate-900 dark:border-gray-700"> <div class="flex flex-col rounded-xl p-4 md:p-6 bg-white border border-gray-200 dark:bg-slate-900 dark:border-gray-700">
<div class="flex items-center gap-y-4 gap-x-4 md:flex-nowrap"> <div class="flex items-center gap-y-4 gap-x-4 md:flex-nowrap">
<img @click="toggler = !toggler" loading="lazy" class="rounded-xl md:w-[150px]" :src="'/storage/' + worker.photo" alt="Image Description"> <img v-if="worker.photo" @click="toggler = !toggler" loading="lazy" class="rounded-xl md:w-[150px]" :src="'/storage/' + worker.photo" alt="Image Description">
<div class="grow"> <div class="grow">
<Link :href="route('client.person.show', worker.slug)" class="font-medium text-gray-800 hover:text-gray-500 underline"> <Link :href="route('client.person.show', worker.slug)" class="font-medium text-gray-800 hover:text-gray-500 underline">
{{ worker.administrativePosition }}: {{ worker.name }} {{ worker.administrativePosition }}: {{ worker.name }}
@@ -2,7 +2,7 @@
<div class="flex flex-col rounded-xl p-4 md:p-6 bg-white border border-gray-200 dark:bg-slate-900 dark:border-gray-700"> <div class="flex flex-col rounded-xl p-4 md:p-6 bg-white border border-gray-200 dark:bg-slate-900 dark:border-gray-700">
<div class="flex items-center gap-y-4 gap-x-4 md:flex-nowrap"> <div class="flex items-center gap-y-4 gap-x-4 md:flex-nowrap">
<img @click="toggler = !toggler" loading="lazy" class="rounded-xl md:w-[150px]" :src="'/storage/' + worker.photo" alt="Image Description"> <img v-if="worker.photo" @click="toggler = !toggler" loading="lazy" class="rounded-xl md:w-[150px]" :src="'/storage/' + worker.photo" alt="Image Description">
<div class="grow"> <div class="grow">
<Link :href="route('client.person.show', worker.slug)" class="font-medium text-gray-800 hover:text-gray-500 underline"> <Link :href="route('client.person.show', worker.slug)" class="font-medium text-gray-800 hover:text-gray-500 underline">
{{ worker.position }}: {{ worker.name }} {{ worker.position }}: {{ worker.name }}
+1 -1
View File
@@ -16,7 +16,7 @@
<PersonBreadcrumbs class="mb-4" :person-name="person.data.name" /> <PersonBreadcrumbs class="mb-4" :person-name="person.data.name" />
<div class="flex items-center gap-x-10 gap-y-4 flex-wrap"> <div class="flex items-center gap-x-10 gap-y-4 flex-wrap">
<PersonAvatarBlock :photo="person.data.details.photo" /> <PersonAvatarBlock v-if="person.data.details.photo" :photo="person.data.details.photo" />
<div class="grow"> <div class="grow">
<h1 class="text-2xl font-medium text-gray-800 dark:text-neutral-200"> <h1 class="text-2xl font-medium text-gray-800 dark:text-neutral-200">
{{ person.data.name }} {{ person.data.name }}