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:
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TemplateGenerations\Pages;
|
||||
|
||||
use App\Filament\Resources\TemplateGenerations\TemplateGenerationResource;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListTemplateGenerations extends ListRecords
|
||||
{
|
||||
protected static string $resource = TemplateGenerationResource::class;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TemplateGenerations\Pages;
|
||||
|
||||
use App\Filament\Resources\TemplateGenerations\TemplateGenerationResource;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewTemplateGeneration extends ViewRecord
|
||||
{
|
||||
protected static string $resource = TemplateGenerationResource::class;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TemplateGenerations\Tables;
|
||||
|
||||
use App\Enums\TemplateGenerationStatus;
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class TemplateGenerationsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('uuid')
|
||||
->label('شناسه')
|
||||
->searchable()
|
||||
->copyable(),
|
||||
TextColumn::make('template.title')
|
||||
->label('قالب')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
TextColumn::make('status')
|
||||
->label('وضعیت')
|
||||
->badge()
|
||||
->formatStateUsing(fn (TemplateGenerationStatus $state): string => $state->label())
|
||||
->color(fn (TemplateGenerationStatus $state): string => match ($state) {
|
||||
TemplateGenerationStatus::Pending => 'gray',
|
||||
TemplateGenerationStatus::Processing => 'warning',
|
||||
TemplateGenerationStatus::Completed => 'success',
|
||||
TemplateGenerationStatus::Failed => 'danger',
|
||||
}),
|
||||
TextColumn::make('requester.name')
|
||||
->label('درخواستدهنده')
|
||||
->searchable()
|
||||
->placeholder('—'),
|
||||
TextColumn::make('error_message')
|
||||
->label('خطا')
|
||||
->limit(50)
|
||||
->placeholder('—'),
|
||||
TextColumn::make('created_at')
|
||||
->label('تاریخ')
|
||||
->dateTime()
|
||||
->sortable(),
|
||||
])
|
||||
->defaultSort('created_at', 'desc')
|
||||
->filters([
|
||||
SelectFilter::make('status')
|
||||
->label('وضعیت')
|
||||
->options([
|
||||
TemplateGenerationStatus::Pending->value => TemplateGenerationStatus::Pending->label(),
|
||||
TemplateGenerationStatus::Processing->value => TemplateGenerationStatus::Processing->label(),
|
||||
TemplateGenerationStatus::Completed->value => TemplateGenerationStatus::Completed->label(),
|
||||
TemplateGenerationStatus::Failed->value => TemplateGenerationStatus::Failed->label(),
|
||||
]),
|
||||
])
|
||||
->recordActions([
|
||||
ViewAction::make(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TemplateGenerations;
|
||||
|
||||
use App\Filament\Resources\TemplateGenerations\Pages\ListTemplateGenerations;
|
||||
use App\Filament\Resources\TemplateGenerations\Pages\ViewTemplateGeneration;
|
||||
use App\Filament\Resources\TemplateGenerations\Tables\TemplateGenerationsTable;
|
||||
use App\Models\TemplateGeneration;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class TemplateGenerationResource extends Resource
|
||||
{
|
||||
protected static ?string $model = TemplateGeneration::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedDocumentArrowDown;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'پاورپوینتها';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'uuid';
|
||||
|
||||
protected static ?string $modelLabel = 'تولید';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'تولیدها';
|
||||
|
||||
protected static ?string $navigationLabel = 'تولیدها';
|
||||
|
||||
protected static ?int $navigationSort = 22;
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return TemplateGenerationsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListTemplateGenerations::route('/'),
|
||||
'view' => ViewTemplateGeneration::route('/{record}'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function canCreate(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function canEdit($record): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function canDelete($record): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user