Changes
This commit is contained in:
@@ -51,7 +51,8 @@ class CreatePost extends CreateRecord
|
||||
{
|
||||
$this->record->seo()->create($this->seoData);
|
||||
$this->sendNotify($this->record, auth()->user());
|
||||
$this->postToSocialMedia($this->publicationAgreements, $this->record->content, $this->record->title, Carbon::parse($this->record->publish_at)->timestamp);
|
||||
$publish_date = ($this->record->publish_at > now()) ? Carbon::parse($this->record->publish_at)->timestamp : null;
|
||||
$this->postToSocialMedia($this->publicationAgreements, $this->record->content, $this->record->title, $publish_date);
|
||||
}
|
||||
|
||||
private function generateSeo(array $data) : array
|
||||
@@ -268,6 +269,7 @@ class CreatePost extends CreateRecord
|
||||
$post_id = $this->record->id;
|
||||
|
||||
|
||||
|
||||
dispatch(new CreateVkPost($title, $text, $images, $post_id, $publish_date));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@ class EditPost extends EditRecord
|
||||
protected function afterSave(): void
|
||||
{
|
||||
$this->record->seo()->update($this->seoData);
|
||||
$this->postToSocialMedia($this->publicationAgreements, $this->record->content, $this->record->title, Carbon::parse($this->record->publish_at)->timestamp);
|
||||
$publish_date = ($this->record->publish_at > now()) ? Carbon::parse($this->record->publish_at)->timestamp : null;
|
||||
$this->postToSocialMedia($this->publicationAgreements, $this->record->content, $this->record->title, $publish_date);
|
||||
}
|
||||
|
||||
private function setPreviewText(array $data) : string|null
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Components\Forms\UserDetailForm;
|
||||
use App\Filament\Resources\UserDetailResource\Pages;
|
||||
use App\Filament\Resources\UserDetailResource\RelationManagers;
|
||||
use App\Models\UserDetail;
|
||||
@@ -30,97 +31,7 @@ class UserDetailResource extends Resource
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Card::make()->schema([
|
||||
Forms\Components\Grid::make(2)->schema([
|
||||
Forms\Components\Select::make('user_id')
|
||||
->relationship('user', 'email')
|
||||
->searchable()
|
||||
->required()
|
||||
->preload()
|
||||
->label('Пользователь'),
|
||||
Forms\Components\Toggle::make('is_only_worker')
|
||||
->inline(false)
|
||||
->label('Только сотрудник')
|
||||
]),
|
||||
]),
|
||||
Tabs::make('Tabs')
|
||||
->tabs([
|
||||
Tabs\Tab::make('Основная информация')
|
||||
->schema([
|
||||
Forms\Components\FileUpload::make('photo')
|
||||
->label('Фотография')
|
||||
->image()
|
||||
->optimize('jpg')
|
||||
->resize(30)
|
||||
->disk('public')
|
||||
->imageEditor()
|
||||
->directory('images')
|
||||
->imageEditor(),
|
||||
Forms\Components\Grid::make()->schema([
|
||||
Forms\Components\TextInput::make('contactEmail')
|
||||
->label('Контактный Email')
|
||||
->maxLength(255),
|
||||
Forms\Components\TextInput::make('contactPhone')
|
||||
->label('Контактный телефон')
|
||||
->maxLength(255),
|
||||
]),
|
||||
]),
|
||||
Tabs\Tab::make('Образование')
|
||||
->schema([
|
||||
Forms\Components\Grid::make()->schema([
|
||||
Forms\Components\TextInput::make('academicTitle')
|
||||
->label('Ученая степень')
|
||||
->maxLength(255),
|
||||
Forms\Components\TextInput::make('AcademicDegree')
|
||||
->label('Ученое звание')
|
||||
->maxLength(255),
|
||||
]),
|
||||
Forms\Components\TextInput::make('education')
|
||||
->label('Образование')
|
||||
->maxLength(255),
|
||||
Forms\Components\Repeater::make('professionalRetraining')->schema([
|
||||
Forms\Components\TextInput::make('item')->label('')->string()->required()
|
||||
])->label('Профессиональная переподготовка'),
|
||||
Forms\Components\Repeater::make('professionalDevelopment')
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('item')->label('')->string()->required()
|
||||
])->label('Повышение квалификации'),
|
||||
Forms\Components\Repeater::make('awards')->schema([
|
||||
Forms\Components\TextInput::make('item')->label('')->string()->required()
|
||||
])->label('Награды'),
|
||||
]),
|
||||
Tabs\Tab::make('Преподавание')
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('workExperience')
|
||||
->label('Стаж работы')
|
||||
->numeric(),
|
||||
Forms\Components\Repeater::make('professDisciplines')->schema([
|
||||
Forms\Components\TextInput::make('item')->label('')->string()->required()
|
||||
])->label('Преподаваемые дисциплины'),
|
||||
]),
|
||||
Tabs\Tab::make('Научная деятельность')
|
||||
->schema([
|
||||
Forms\Components\Repeater::make('attendedConferences')->schema([
|
||||
Forms\Components\TextInput::make('item')->label('')->string()->required()
|
||||
])->label('Преподаваемые дисциплины'),
|
||||
Forms\Components\Repeater::make('participationScienceProjects')->schema([
|
||||
Forms\Components\TextInput::make('item')->label('')->string()->required()
|
||||
])->label('Преподаваемые дисциплины'),
|
||||
Forms\Components\Repeater::make('publications')->schema([
|
||||
Forms\Components\TextInput::make('item')->label('')->string()->required()
|
||||
])->label('Преподаваемые дисциплины'),
|
||||
]),
|
||||
Tabs\Tab::make('Другое')
|
||||
->schema([
|
||||
Forms\Components\Textarea::make('other')
|
||||
->columnSpanFull(),
|
||||
]),
|
||||
|
||||
|
||||
])->columnSpanFull(),
|
||||
]);
|
||||
return UserDetailForm::getForm($form);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\UserResource\RelationManagers;
|
||||
|
||||
use App\Filament\Components\Forms\UserDetailForm;
|
||||
use App\Models\User;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Tabs;
|
||||
@@ -20,87 +21,7 @@ class UserDetailRelationManager extends RelationManager
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Card::make()->schema([
|
||||
Forms\Components\Toggle::make('is_only_worker')
|
||||
->inline(false)
|
||||
->label('Только сотрудник')
|
||||
]),
|
||||
Tabs::make('Tabs')
|
||||
->tabs([
|
||||
Tabs\Tab::make('Основная информация')
|
||||
->schema([
|
||||
Forms\Components\FileUpload::make('photo')
|
||||
->label('Фото')
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('images')
|
||||
->imageEditor()
|
||||
->required(),
|
||||
Forms\Components\Grid::make()->schema([
|
||||
Forms\Components\TextInput::make('contactEmail')
|
||||
->label('Контактный Email')
|
||||
->maxLength(255),
|
||||
Forms\Components\TextInput::make('contactPhone')
|
||||
->label('Контактный телефон')
|
||||
->maxLength(255),
|
||||
]),
|
||||
]),
|
||||
Tabs\Tab::make('Образование')
|
||||
->schema([
|
||||
Forms\Components\Grid::make()->schema([
|
||||
Forms\Components\TextInput::make('academicTitle')
|
||||
->label('Ученая степень')
|
||||
->maxLength(255),
|
||||
Forms\Components\TextInput::make('AcademicDegree')
|
||||
->label('Ученое звание')
|
||||
->maxLength(255),
|
||||
]),
|
||||
Forms\Components\TextInput::make('education')
|
||||
->label('Образование')
|
||||
->maxLength(255),
|
||||
Forms\Components\Repeater::make('professionalRetraining')->schema([
|
||||
Forms\Components\TextInput::make('item')->label('')->string()->required()
|
||||
])->label('Профессиональная переподготовка'),
|
||||
Forms\Components\Repeater::make('professionalDevelopment')
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('item')->label('')->string()->required()
|
||||
])->label('Повышение квалификации'),
|
||||
Forms\Components\Repeater::make('awards')->schema([
|
||||
Forms\Components\TextInput::make('item')->label('')->string()->required()
|
||||
])->label('Награды'),
|
||||
]),
|
||||
Tabs\Tab::make('Преподавание')
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('workExperience')
|
||||
->label('Стаж работы')
|
||||
->numeric(),
|
||||
Forms\Components\Repeater::make('professDisciplines')->schema([
|
||||
Forms\Components\TextInput::make('item')->label('')->string()->required()
|
||||
])->label('Преподаваемые дисциплины'),
|
||||
]),
|
||||
Tabs\Tab::make('Научная деятельность')
|
||||
->schema([
|
||||
Forms\Components\Repeater::make('attendedConferences')->schema([
|
||||
Forms\Components\TextInput::make('item')->label('')->string()->required()
|
||||
])->label('Участие в конференциях'),
|
||||
Forms\Components\Repeater::make('participationScienceProjects')->schema([
|
||||
Forms\Components\TextInput::make('item')->label('')->string()->required()
|
||||
])->label('Участие в научных проектах'),
|
||||
Forms\Components\Repeater::make('publications')->schema([
|
||||
Forms\Components\TextInput::make('item')->label('')->string()->required()
|
||||
])->label('Публикации'),
|
||||
]),
|
||||
Tabs\Tab::make('Другое')
|
||||
->schema([
|
||||
Forms\Components\Textarea::make('other')
|
||||
->columnSpanFull(),
|
||||
]),
|
||||
|
||||
|
||||
])->columnSpanFull(),
|
||||
]);
|
||||
return UserDetailForm::getForm($form);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user