postit: persist settings save and apply ApiUrl changes without restart #51

Merged
notazof merged 25 commits from feat/estimate into main 2026-09-06 21:05:58 +01:00
3 changed files with 37 additions and 1 deletions
Showing only changes of commit 5b244e357f - Show all commits

postit: fix rdv date picker binding

Paul Schneider 2026-09-06 17:42:46 +01:00
Signed by: notazof
GPG key ID: 1DD5D838E5343B06

View file

@ -135,6 +135,25 @@ public class BillingCommandPageViewModelTests
Assert.Contains("Position sélectionnée", vm.StatusMessage, StringComparison.OrdinalIgnoreCase);
}
[Fact]
public void EventDateSelection_round_trips_with_EventDate_for_DatePicker_binding()
{
var api = new RecordingApi();
var client = new BillingApiClient(api, "https://business.example/api/v1/");
var vm =
new CommandFormSummary { Id = 12, ActionName = "Rdv", Title = "Rendez-vous" }
.CreateCommandPageViewModel(
new ActivityInfo { Code = "dev", Name = "Développement" },
new ActivityUserDisplayItem { PerformerId = "perf-1", UserName = "Alice" },
client) as RdvViewModel;
var selected = new DateTimeOffset(2026, 9, 7, 14, 30, 0, TimeSpan.FromHours(2));
vm!.EventDateSelection = selected;
Assert.Equal(selected.LocalDateTime, vm.EventDate);
Assert.Equal(vm.EventDate, vm.EventDateSelection!.Value.LocalDateTime);
}
[Fact]
public void ApplyResolvedAddress_populates_empty_address_directly()
{

View file

@ -33,6 +33,18 @@ public partial class RdvViewModel : BillingCommandPageViewModel
[ObservableProperty]
public partial DateTime EventDate { get; set; }
public DateTimeOffset? EventDateSelection
{
get => new(EventDate);
set
{
if (!value.HasValue)
return;
EventDate = value.Value.LocalDateTime;
}
}
public RdvViewModel(ActivityInfo activity, ActivityUserDisplayItem performer, CommandFormSummary form, BillingApiClient billingClient)
: base(activity, performer, form, billingClient)
{
@ -206,6 +218,11 @@ public partial class RdvViewModel : BillingCommandPageViewModel
OnPropertyChanged(nameof(HasSuggestedAddressPanel));
}
partial void OnEventDateChanged(DateTime value)
{
OnPropertyChanged(nameof(EventDateSelection));
}
protected override async Task SubmitAsync()
{

View file

@ -26,7 +26,7 @@
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding ActivityLabel}" IsReadOnly="True" Margin="0,0,0,8" />
<TextBlock Grid.Row="4" Text="Date" VerticalAlignment="Center" Margin="0,0,12,8" />
<DatePicker Grid.Row="4" Grid.Column="1" DayFormat="ddd dd" SelectedDate="{Binding EventDate, Mode=TwoWay}" Margin="0,0,0,8" />
<DatePicker Grid.Row="4" Grid.Column="1" DayFormat="ddd dd" SelectedDate="{Binding EventDateSelection, Mode=TwoWay}" Margin="0,0,0,8" />
<TextBlock Grid.Row="5"
Text="Motif"