done selecting multiple date for presence

This commit is contained in:
Dasha06 2024-12-26 13:10:54 +03:00
parent ffb9d2134f
commit 345818f056
48 changed files with 63 additions and 35 deletions

View File

@ -6,6 +6,7 @@ using Presence.Desktop.Models;
using Presence.Desktop.ViewModels;
using ReactiveUI;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
@ -41,8 +42,8 @@ namespace Presence.Desktop.ViewModels
}
}
private DateTime? _selectedDate;
public DateTime? SelectedDate
private List<DateTime?> _selectedDate = new List<DateTime?>();
public List<DateTime?> SelectedDate
{
get => _selectedDate;
set
@ -83,7 +84,7 @@ namespace Presence.Desktop.ViewModels
}
}
private void FilterAttendanceRecords()
public void FilterAttendanceRecords()
{
if (SelectedGroup == null || SelectedDate == null)
{
@ -91,11 +92,14 @@ namespace Presence.Desktop.ViewModels
return;
}
AttendanceRecords.Clear();
foreach (var selDate in SelectedDate)
{
var records = _presenceUseCase.GetPresenceByGroupAndDate(
SelectedGroup.Id,
DateOnly.FromDateTime(SelectedDate.Value));
DateOnly.FromDateTime(selDate.Value));
AttendanceRecords.Clear();
foreach (var record in records)
{
AttendanceRecords.Add(new PresencePresenter
@ -112,6 +116,8 @@ namespace Presence.Desktop.ViewModels
});
}
}
// Логирование для отладки
Console.WriteLine($"Загружено записей посещаемости: {AttendanceRecords.Count}");
}

View File

@ -19,10 +19,11 @@
</ComboBox>
<!-- Календарь -->
<Calendar SelectedDate="{Binding SelectedDate}" />
<Calendar SelectionMode="SingleRange" SelectedDatesChanged="DatesChanged"/>
</StackPanel>
<StackPanel Orientation="Vertical" Spacing="10">
<StackPanel Orientation="Horizontal" Spacing="10">
<!-- Таблица с посещаемостью -->
<DataGrid AutoGenerateColumns="False" ItemsSource="{Binding AttendanceRecords}" CanUserSortColumns="True"
SelectionChanged="OnDataGridSelectionChanged">
@ -34,6 +35,7 @@
</DataGrid.Columns>
</DataGrid>
<Button Content="Удалить" Margin="0,10,0,0" Command="{Binding DeleteSelectedPresenceCommand}" />
</StackPanel>
</DockPanel>
</UserControl>

View File

@ -1,3 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia;
using Avalonia.Controls;
@ -28,4 +30,22 @@ public partial class PresenceView : ReactiveUserControl<PresenceViewModel>
}
}
}
private void DatesChanged(object sender, SelectionChangedEventArgs e)
{
Calendar cal = (Calendar)sender;
if (this.DataContext is PresenceViewModel viewModel)
{
if (viewModel.SelectedDate == null)
{
viewModel.SelectedDate = new List<DateTime?>();
}
viewModel.SelectedDate.Clear();
foreach (var date in cal.SelectedDates)
{
viewModel.SelectedDate.Add(date);
viewModel.FilterAttendanceRecords();
}
}
}
}

View File

@ -13,10 +13,10 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Presence.Desktop")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+eadf72b51276624814f3e477c5bc69af93bf4792")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ffb9d2134fbb1b7be6c05ec6ad7159dd069dd3fd")]
[assembly: System.Reflection.AssemblyProductAttribute("Presence.Desktop")]
[assembly: System.Reflection.AssemblyTitleAttribute("Presence.Desktop")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.
// Создано классом WriteCodeFragment MSBuild.

View File

@ -1 +1 @@
72b577a16b1150e5587b14ce010e799430b278d0d3ab4eb8c333f7fdbbed0371
68bd6e3390d8ca4bf09cdf5b154a30570d12f7994ca59f66302a0231ee630fcc

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("console_ui")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+eadf72b51276624814f3e477c5bc69af93bf4792")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ffb9d2134fbb1b7be6c05ec6ad7159dd069dd3fd")]
[assembly: System.Reflection.AssemblyProductAttribute("console_ui")]
[assembly: System.Reflection.AssemblyTitleAttribute("console_ui")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
25bd5e432f9b076e16dc7af22f86b1c575c43db1e24524d1d4b9fb3399bfa759
43925848a55f2335dd5bf69a5a5a25d24ee5bbe218d379aff344f34875796193

Binary file not shown.

Binary file not shown.

View File

@ -13,10 +13,10 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("data")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+eadf72b51276624814f3e477c5bc69af93bf4792")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ffb9d2134fbb1b7be6c05ec6ad7159dd069dd3fd")]
[assembly: System.Reflection.AssemblyProductAttribute("data")]
[assembly: System.Reflection.AssemblyTitleAttribute("data")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.
// Создано классом WriteCodeFragment MSBuild.

View File

@ -1 +1 @@
2253ca6854105c04db3820ffeca7fdaa0791fa00d7171656efaaad4bd95ee96a
cf96d5089cb6caf69b08d6f53371635a8397acc449b97042b83d1c21e6aa2e08

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -13,10 +13,10 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("domain")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+eadf72b51276624814f3e477c5bc69af93bf4792")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ffb9d2134fbb1b7be6c05ec6ad7159dd069dd3fd")]
[assembly: System.Reflection.AssemblyProductAttribute("domain")]
[assembly: System.Reflection.AssemblyTitleAttribute("domain")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.
// Создано классом WriteCodeFragment MSBuild.

View File

@ -1 +1 @@
f91ca13c27f8a90a479f0970f684bcd6ea0ccda85726b424d8a614ad54287fba
c0e22eda5bbbbabacb18030d45375a59a2c3560af8350ea455c8ff608127f62e

Binary file not shown.

Binary file not shown.

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("presence_api")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+eadf72b51276624814f3e477c5bc69af93bf4792")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ffb9d2134fbb1b7be6c05ec6ad7159dd069dd3fd")]
[assembly: System.Reflection.AssemblyProductAttribute("presence_api")]
[assembly: System.Reflection.AssemblyTitleAttribute("presence_api")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
aeb387e4e85ce3ac4715fe5bfffc5e4071ed545312f35b7345a437287364ca5e
34ef239cd86edabcf83988e2e31454a1505ecfa56a75ef26188aa31c45020f99

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("ui")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+eadf72b51276624814f3e477c5bc69af93bf4792")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ffb9d2134fbb1b7be6c05ec6ad7159dd069dd3fd")]
[assembly: System.Reflection.AssemblyProductAttribute("ui")]
[assembly: System.Reflection.AssemblyTitleAttribute("ui")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
34056f4ae144d0b6b9e005bea4d01e95d450e183e56708cb027e5d8487a4e243
30af123abf1220bcb4b860b42e82b974f3441b16511baef32e539317699dd7a1