Verwalte Rabattcodes mit Kontofreigabe und Bestellungen mit Rechnungsweg und Erstattung
Neue Verwaltungsseiten Rabattcodes (Anlegen und Bearbeiten in einer Maske, Konten für genau diesen Code freischalten und entziehen) und Bestellungen (Zahlungseingang bei Rechnung bestätigen, vollständig erstatten). Der Nutzerkreis ist in der Angebotsmaske ein Pflichtfeld. BestandslisteTest: die Fassung ohne Nutzerkreis verlangt jetzt dessen Angabe beim Bearbeiten; die geprüfte Aussage (verdeckte Konditionen bleiben erhalten) ist unverändert. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1ce2e1e51f
commit
76fab81386
15 files changed
+1302
-9
No files matched your search
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DiscountCodes;
|
||||
|
||||
use App\Domain\Commerce\Discount\DiscountCode;
|
||||
use App\Filament\Resources\DiscountCodes\Pages\ListDiscountCodes;
|
||||
use App\Filament\Resources\DiscountCodes\Pages\ViewDiscountCode;
|
||||
use App\Filament\Support\ShopAccess;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Rabattcodes (FACH-14): anlegen, bearbeiten, zeitlich begrenzen, deaktivieren und einzelne Konten freischalten.
|
||||
* Die Seiten nutzen die gemeinsamen Bausteine (Bestandsliste, Objektseite, Dialoge) wie die übrigen Kataloglisten.
|
||||
*/
|
||||
class DiscountCodeResource extends Resource
|
||||
{
|
||||
protected static ?string $model = DiscountCode::class;
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Verkauf';
|
||||
|
||||
protected static ?string $navigationLabel = 'Rabattcodes';
|
||||
|
||||
protected static ?string $modelLabel = 'Rabattcode';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Rabattcodes';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'code';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
public static function canViewAny(): bool
|
||||
{
|
||||
return ShopAccess::allowed();
|
||||
}
|
||||
|
||||
public static function getViewAuthorizationResponse(Model $record): Response
|
||||
{
|
||||
return ShopAccess::allowed() ? Response::allow() : Response::deny();
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema;
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table->columns([
|
||||
TextColumn::make('code')->label('Code')->searchable(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListDiscountCodes::route('/'),
|
||||
'view' => ViewDiscountCode::route('/{record}'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user