@php $profile = $user->profile ?: new \App\Models\KUserProfile(); $countryId = old('country_id', $profile->country_id ?? ''); $dial = $selectedCountry ? app(\App\Services\KuserProfileService::class)->dialCode($selectedCountry) : ''; $hasPhoto = $profile && $profile->profile_photo_path; $photoOptional = true; $personalOpen = $errors->hasAny([ 'date_of_birth', 'gender', 'state_id', 'district_id', 'address_1', 'address_2', 'street_address', 'city', 'island', 'postal_code', 'profile_atoll_id', 'profile_island_id', 'use_personal_address_as_delivery', 'profile_photo', ]); $mustSetPassword = empty($warehouseCustomerEdit) && app(\App\Services\KuserProfileService::class)->needsLoginPassword($user); $activeCountryCode = strtoupper((string) optional($selectedCountry)->country_code); $phoneCodes = $phoneCodes ?? []; $phoneDialSelected = (string) old('phone_country_code', $profile->country_code ?: $dial); $additionalDialSelected = (string) old('additional_country_code', $profile->additional_country_code ?? ''); $whatsappDialSelected = (string) old('whatsapp_country_code', $profile->whatsapp_country_code ?: ($profile->country_code ?: $dial)); $preferredDialIso = [ '+1' => 'US', '+7' => 'RU', '+33' => 'FR', '+39' => 'IT', '+44' => 'GB', '+47' => 'NO', '+61' => 'AU', '+64' => 'NZ', '+212' => 'MA', '+262' => 'RE', '+500' => 'FK', ]; $resolvePhoneIso = function (string $selected) use ($phoneCodes, $activeCountryCode, $preferredDialIso) { if ($selected === '') { return ''; } foreach ($phoneCodes as $phoneCode) { if ($selected === $phoneCode['code']) { return $phoneCode['code']; } } if ($activeCountryCode !== '') { foreach ($phoneCodes as $phoneCode) { if ($phoneCode['code'] === $activeCountryCode && $phoneCode['dial'] === $selected) { return $phoneCode['code']; } } } $preferred = $preferredDialIso[$selected] ?? ''; if ($preferred !== '') { foreach ($phoneCodes as $phoneCode) { if ($phoneCode['code'] === $preferred && $phoneCode['dial'] === $selected) { return $phoneCode['code']; } } } foreach ($phoneCodes as $phoneCode) { if ($phoneCode['dial'] === $selected) { return $phoneCode['code']; } } return ''; }; $phoneIsoSelected = $resolvePhoneIso($phoneDialSelected); $additionalIsoSelected = $resolvePhoneIso($additionalDialSelected); $whatsappIsoSelected = $resolvePhoneIso($whatsappDialSelected); if (!isset($profileRoutes)) { $profileRoutes = [ 'update' => route('kuser.profile.update'), 'photo' => route('kuser.profile.photo'), 'states' => route('kuser.profile.states'), 'districts' => route('kuser.profile.districts'), ]; } @endphp
Fill in the same details the customer would add. The registered email stays as the login.
@elseif($profileComplete)Your profile is complete. Saving takes you to Virtual Address.
@elseProfile completion is required to unlock the application.
@endif