Führe Artikel, Paket und Angebot mit sichtbaren Voraussetzungen bis zum kaufbaren Angebot
CI Feature / test (push) Successful in 1m42s
CI Feature / test (push) Successful in 1m42s
Abnahmebefund Etappe 1: Nach dem Anlegen mit einem Namen fand die Verwaltung keinen Weg, Inhalte festzulegen und Artikel, Paket, Preis und Rechte zu einem kaufbaren Angebot zu verbinden. - Gemeinsamer Baustein „Bis zur Veröffentlichung“ (PublicationReadiness, voraussetzungen.blade) auf Lizenzartikel, Paket und Angebot: erledigte und offene Schritte mit Weg dorthin, Zustand als Text und Symbol. - Artikel: „Inhalt festlegen“ als Hauptaktion im Kopf statt nur im Menü; Dialog mit „Freigegebener Inhalt“ statt „Wurzel“, Einordnung beim ersten Stand vorbelegt. - Auswahllisten zeigen Name, Kennung und Stand; Artikel ohne Stand sind gekennzeichnet, Produktseiten nennen die Auffindbarkeit im Shop, Paketfassungen ihre Artikel. - Angebotsaktivierung lehnt Artikel ohne veröffentlichten Stand (auch in Paketen) mit Erklärung ab. Die Domänenregel in OfferService bleibt unverändert; das ist eine Oberflächenabsicherung und bei Bedarf eine fachliche Entscheidung. - Erfolgsmeldungen nennen den nächsten Schritt. Bestandstest geändert: OrganizationPurchaseTest::test_membership_boundaries_decide_the_club_access setzte die Uhrzeit erst nach der Bestellung auf 12:00 Uhr und scheiterte dadurch nach 12:00 UTC. Die feste Uhrzeit gilt jetzt vor der Bestellung; die Assertions bleiben unverändert. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4e0760db1e
commit
f72b79fd8c
11 files changed
+677
-15
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\Offers\Pages;
|
||||
|
||||
use App\Domain\Catalog\BundleService;
|
||||
use App\Domain\Catalog\BundleVersion;
|
||||
use App\Domain\Catalog\Composition;
|
||||
use App\Domain\Catalog\CompositionVersion;
|
||||
@@ -13,11 +14,13 @@
|
||||
use App\Domain\Catalog\OfferVersion;
|
||||
use App\Domain\Catalog\RightsProfileVersion;
|
||||
use App\Domain\Catalog\StatusValue;
|
||||
use App\Domain\Cms\Catalog\PublicCatalogReader;
|
||||
use App\Domain\Commerce\Money;
|
||||
use App\Domain\Commerce\ProductOptions;
|
||||
use App\Filament\Resources\Offers\OfferResource;
|
||||
use App\Filament\Support\CatalogLabels;
|
||||
use App\Filament\Support\CatalogOptions;
|
||||
use App\Filament\Support\PublicationReadiness;
|
||||
use App\Filament\Support\ReportsDomainRules;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\Repeater;
|
||||
@@ -141,9 +144,12 @@ public function activateAction(): Action
|
||||
'article' => 'Lizenzartikel',
|
||||
'bundle' => 'Paketfassung',
|
||||
])->required()->live(),
|
||||
Select::make('article_id')->label('Artikel')->options(fn (): array => CatalogOptions::articles())
|
||||
Select::make('article_id')->label('Artikel')->options(fn (): array => app(PublicationReadiness::class)->articleOptions())
|
||||
->searchable()
|
||||
->helperText('Nur Artikel mit veröffentlichtem Stand lassen sich verkaufen. Artikel ohne Stand sind gekennzeichnet.')
|
||||
->visible(fn (Get $get): bool => $get('kind') === 'article'),
|
||||
Select::make('bundle_version_id')->label('Paketfassung')->options(fn (): array => CatalogOptions::bundleVersions())
|
||||
Select::make('bundle_version_id')->label('Paketfassung')->options(fn (): array => app(PublicationReadiness::class)->bundleVersionOptions())
|
||||
->searchable()
|
||||
->visible(fn (Get $get): bool => $get('kind') === 'bundle'),
|
||||
Select::make('rights_id')->label('Rechte')->options(fn (): array => CatalogOptions::rights())->required(),
|
||||
])->minItems(1)->addActionLabel('Position hinzufügen'),
|
||||
@@ -164,6 +170,20 @@ public function activateAction(): Action
|
||||
];
|
||||
}
|
||||
|
||||
// Voraussetzung: Jeder Artikel der Positionen hat einen veröffentlichten Stand, sonst erhielten Käufer nichts.
|
||||
$articleIds = [];
|
||||
|
||||
foreach ($lines as $line) {
|
||||
$target = $line['target'];
|
||||
array_push($articleIds, ...($target instanceof BundleVersion ? app(BundleService::class)->articleIds($target) : [$target->id]));
|
||||
}
|
||||
|
||||
$unusable = app(PublicationReadiness::class)->unusableArticles($articleIds);
|
||||
|
||||
if ($unusable !== []) {
|
||||
throw new DomainRuleException(app(PublicationReadiness::class)->unusableMessage($unusable, 'das Angebot aktivierst'));
|
||||
}
|
||||
|
||||
// Bedingungen, die die Maske nicht zeigt, bleiben bei einer Änderung die der aktiven Fassung.
|
||||
$active = $this->activeVersion();
|
||||
$kept = $active === null ? [] : [
|
||||
@@ -194,7 +214,12 @@ public function activateAction(): Action
|
||||
]);
|
||||
});
|
||||
|
||||
return 'Fassung '.$version->number.' ist aktiv. Die Option ist in dieser Fassung öffentlich kaufbar.';
|
||||
$offer->unsetRelations();
|
||||
$readiness = app(PublicationReadiness::class)->forOffer($offer->refresh());
|
||||
|
||||
return 'Fassung '.$version->number.' ist aktiv.'.($readiness['bereit']
|
||||
? ' Die Option ist öffentlich kaufbar und im Shop auffindbar.'
|
||||
: ' Noch nicht im Shop kaufbar. Nächster Schritt: '.$readiness['naechster']['titel'].'.');
|
||||
}, 'Die Angebotsfassung ist aktiv.');
|
||||
$this->getRecord()->unsetRelations();
|
||||
$this->getRecord()->refresh();
|
||||
@@ -240,14 +265,18 @@ private function productPageSuffix(): string
|
||||
*/
|
||||
private function productPages(): array
|
||||
{
|
||||
$catalog = app(PublicCatalogReader::class);
|
||||
|
||||
return Composition::query()
|
||||
->with('editorialContentKind')
|
||||
->whereNull('archived_at')
|
||||
->orderBy('designation')
|
||||
->get()
|
||||
->sortBy(fn (Composition $composition): int => $catalog->shownVersion($composition) !== null ? 0 : 1)
|
||||
->mapWithKeys(fn (Composition $composition): array => [
|
||||
$composition->id => ($composition->display_title ?: $composition->designation)
|
||||
.' ('.($composition->editorialContentKind?->label ?? 'Zusammenstellung').')',
|
||||
.' ('.($composition->editorialContentKind?->label ?? 'Zusammenstellung').')'
|
||||
.($catalog->shownVersion($composition) !== null ? ' · im Shop auffindbar' : ' · nicht öffentlich, im Shop nicht auffindbar'),
|
||||
])
|
||||
->all();
|
||||
}
|
||||
@@ -320,6 +349,7 @@ private function angebotDaten(): array
|
||||
]] : []),
|
||||
],
|
||||
],
|
||||
'voraussetzungen' => app(PublicationReadiness::class)->forOffer($offer),
|
||||
'haupt' => [
|
||||
...($active !== null ? [$this->optionAbschnitt($offer, $active)] : []),
|
||||
[
|
||||
|
||||
Reference in new issue
Block a user