- Implement OfferOptionAdminTest to validate offer option management, including price display, activation, and cancellation. - Create OrganizationPurchaseTest to ensure correct handling of organization purchases, including access control and order processing. - Add ShopProductPageTest to verify shop product listings, search functionality, and product page details. - Introduce BuildsShop trait for seeding test data related to shop functionality. - Implement MoneyTest to validate money parsing and formatting, ensuring correct handling of euro amounts.
35 lines
1.1 KiB
PHP
35 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Domain\Catalog\Composition;
|
|
use App\Domain\Catalog\CompositionStructureReader;
|
|
use App\Domain\Cms\Catalog\PublicCatalogReader;
|
|
use App\Domain\Commerce\Cart;
|
|
use App\Domain\Commerce\ProductOptions;
|
|
use App\Domain\Commerce\Shop;
|
|
use Illuminate\View\View;
|
|
|
|
class PublicCatalogController extends Controller
|
|
{
|
|
public function index(PublicCatalogReader $catalog): View
|
|
{
|
|
return view('public.programs', ['programs' => $catalog->publicPrograms()]);
|
|
}
|
|
|
|
public function program(Composition $composition, PublicCatalogReader $catalog, ProductOptions $products, Cart $cart): View
|
|
{
|
|
$version = $catalog->shownVersion($composition);
|
|
abort_if($version === null, 404);
|
|
|
|
return view('public.program', [
|
|
'composition' => $composition,
|
|
'version' => $version,
|
|
'nodes' => app(CompositionStructureReader::class)->tree($version),
|
|
'options' => Shop::enabled() ? $products->forComposition($composition) : [],
|
|
'cart' => $cart,
|
|
'switchTo' => session('shop.switch'),
|
|
]);
|
|
}
|
|
}
|