@if('disabled' !== $account['import_account']->status) getAccounts()[$account['import_account']->id] ?? null; $mappedTo = $account['mapped_to'] ?? null; $isCreateNewSelected = (!$configuredAccount || $configuredAccount === 'create_new') && !$mappedTo; @endphp @if($isCreateNewSelected) selected @endif>➕ Create new account @foreach($account['firefly_iii_accounts'] as $accountGroupKey => $accountGroup) {{-- $accountGroupKey is 'assets' or 'liabilities' --}} {{-- $accountGroup is the array of account objects --}} @if(is_array($accountGroup) && count($accountGroup) > 0) @foreach($accountGroup as $ff3Account) {{-- $ff3Account is now a single Firefly III Account object/array --}} id) { $isSelected = true; } // Otherwise check configuration for pre-selection else { foreach($configuration->getAccounts() as $key => $preConfig) { if((string) $key === (string) $account['import_account']->id && (int) $preConfig === (int) ($ff3Account->id)) { $isSelected = true; break; } } } @endphp @if($isSelected) selected="selected" @endif label="{{ $ff3Account->name }} @if('' !== (string) $ff3Account->iban) ({{ $ff3Account->iban}}) @endif"> {{ $ff3Account->name }} @if('' !== (string)$ff3Account->iban) ({{ $ff3Account->iban }}) @endif @endforeach @endif @endforeach