@props(['selected' => null])

@php
    $activityBusiness = \App\Models\Business::find(auth()->user()->business_id);
    $userEmail = auth()->user()->email;
    $selectedSender = old('from_email', $selected ?: $userEmail);
@endphp

<select {{ $attributes->merge(['class' => 'form-control', 'name' => 'from_email']) }}>
    <option value="{{ $userEmail }}" @selected($selectedSender === $userEmail)>
        My Email — {{ $userEmail }}
    </option>
    @if ($activityBusiness?->common_email && $activityBusiness->common_email !== $userEmail)
        <option value="{{ $activityBusiness->common_email }}"
            @selected($selectedSender === $activityBusiness->common_email)>
            Company Email — {{ $activityBusiness->common_email }}
        </option>
    @endif
</select>
