@extends('web.signup.layout') @section('title', __('web.signup.investor.page_title')) @section('page_title', __('web.signup.investor.page_title')) @section('page_subtitle', __('web.signup.investor.page_subtitle')) @push('styles') @endpush @section('content') @php $existingAccount = $existingAccount ?? null; // OTP-authenticated accounts may reuse their permanent contact details. // Split the stored canonical number only for display; the request joins // the selected country code and digits again at the server boundary. $existingCountryCode = null; $existingLocalPhone = null; $storedPhoneDigits = preg_replace('/\D+/', '', (string) ($existingAccount?->phone_number ?? '')) ?: ''; $phoneCountries = $countries; usort($phoneCountries, static fn (array $left, array $right): int => strlen((string) $right['code']) <=> strlen((string) $left['code'])); foreach ($phoneCountries as $country) { $codeDigits = preg_replace('/\D+/', '', (string) $country['code']) ?: ''; if ($codeDigits !== '' && str_starts_with($storedPhoneDigits, $codeDigits)) { $existingCountryCode = $country['code']; $existingLocalPhone = substr($storedPhoneDigits, strlen($codeDigits)); break; } } $existingLocalPhone ??= $storedPhoneDigits !== '' ? $storedPhoneDigits : null; $selectedCountryId = old('country_id', $existingAccount?->country_id); $selectedCityId = old('city_id', $existingAccount?->city_id); $selectedReferralId = old('how_heard_option_id', $existingAccount?->referral_source_option_id); // Kept outside the Alpine attribute. Raw JSON in a quoted HTML // attribute can terminate that attribute and make the remaining // JavaScript visible as page text. $previousInvestmentCompanies = array_values((array) old('previous_investments_companies', [])); // Section -> required field names (used to drive the progress pills). $sections = [ ['id' => 'personal', 'fields' => ['first_name', 'last_name', 'country_id', 'phone_number', 'email']], ['id' => 'background', 'fields' => ['about', 'linkedin_url']], ['id' => 'preferences', 'fields' => ['stage_option_ids', 'sector_option_ids', 'expected_yearly_investments_option_id', 'average_ticket_option_id']], ['id' => 'experience', 'fields' => ['has_angel_invested_option_id', 'investment_knowledge_option_id', 'is_in_other_angel_group_option_id']], ['id' => 'source', 'fields' => ['how_heard_option_id']], ]; @endphp