feat: add ApiResponse trait for standardized API responses

chore: update composer dependencies to include phppresentation

chore: update composer.lock after adding phppresentation

feat: create categories migration for category management

feat: create templates migration for template storage

feat: create template generations migration for tracking template usage

feat: create template keys migration for template customization

feat: create notifications migration for user notifications

feat: update API routes for categories, templates, and user profile management

docs: update API documentation to include new endpoints for profile and wallet
This commit is contained in:
2026-07-07 01:03:12 +03:30
parent cf0e6f82fd
commit ae974c2afa
68 changed files with 3594 additions and 100 deletions

View File

@@ -0,0 +1,106 @@
<?php
namespace App\Filament\Resources\Templates\RelationManagers;
use App\Enums\TemplateKeyType;
use Filament\Actions\CreateAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
class KeysRelationManager extends RelationManager
{
protected static string $relationship = 'keys';
protected static ?string $title = 'کلیدها';
protected static ?string $modelLabel = 'کلید';
protected static ?string $pluralModelLabel = 'کلیدها';
public function form(Schema $schema): Schema
{
return $schema
->components([
TextInput::make('key')
->label('کلید')
->helperText('در فایل پاورپوینت برای متن به‌صورت {{key}} و برای عکس/چارت به‌صورت نام شکل (shape name) استفاده می‌شود.')
->required()
->maxLength(255),
TextInput::make('label')
->label('برچسب')
->required()
->maxLength(255),
Select::make('type')
->label('نوع')
->options([
TemplateKeyType::Text->value => TemplateKeyType::Text->label(),
TemplateKeyType::Image->value => TemplateKeyType::Image->label(),
TemplateKeyType::Chart->value => TemplateKeyType::Chart->label(),
])
->required()
->live(),
TextInput::make('shape_name')
->label('نام شکل (Shape Name)')
->helperText('نام شکل تعیین‌شده در Selection Pane نرم‌افزار PowerPoint')
->visible(fn (Get $get): bool => $get('type') !== TemplateKeyType::Text->value)
->maxLength(255),
TextInput::make('description')
->label('راهنما')
->helperText('توضیحی که برای مصرف‌کننده API نمایش داده می‌شود')
->maxLength(255),
Toggle::make('is_required')
->label('اجباری')
->default(true),
TextInput::make('sort_order')
->label('ترتیب نمایش')
->numeric()
->integer()
->default(0),
]);
}
public function table(Table $table): Table
{
return $table
->recordTitleAttribute('key')
->columns([
TextColumn::make('key')
->label('کلید')
->searchable()
->sortable(),
TextColumn::make('label')
->label('برچسب')
->searchable(),
TextColumn::make('type')
->label('نوع')
->badge()
->formatStateUsing(fn (TemplateKeyType $state): string => $state->label()),
TextColumn::make('shape_name')
->label('نام شکل')
->placeholder('—'),
IconColumn::make('is_required')
->label('اجباری')
->boolean(),
TextColumn::make('sort_order')
->label('ترتیب')
->sortable(),
])
->defaultSort('sort_order')
->headerActions([
CreateAction::make(),
])
->recordActions([
EditAction::make(),
DeleteAction::make(),
]);
}
}