feat(postit): include google calendar and bank details in profile

This commit is contained in:
Paul Schneider 2026-10-07 12:22:49 +01:00
commit 137665bfe0
Signed by: notazof
GPG key ID: AD4B9B545FBD7D12
7 changed files with 51 additions and 5 deletions

View file

@ -61,6 +61,8 @@ public class HomePageProviderFlowTests
Assert.Equal("—", vm.FullName);
Assert.Equal("—", vm.Address);
Assert.Equal("Non configuré", vm.DedicatedGoogleCalendar);
Assert.Equal("Aucune information bancaire", vm.BankInfoSummary);
Assert.NotNull(vm.RefreshCommand);
}
@ -70,7 +72,9 @@ public class HomePageProviderFlowTests
var vm = new UserProfilePageViewModel
{
FullName = "Alice Example",
Address = "14 rue de l’Érable"
Address = "14 rue de l’Érable",
DedicatedGoogleCalendar = "calendar-123",
BankInfoSummary = "FR14 2004 1010 0505 0001 3M02 606"
};
Assert.NotNull(vm.SaveProfileCommand);

View file

@ -36,6 +36,9 @@ public partial class UserProfilePageViewModel : ViewModelBase
[ObservableProperty]
public partial string DedicatedGoogleCalendar { get; set; } = "Non configuré";
[ObservableProperty]
public partial string BankInfoSummary { get; set; } = "Aucune information bancaire";
[ObservableProperty]
public partial string StatusMessage { get; set; } = "Prêt.";
@ -71,6 +74,7 @@ public partial class UserProfilePageViewModel : ViewModelBase
Avatar = string.IsNullOrWhiteSpace(me?.Avatar) ? "Aucun avatar" : me.Avatar;
Roles = me?.Roles is { Length: > 0 } ? string.Join(", ", me.Roles) : "Aucun rôle";
DedicatedGoogleCalendar = string.IsNullOrWhiteSpace(me?.DedicatedGoogleCalendar) ? "Non configuré" : me.DedicatedGoogleCalendar;
BankInfoSummary = string.IsNullOrWhiteSpace(me?.BankInfoSummary) ? "Aucune information bancaire" : me.BankInfoSummary;
StatusMessage = "Profil chargé.";
}
catch (Exception ex)
@ -82,6 +86,7 @@ public partial class UserProfilePageViewModel : ViewModelBase
Avatar = "—";
Roles = "—";
DedicatedGoogleCalendar = "Non configuré";
BankInfoSummary = "Aucune information bancaire";
StatusMessage = $"Impossible de charger le profil : {ex.Message}";
}
finally
@ -105,7 +110,9 @@ public partial class UserProfilePageViewModel : ViewModelBase
var payload = new ProfileUpdateRequest
{
FullName = FullName,
Address = Address
Address = Address,
GoogleCalendarId = DedicatedGoogleCalendar == "Non configuré" ? string.Empty : DedicatedGoogleCalendar,
BankInfoSummary = BankInfoSummary == "Aucune information bancaire" ? string.Empty : BankInfoSummary
};
var endpoint = new Uri(new Uri(_api.Settings.ApiUrl.TrimEnd('/') + "/", UriKind.Absolute), "account/me").ToString();

View file

@ -18,16 +18,19 @@
IsIndeterminate="True"
Height="8"/>
<Grid RowDefinitions="Auto,Auto,Auto,Auto" ColumnDefinitions="*" RowSpacing="8">
<Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto" ColumnDefinitions="*" RowSpacing="8">
<TextBox Watermark="Nom complet" Text="{Binding FullName}"/>
<TextBox Grid.Row="1" Watermark="Adresse" Text="{Binding Address}" AcceptsReturn="True" TextWrapping="Wrap"/>
<Button Grid.Row="2" Content="Enregistrer" Command="{Binding SaveProfileCommand}" IsEnabled="{Binding !IsBusy}"/>
<TextBox Grid.Row="2" Watermark="Calendrier Google" Text="{Binding DedicatedGoogleCalendar}"/>
<TextBox Grid.Row="3" Watermark="Détails bancaires" Text="{Binding BankInfoSummary}" AcceptsReturn="True" TextWrapping="Wrap"/>
<Button Grid.Row="4" Content="Enregistrer" Command="{Binding SaveProfileCommand}" IsEnabled="{Binding !IsBusy}"/>
</Grid>
<TextBlock Text="{Binding UserName, StringFormat='Nom d’utilisateur : {0}'}"/>
<TextBlock Text="{Binding Email, StringFormat='Email : {0}'}"/>
<TextBlock Text="{Binding Roles, StringFormat='Rôles : {0}'}"/>
<TextBlock Text="{Binding DedicatedGoogleCalendar, StringFormat='Calendrier dédié : {0}'}"/>
<TextBlock Text="{Binding BankInfoSummary, StringFormat='Informations bancaires : {0}'}" TextWrapping="Wrap"/>
<TextBlock Text="{Binding Avatar, StringFormat='Avatar : {0}'}" TextWrapping="Wrap"/>
<TextBlock Text="{Binding StatusMessage}" Foreground="#4B5563" TextWrapping="Wrap"/>
</StackPanel>