@foreach($products as $product)
@php
$pricedCycles = $product->pricedCycles($currency?->id);
$startingCycle = (string) array_key_first($pricedCycles);
$startingPrice = $pricedCycles[$startingCycle] ?? null;
// What the card lists: the plan's feature lines when the
// operator wrote them (f1-f7, as the homepage uses), else a
// description written one feature a line, else the limits
// the product enforces.
$opts = is_array($product->config_options) ? $product->config_options : [];
$features = [];
for ($i = 1; $i <= 7; $i++) {
if (! empty($opts["f{$i}"])) {
$features[] = (string) $opts["f{$i}"];
}
}
$desc = trim(strip_tags(str_ireplace(['
', '
', '
', '', ''], "\n", (string) $product->description)));
$descLines = array_values(array_filter(array_map('trim', preg_split('/\R/', $desc))));
$paragraph = null;
if (! $features && count($descLines) > 1) {
$features = $descLines;
} elseif ($desc !== '') {
$paragraph = \Illuminate\Support\Str::limit($desc, 160);
}
if (! $features) {
$features = array_map(fn ($r) => $r['text'], $product->resourceSummary());
}
@endphp
@if($product->is_featured)
{{ __('client.store.featured') }}
@endif
{{ $product->name }}
@if($startingPrice !== null)
{{ display_money_fmt($startingPrice) }}
{{ $cycleLabel($startingCycle) }}
@else
{{ __('client.store.contact_us') }}
@endif
@if($paragraph)
{{ $paragraph }}
@endif
@if($features)
@foreach($features as $f)
- {{ $f }}
@endforeach
@endif
@if($product->outOfStock())
{{ __('client.cart.out_of_stock') }}
@else
{{ __('client.store.order_now') }}
@endif
@endforeach