- Wired the checkout wizard for Google “comfort login”: added Socialite controller + dependency, new Google env
hooks in config/services.php/.env.example, and updated wizard steps/controllers to store session payloads, attach packages, and surface localized success/error states. - Retooled payment handling for both Stripe and PayPal, adding richer status management in CheckoutController/ PayPalController, fallback flows in the wizard’s PaymentStep.tsx, and fresh feature tests for intent creation, webhooks, and the wizard CTA. - Introduced a consent-aware Matomo analytics stack: new consent context, cookie-banner UI, useAnalytics/ useCtaExperiment hooks, and MatomoTracker component, then instrumented marketing pages (Home, Packages, Checkout) with localized copy and experiment tracking. - Polished package presentation across marketing UIs by centralizing formatting in PresentsPackages, surfacing localized description tables/placeholders, tuning badges/layouts, and syncing guest/marketing translations. - Expanded docs & reference material (docs/prp/*, TODOs, public gallery overview) and added a Playwright smoke test for the hero CTA while reconciling outstanding checklist items.
This commit is contained in:
189
app/Filament/Resources/PurchaseHistoryResource.php
Normal file
189
app/Filament/Resources/PurchaseHistoryResource.php
Normal file
@@ -0,0 +1,189 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Exports\PurchaseHistoryExporter;
|
||||
use App\Filament\Resources\PurchaseHistoryResource\Pages;
|
||||
use App\Models\PurchaseHistory;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\ExportBulkAction;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class PurchaseHistoryResource extends Resource
|
||||
{
|
||||
protected static ?string $model = PurchaseHistory::class;
|
||||
|
||||
protected static BackedEnum|string|null $navigationIcon = 'heroicon-o-receipt-refund';
|
||||
|
||||
protected static ?int $navigationSort = 20;
|
||||
|
||||
public static function getNavigationGroup(): string
|
||||
{
|
||||
return __('admin.nav.billing');
|
||||
}
|
||||
|
||||
public static function form(Schema $form): Schema
|
||||
{
|
||||
return $form->schema([
|
||||
Forms\Components\Select::make('tenant_id')
|
||||
->label(__('admin.purchase_history.fields.tenant'))
|
||||
->relationship('tenant', 'name')
|
||||
->searchable()
|
||||
->preload()
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('package_id')
|
||||
->label(__('admin.purchase_history.fields.package'))
|
||||
->required()
|
||||
->maxLength(255),
|
||||
Forms\Components\TextInput::make('credits_added')
|
||||
->label(__('admin.purchase_history.fields.credits'))
|
||||
->numeric()
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('price')
|
||||
->label(__('admin.purchase_history.fields.price'))
|
||||
->numeric()
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('currency')
|
||||
->label(__('admin.purchase_history.fields.currency'))
|
||||
->maxLength(3)
|
||||
->default('EUR'),
|
||||
Forms\Components\TextInput::make('platform')
|
||||
->label(__('admin.purchase_history.fields.platform'))
|
||||
->maxLength(50)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('transaction_id')
|
||||
->label(__('admin.purchase_history.fields.transaction_id'))
|
||||
->maxLength(255),
|
||||
Forms\Components\DateTimePicker::make('purchased_at')
|
||||
->label(__('admin.purchase_history.fields.purchased_at'))
|
||||
->required(),
|
||||
])->columns(2);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('tenant.name')
|
||||
->label(__('admin.purchase_history.fields.tenant'))
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('package_id')
|
||||
->label(__('admin.purchase_history.fields.package'))
|
||||
->badge()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('credits_added')
|
||||
->label(__('admin.purchase_history.fields.credits'))
|
||||
->badge()
|
||||
->color(fn (int $state): string => $state > 0 ? 'success' : ($state < 0 ? 'danger' : 'gray'))
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('price')
|
||||
->label(__('admin.purchase_history.fields.price'))
|
||||
->formatStateUsing(fn ($state, PurchaseHistory $record): string => number_format((float) $state, 2).' '.($record->currency ?? 'EUR'))
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('platform')
|
||||
->label(__('admin.purchase_history.fields.platform'))
|
||||
->badge()
|
||||
->formatStateUsing(function ($state): string {
|
||||
$key = 'admin.purchase_history.platforms.' . (string) $state;
|
||||
$translated = __($key);
|
||||
|
||||
return $translated === $key ? Str::headline((string) $state) : $translated;
|
||||
})
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('transaction_id')
|
||||
->label(__('admin.purchase_history.fields.transaction_id'))
|
||||
->copyable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('purchased_at')
|
||||
->label(__('admin.purchase_history.fields.purchased_at'))
|
||||
->dateTime()
|
||||
->sortable(),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\Filter::make('purchased_at')
|
||||
->label(__('admin.purchase_history.filters.purchased_at'))
|
||||
->form([
|
||||
Forms\Components\DatePicker::make('from')->label(__('admin.common.from')),
|
||||
Forms\Components\DatePicker::make('until')->label(__('admin.common.until')),
|
||||
])
|
||||
->query(function (Builder $query, array $data): Builder {
|
||||
return $query
|
||||
->when(
|
||||
$data['from'] ?? null,
|
||||
fn (Builder $builder, $date): Builder => $builder->whereDate('purchased_at', '>=', $date),
|
||||
)
|
||||
->when(
|
||||
$data['until'] ?? null,
|
||||
fn (Builder $builder, $date): Builder => $builder->whereDate('purchased_at', '<=', $date),
|
||||
);
|
||||
}),
|
||||
Tables\Filters\SelectFilter::make('platform')
|
||||
->label(__('admin.purchase_history.filters.platform'))
|
||||
->options([
|
||||
'ios' => __('admin.purchase_history.platforms.ios'),
|
||||
'android' => __('admin.purchase_history.platforms.android'),
|
||||
'web' => __('admin.purchase_history.platforms.web'),
|
||||
'manual' => __('admin.purchase_history.platforms.manual'),
|
||||
]),
|
||||
Tables\Filters\SelectFilter::make('currency')
|
||||
->label(__('admin.purchase_history.filters.currency'))
|
||||
->options([
|
||||
'EUR' => 'EUR',
|
||||
'USD' => 'USD',
|
||||
]),
|
||||
Tables\Filters\SelectFilter::make('tenant_id')
|
||||
->label(__('admin.purchase_history.filters.tenant'))
|
||||
->relationship('tenant', 'name')
|
||||
->searchable(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
BulkActionGroup::make([
|
||||
ExportBulkAction::make()
|
||||
->label(__('admin.purchase_history.actions.export'))
|
||||
->exporter(PurchaseHistoryExporter::class),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListPurchaseHistories::route('/'),
|
||||
'view' => Pages\ViewPurchaseHistory::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;
|
||||
}
|
||||
|
||||
public static function canDeleteAny(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user