{{-- What one plan of a registered product grants an account. The keys are not free text. They are the ones the product understands, listed in its own config file, and this form is built from that list — so a plan cannot claim a ceiling the product will silently ignore. A ceiling has three states and they are three different things to the product: a number (0 included, which is none at all), no limit, and not set, where BCP says nothing and the product applies its own floor. No limit is a tick of its own, so that an empty box can never be read as unlimited. --}}
@php $name = $integration->name(); $noun = $integration->accountNoun(); //After a refused save the form shows what was typed, ticks //included; otherwise what the plan holds. $again = session()->hasOldInput(); $nothing = $featureKeys === [] && $limits === []; @endphp
@csrf @method('PUT') {{-- The plan, and the button that saves it, first: on a product with few ceilings the whole form is then in view at once, and on one with many the button is not a scroll away. --}}

{{ $plan->name }} {{ $plan->slug }}

{{ $plan->currency }} {{ number_format((float) $plan->price, 2) }} / {{ $plan->billing_interval?->value ?? 'term' }}

{{ $nothing ? 'Back to plans' : 'Cancel' }} @unless ($nothing) @endunless

@if ($nothing) Nothing in {{ $name }} differs by plan, so there is nothing to set here: this plan grants a period of use. @elseif ($integration->notifies()) Saving tells {{ $name }}. Every {{ $noun }} on this plan is sent a signed notification and re-reads what it may do. @else {{ $name }} is not told at once (its notifications are not set up), so a {{ $noun }} on this plan sees a change at {{ $name }}'s next re-read. @endif

@if ($featureKeys !== [])

Features

What a {{ $noun }} on this plan may use. Unticked means the feature is off in {{ $name }}.

@foreach ($featureKeys as $key) @endforeach
@endif @if ($limits !== [])

Limits

A number is the ceiling, and 0 means none at all. Tick “No limit” for unlimited. An empty box leaves that ceiling at {{ $name }}'s own floor, so fill in every one this plan is meant to raise.

@foreach ($limits as $limit) @php $key = $limit['key']; $ticked = $again ? in_array($key, (array) old('unlimited', []), true) : $limit['unlimited']; $hint = $limit['bytes'] ? 'Not set — a size, e.g. 100 GB' : 'Not set'; @endphp {{-- The tick wins over the box, here as on the server: ticking empties the box and says so in it, so the two can never be read as disagreeing. --}}
{{-- The bytes behind the size the plan holds, so what is stored is never a guess. --}} @if ($limit['exact'] !== null)

Stored now: {{ $limit['exact'] }}

@endif @error('limits.'.$key)

{{ $message }}

@enderror
@endforeach
@endif {{-- A long form ends with the button as well, so nobody scrolls back up for it; a short one already has it in view. --}} @if (count($featureKeys) + count($limits) > 9)
Cancel
@endif