@page "/profile/personal-information" @using System.ComponentModel.DataAnnotations @using MudBlazor @using Indotalent.Features.Profile.PersonalInformation @using Indotalent.Features.Profile.PersonalInformation.Cqrs @using Indotalent.ConfigBackEnd.Interfaces @inject ISnackbar Snackbar @inject PersonalInformationService PersonalInformationService @inject ICurrentUserService CurrentUserService Personal Information Manage your personal details, contact information, and how others see you. / Profile / Personal Information Basic Profile Your public identity and bio. First Name Last Name Short Bio Job Title / Position Date of Birth Contact & Location How we can reach you and where you're based. Email Address Phone Number Residential Address City Country Postal Code Social Profiles Your professional and social networking links. LinkedIn Profile GitHub / Portfolio Instagram @if (_isProcessing) { Saving... } else { Save Changes } @code { private bool _isProcessing = false; private UserProfileModel user = new(); protected override async Task OnInitializedAsync() { await LoadProfile(); } private async Task LoadProfile() { var userId = CurrentUserService.UserId; if (string.IsNullOrEmpty(userId)) return; _isProcessing = true; var response = await PersonalInformationService.GetPersonalInformationByIdAsync(userId); if (response != null && response.IsSuccess && response.Value != null) { var profile = response.Value; user = new UserProfileModel { FirstName = profile.FirstName ?? string.Empty, LastName = profile.LastName ?? string.Empty, Bio = profile.ShortBio ?? string.Empty, JobTitle = profile.JobTitle ?? string.Empty, DateOfBirth = profile.DateOfBirth, Contact = new ContactModel { Email = profile.Email ?? string.Empty, Phone = profile.PhoneNumber ?? string.Empty, Address = profile.StreetAddress ?? string.Empty, City = profile.City ?? string.Empty, Country = profile.Country ?? string.Empty, PostalCode = profile.ZipCode ?? string.Empty }, Socials = new UserSocialModel { LinkedIn = profile.SocialMediaLinkedIn ?? string.Empty, Instagram = profile.SocialMediaInstagram ?? string.Empty, GitHub = profile.SocialMediaX ?? string.Empty } }; } _isProcessing = false; } private async Task SaveProfile() { var userId = CurrentUserService.UserId; if (string.IsNullOrEmpty(userId)) { Snackbar.Add("User session not found.", Severity.Error); return; } _isProcessing = true; var updateRequest = new UpdateProfileRequest { Id = userId, FirstName = user.FirstName, LastName = user.LastName, ShortBio = user.Bio, JobTitle = user.JobTitle, DateOfBirth = user.DateOfBirth, PhoneNumber = user.Contact.Phone, StreetAddress = user.Contact.Address, City = user.Contact.City, Country = user.Contact.Country, ZipCode = user.Contact.PostalCode, SocialMediaLinkedIn = user.Socials.LinkedIn, SocialMediaInstagram = user.Socials.Instagram, SocialMediaX = user.Socials.GitHub }; var result = await PersonalInformationService.UpdatePersonalInformationAsync(updateRequest); await Task.Delay(500); if (result != null && result.IsSuccess) { Snackbar.Add("Profile updated! Please re-login to see all changes in the session.", Severity.Success, config => { config.VisibleStateDuration = 5000; }); } else { Snackbar.Add(result?.Message ?? "Update failed", Severity.Error); } _isProcessing = false; } public class UserProfileModel { public string FirstName { get; set; } = string.Empty; public string LastName { get; set; } = string.Empty; public string Bio { get; set; } = string.Empty; public string JobTitle { get; set; } = string.Empty; public DateTime? DateOfBirth { get; set; } public ContactModel Contact { get; set; } = new(); public UserSocialModel Socials { get; set; } = new(); } public class ContactModel { public string Email { get; set; } = string.Empty; public string Phone { get; set; } = string.Empty; public string Address { get; set; } = string.Empty; public string City { get; set; } = string.Empty; public string Country { get; set; } = string.Empty; public string PostalCode { get; set; } = string.Empty; } public class UserSocialModel { public string LinkedIn { get; set; } = string.Empty; public string GitHub { get; set; } = string.Empty; public string Instagram { get; set; } = string.Empty; } }