Files
hoshpoint-backend/app/Filament/Resources/Templates/Schemas/TemplateForm.php
soheil khaledabadi 936f789ac8 feat: Persian panel/API fixes and structural-model tweaks
- lang/fa: add validation/auth/passwords/pagination translations so admin
  and API validation errors are in Persian
- templates: soft-delete instead of cascade-deleting their generations;
  keep resolving trashed template on generations (labels/downloads)
- templates: add TemplateInfolist with a real thumbnail ImageEntry
- generations: auto-name template-based generations and use that name
  for the download file and as a searchable column
- admin: show all dates as Jalali via ->jalaliDate()/->jalaliDateTime()
  Filament macros (App\Support\Jalali)
- wallets: harden the deposit/withdraw action to surface the exact error
  instead of a 500
- profile: normalize Iranian mobile numbers (App\Support\Mobile),
  add social_links, coerce notification-preference booleans, require the
  current password to delete an account

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013P66ea1dC5CVM9t29496t5
2026-09-07 01:00:09 +03:30

71 lines
3.1 KiB
PHP

<?php
namespace App\Filament\Resources\Templates\Schemas;
use App\Models\Category;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Schema;
class TemplateForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
Select::make('category_id')
->label('دسته‌بندی')
->options(fn (): array => Category::query()->pluck('name', 'id')->all())
->searchable()
->required(),
TextInput::make('title')
->label('عنوان')
->required()
->maxLength(255),
TextInput::make('slug')
->label('شناسه')
->required()
->unique(ignoreRecord: true)
->maxLength(255),
Textarea::make('description')
->label('توضیحات')
->maxLength(1000)
->rows(3),
FileUpload::make('file_path')
->label('فایل پاورپوینت')
->disk('local')
->directory('templates/sources')
->acceptedFileTypes(['application/vnd.openxmlformats-officedocument.presentationml.presentation'])
->required()
->visibility('private'),
FileUpload::make('thumbnail_path')
->label('تصویر بندانگشتی')
->disk('public')
->directory('templates/thumbnails')
->visibility('public')
->image()
->imageEditor(),
Toggle::make('is_active')
->label('فعال')
->default(true),
Toggle::make('is_ai_enabled')
->label('امکان ساخت با هوش مصنوعی از متن')
->helperText('در صورت فعال بودن، این قالب در فرم «ساخت پاورپوینت از متن» به کاربران پیشنهاد داده می‌شود.')
->default(false)
->live(),
TextInput::make('ai_repeatable_slide_number')
->label('شماره اسلاید تکرارشونده')
->helperText('شماره اسلایدی از فایل پاورپوینت که برای هر بخش محتوای تولیدشده با هوش مصنوعی شبیه‌سازی می‌شود (مثلاً 2).')
->numeric()
->integer()
->minValue(1)
->visible(fn (Get $get): bool => (bool) $get('is_ai_enabled'))
->required(fn (Get $get): bool => (bool) $get('is_ai_enabled')),
]);
}
}