Migrate backend to Porto architecture and fix minor bugs
- Fully transitioned the backend to the Porto architectural pattern - Improved code organization and maintainability - Fixed minor bugs and inconsistencies
This commit is contained in:
@@ -2,24 +2,16 @@
|
||||
|
||||
namespace App\Filament\Components\Forms;
|
||||
|
||||
use App\Enums\CustomFormStatus;
|
||||
use App\Enums\PostStatus;
|
||||
use App\Containers\Article\Enums\PostStatus;
|
||||
use App\Containers\Article\Models\Category;
|
||||
use App\Containers\Widget\Models\Slider;
|
||||
use App\Filament\Components\Forms\ItemForm\Pages\ContentBuilderItem;
|
||||
use App\Helpers\ByteConverter;
|
||||
use App\Models\Category;
|
||||
use App\Models\CustomForm;
|
||||
use App\Models\Page;
|
||||
use App\Models\PageReferenceList;
|
||||
use App\Models\Post;
|
||||
use App\Models\Slider;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Builder;
|
||||
use Filament\Forms\Components\ColorPicker;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Grid;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\SpatieTagsInput;
|
||||
@@ -29,13 +21,7 @@ use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Components\ToggleButtons;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Components\Tab;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
|
||||
use Mohamedsabil83\FilamentFormsTinyeditor\Components\TinyEditor;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
|
||||
class PostForm
|
||||
{
|
||||
@@ -99,16 +85,17 @@ class PostForm
|
||||
'Редакция',
|
||||
'Администратор',
|
||||
]),
|
||||
Section::make('Отложенная публикация')
|
||||
Section::make('Публикация по времени')
|
||||
->description('Настройте автоматическую публикацию новости в указанное время')
|
||||
->collapsible()
|
||||
->schema([
|
||||
Grid::make(2)
|
||||
->schema([
|
||||
Toggle::make('publish_setting.publish_after')
|
||||
->label('Включить отложенную публикацию')
|
||||
->label('Включить публикацию по времени')
|
||||
->inline(false)
|
||||
->default(false)
|
||||
->disabled(fn (Forms\Get $get) => $get('publish_setting.publish_at'))
|
||||
->live()
|
||||
->helperText('Активируйте для публикации в указанное время'),
|
||||
DateTimePicker::make('publish_setting.publish_at')
|
||||
@@ -119,6 +106,13 @@ class PostForm
|
||||
->required(fn (Forms\Get $get) => $get('publish_setting.publish_after'))
|
||||
->disabled(fn (Forms\Get $get) => !$get('publish_setting.publish_after'))
|
||||
->native(true)
|
||||
->minDate(function (string $context, $state) {
|
||||
if ($context === 'edit' && $state) {
|
||||
return $state;
|
||||
} else {
|
||||
return now()->ceilHour()->subHour();
|
||||
}
|
||||
})
|
||||
->maxDate(now()->addMonth()),
|
||||
]),
|
||||
]),
|
||||
|
||||
Reference in New Issue
Block a user