@if ($errors->any())
    <div class="alert alert-danger">
        <ul class="m-0">
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif

<div class="row">
    <div class="col-md-6 mb-3">
        <label class="form-label">{{ __('Plan name') }}</label>
        <input type="text" name="name" class="form-control" value="{{ old('name', $plan->name ?? '') }}">
    </div>
    <div class="col-md-3 mb-3">
        <label class="form-label">{{ __('Price') }}</label>
        <input type="number" step="0.01" min="0" name="price" class="form-control" value="{{ old('price', $plan->price ?? '0.00') }}">
    </div>
    <div class="col-md-3 mb-3">
        <label class="form-label">{{ __('Billing interval') }}</label>
        <select name="billing_interval" class="form-select">
            @foreach (['monthly' => 'Monthly', 'yearly' => 'Yearly'] as $value => $label)
                <option value="{{ $value }}" @selected(old('billing_interval', $plan->billing_interval ?? 'monthly') === $value)>
                    {{ __($label) }}
                </option>
            @endforeach
        </select>
    </div>
</div>

<div class="row">
    <div class="col-md-4 mb-3">
        <label class="form-label">{{ __('User limit') }}</label>
        <input type="number" min="1" name="user_limit" class="form-control"
            value="{{ old('user_limit', $plan->user_limit ?? '') }}" placeholder="{{ __('Leave blank for unlimited') }}">
    </div>
    <div class="col-md-4 mb-3">
        <label class="form-label">{{ __('Status') }}</label>
        <select name="status" class="form-select">
            @foreach (['active' => 'Active', 'archived' => 'Archived'] as $value => $label)
                <option value="{{ $value }}" @selected(old('status', $plan->status ?? 'active') === $value)>
                    {{ __($label) }}
                </option>
            @endforeach
        </select>
    </div>
    <div class="col-md-4 mb-3 d-flex align-items-end">
        <div class="form-check">
            <input type="checkbox" name="custom_domain_allowed" value="1" class="form-check-input" id="customDomainAllowed"
                @checked(old('custom_domain_allowed', $plan->custom_domain_allowed ?? true))>
            <label class="form-check-label" for="customDomainAllowed">{{ __('Custom domain included') }}</label>
        </div>
    </div>
</div>
