feat: implement core domain models, authentication service, and UI components for the attendance system

This commit is contained in:
2026-07-31 14:39:25 -04:00
commit f476f704eb
329 changed files with 12622 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Asistencia.Services;
namespace Asistencia.ViewModels;
public partial class LoginViewModel : ObservableObject
{
private readonly AuthService _authService;
private readonly MainWindowViewModel _mainVm;
[ObservableProperty]
private string _rut = string.Empty;
[ObservableProperty]
private string _password = string.Empty;
[ObservableProperty]
private string _errorMessage = string.Empty;
[ObservableProperty]
private bool _hasError;
[ObservableProperty]
private bool _isLoading;
public LoginViewModel(AuthService authService, MainWindowViewModel mainVm)
{
_authService = authService;
_mainVm = mainVm;
}
[RelayCommand]
private async Task LoginAsync()
{
IsLoading = true;
HasError = false;
var (success, message) = await _authService.LoginAsync(Rut, Password);
if (success)
{
_mainVm.NavigateToDashboard();
}
else
{
ErrorMessage = message;
HasError = true;
}
IsLoading = false;
}
}