Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,44 @@ public void HomePageViewModel_BackButtonCommand_Execute_UserSelectsNotToLogout_L
It.IsAny<String>(),
It.IsAny<String>()), Times.Once);
}

[Fact]
public void HomePageViewModel_GoToTransactionsCommand_Execute_TransactionsPageDisplayed()
{
this.viewModel.GoToTransactionsCommand.Execute(null);

this.navigationService.Verify(n => n.GoToTransactions(), Times.Once);
}

[Fact]
public void HomePageViewModel_GoToMobileTopupCommand_Execute_MobileTopupSelectOperatorPageDisplayed()
{
this.viewModel.GoToMobileTopupCommand.Execute(null);

this.navigationService.Verify(n => n.GoToMobileTopupSelectOperatorPage(), Times.Once);
}

[Fact]
public void HomePageViewModel_GoToBillPaymentCommand_Execute_BillPaymentSelectOperatorPageDisplayed()
{
this.viewModel.GoToBillPaymentCommand.Execute(null);

this.navigationService.Verify(n => n.GoToBillPaymentSelectOperatorPage(), Times.Once);
}

[Fact]
public void HomePageViewModel_GoToVoucherCommand_Execute_VoucherSelectOperatorPageDisplayed()
{
this.viewModel.GoToVoucherCommand.Execute(null);

this.navigationService.Verify(n => n.GoToVoucherSelectOperatorPage(), Times.Once);
}

[Fact]
public void HomePageViewModel_GoToAdminCommand_Execute_AdminPageDisplayed()
{
this.viewModel.GoToAdminCommand.Execute(null);

this.navigationService.Verify(n => n.GoToAdminPage(), Times.Once);
}
}
20 changes: 20 additions & 0 deletions TransactionProcessor.Mobile.BusinessLogic/Logging/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public static void Initialise(ILogger loggerObject)
/// <param name="exception">The exception.</param>
public static void LogCritical(String message, Exception exception)
{
if (Logger.LoggerObjects == null || Logger.LoggerObjects.Any() == false) {
Console.WriteLine($"{message}: {exception}");
return;
}
foreach (ILogger loggerObject in Logger.LoggerObjects) {
loggerObject.LogCritical(message, exception);
}
Expand All @@ -70,6 +74,10 @@ public static void LogCritical(String message, Exception exception)
/// <param name="message">The message.</param>
public static void LogDebug(String message)
{
if (Logger.LoggerObjects == null || Logger.LoggerObjects.Any() == false) {
Console.WriteLine(message);
return;
}
foreach (ILogger loggerObject in Logger.LoggerObjects)
{
loggerObject.LogDebug(message);
Expand All @@ -82,6 +90,10 @@ public static void LogDebug(String message)
/// <param name="exception">The exception.</param>
public static void LogError(String message, Exception exception)
{
if (Logger.LoggerObjects == null || Logger.LoggerObjects.Any() == false) {
Console.WriteLine($"{message}: {exception}");
return;
}
foreach (ILogger loggerObject in Logger.LoggerObjects) {
loggerObject.LogError(message, exception);
}
Expand Down Expand Up @@ -109,6 +121,10 @@ public static void LogInformation(String message)
/// <param name="message">The message.</param>
public static void LogTrace(String message)
{
if (Logger.LoggerObjects == null || Logger.LoggerObjects.Any() == false) {
Console.WriteLine(message);
return;
}
foreach (ILogger loggerObject in Logger.LoggerObjects) {
loggerObject.LogTrace(message);
}
Expand All @@ -120,6 +136,10 @@ public static void LogTrace(String message)
/// <param name="message">The message.</param>
public static void LogWarning(String message)
{
if (Logger.LoggerObjects == null || Logger.LoggerObjects.Any() == false) {
Console.WriteLine(message);
return;
}
foreach (ILogger loggerObject in Logger.LoggerObjects)
{
loggerObject.LogWarning(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,7 @@ Task GoToBillPaymentPayBillPage(ProductDetails productDetails,
Task GoToReportsSalesAnalysis();
Task GoToReportsBalanceAnalysis();

Task GoToTransactions();

#endregion
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Windows.Input;
using MvvmHelpers.Commands;
using TransactionProcessor.Mobile.BusinessLogic.Services;
using TransactionProcessor.Mobile.BusinessLogic.UIServices;

Expand All @@ -13,6 +15,16 @@ public HomePageViewModel(IApplicationCache applicationCache,
INavigationService navigationService,
INavigationParameterService navigationParameterService) :base(applicationCache,dialogService, navigationService, deviceService,navigationParameterService)
{

this.GoToMobileTopupCommand = new AsyncCommand(async () => await this.NavigationService.GoToMobileTopupSelectOperatorPage());
this.GoToBillPaymentCommand = new AsyncCommand(async () => await this.NavigationService.GoToBillPaymentSelectOperatorPage());
this.GoToVoucherCommand = new AsyncCommand(async () => await this.NavigationService.GoToVoucherSelectOperatorPage());
this.GoToAdminCommand = new AsyncCommand(async () => await this.NavigationService.GoToAdminPage());
this.GoToTransactionsCommand = new AsyncCommand(async () => await this.NavigationService.GoToTransactions());
}

public ICommand GoToMobileTopupCommand { get; }
public ICommand GoToBillPaymentCommand { get; }
public ICommand GoToVoucherCommand { get; }
public ICommand GoToAdminCommand { get; }
public ICommand GoToTransactionsCommand { get; }
}
129 changes: 120 additions & 9 deletions TransactionProcessor.Mobile/Pages/AppHome/HomePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,124 @@
x:Class="TransactionProcessor.Mobile.Pages.AppHome.HomePage"
xmlns:controls="using:TransactionProcessor.Mobile.Controls"
xmlns:common="using:TransactionProcessor.Mobile.Pages.Common"
Shell.NavBarIsVisible="False">
<VerticalStackLayout x:Name="MainLayout" Style="{DynamicResource Layout}">
<controls:TitleLabel Text="Home" AutomationId="Home" FontSize="20" HorizontalTextAlignment="Center" VerticalOptions="End" FontAttributes="Bold" Padding="20,0,0,20"/>
<Image Source="loginimage.jpg" VerticalOptions="Start" Style="{DynamicResource LoginImage}"/>
<Label Text="Welcome to .NET MAUI!"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
<Button Text="Exit Application" AutomationId="BackButton" Style="{StaticResource StandardButton}" Command="{Binding BackButtonCommand}"/>
</VerticalStackLayout>
Shell.NavBarIsVisible="False"
Padding="0">
<ScrollView>
<VerticalStackLayout Spacing="0">

<!-- Header with gradient background -->
<Grid HeightRequest="230">
<Grid.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="{StaticResource primary}" Offset="0.0"/>
<GradientStop Color="#2B4A8C" Offset="1.0"/>
</LinearGradientBrush>
</Grid.Background>
<VerticalStackLayout VerticalOptions="Center" HorizontalOptions="Center" Spacing="6" Padding="20">
<Image Source="headerlogo.svg" HeightRequest="90" WidthRequest="90" HorizontalOptions="Center"/>
<Label Text="Transaction Processor"
AutomationId="Home"
FontSize="22"
FontAttributes="Bold"
TextColor="White"
HorizontalOptions="Center"/>
<Label Text="Welcome back"
FontSize="14"
TextColor="White"
Opacity="0.85"
HorizontalOptions="Center"/>
</VerticalStackLayout>
</Grid>

<!-- Quick Actions section -->
<VerticalStackLayout Padding="20,24,20,16" Spacing="16">
<Label Text="Quick Actions"
FontSize="18"
FontAttributes="Bold"
TextColor="{StaticResource labelTextColor}"/>

<Grid ColumnDefinitions="*,*"
RowDefinitions="Auto,Auto"
ColumnSpacing="12"
RowSpacing="12">

<!-- Mobile Topup card -->
<Frame Grid.Row="0" Grid.Column="0" Style="{StaticResource HomeCardFrame}">
<Frame.GestureRecognizers>
<TapGestureRecognizer Command="{Binding GoToMobileTopupCommand}" AutomationId="MobileTopupCard"/>
</Frame.GestureRecognizers>
<VerticalStackLayout Spacing="8" HorizontalOptions="Center">
<Image Source="transactionsbutton.svg" HeightRequest="40" WidthRequest="40" HorizontalOptions="Center"/>
<Label Text="Mobile Topup"
FontSize="13"
FontAttributes="Bold"
TextColor="{StaticResource mobileTopup}"
HorizontalOptions="Center"/>
</VerticalStackLayout>
</Frame>

<!-- Bill Payment card -->
<Frame Grid.Row="0" Grid.Column="1" Style="{StaticResource HomeCardFrame}">
<Frame.GestureRecognizers>
<TapGestureRecognizer Command="{Binding GoToBillPaymentCommand}" AutomationId="BillPaymentCard"/>
</Frame.GestureRecognizers>
<VerticalStackLayout Spacing="8" HorizontalOptions="Center">
<Image Source="transactionsbutton.svg" HeightRequest="40" WidthRequest="40" HorizontalOptions="Center"/>
<Label Text="Bill Payment"
FontSize="13"
FontAttributes="Bold"
TextColor="{StaticResource billPayment}"
HorizontalOptions="Center"/>
</VerticalStackLayout>
</Frame>

<!-- Voucher card -->
<Frame Grid.Row="1" Grid.Column="0" Style="{StaticResource HomeCardFrame}">
<Frame.GestureRecognizers>
<TapGestureRecognizer Command="{Binding GoToVoucherCommand}" AutomationId="VoucherCard"/>
</Frame.GestureRecognizers>
<VerticalStackLayout Spacing="8" HorizontalOptions="Center">
<Image Source="transactionsbutton.svg" HeightRequest="40" WidthRequest="40" HorizontalOptions="Center"/>
<Label Text="Voucher"
FontSize="13"
FontAttributes="Bold"
TextColor="{StaticResource voucher}"
HorizontalOptions="Center"/>
</VerticalStackLayout>
</Frame>

<!-- Admin card -->
<Frame Grid.Row="1" Grid.Column="1" Style="{StaticResource HomeCardFrame}">
<Frame.GestureRecognizers>
<TapGestureRecognizer Command="{Binding GoToAdminCommand}" AutomationId="AdminCard"/>
</Frame.GestureRecognizers>
<VerticalStackLayout Spacing="8" HorizontalOptions="Center">
<Image Source="transactionsbutton.svg" HeightRequest="40" WidthRequest="40" HorizontalOptions="Center"/>
<Label Text="Admin"
FontSize="13"
FontAttributes="Bold"
TextColor="{StaticResource admin}"
HorizontalOptions="Center"/>
</VerticalStackLayout>
</Frame>

</Grid>

<!-- All Transactions button -->
<Button Text="All Transactions"
AutomationId="AllTransactionsButton"
Style="{StaticResource StandardButton}"
Command="{Binding GoToTransactionsCommand}"/>

</VerticalStackLayout>

<!-- Log Out button -->
<Button Text="Log Out"
AutomationId="BackButton"
Style="{StaticResource StandardButton}"
Command="{Binding BackButtonCommand}"
Margin="20,8,20,32"/>

</VerticalStackLayout>
</ScrollView>
</common:NoBackWithoutLogoutPage>
6 changes: 3 additions & 3 deletions TransactionProcessor.Mobile/Pages/LoginPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

<!-- Branding section -->
<VerticalStackLayout HorizontalOptions="Center" Spacing="10" Padding="20,80,20,40">
<Image Source="loginimage.jpg"
HeightRequest="120"
WidthRequest="120"
<Image Source="headerlogo.svg"
HeightRequest="150"
WidthRequest="150"
HorizontalOptions="Center"/>
<Label Text="Transaction Processor"
FontSize="24"
Expand Down
27 changes: 27 additions & 0 deletions TransactionProcessor.Mobile/Resources/Images/headerlogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions TransactionProcessor.Mobile/Resources/Styles/LightTheme.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,13 @@
<Setter Property="HorizontalOptions" Value="Fill"/>
</Style>

<Style x:Key="HomeCardFrame" TargetType="Frame">
<Setter Property="CornerRadius" Value="16"/>
<Setter Property="HasShadow" Value="True"/>
<Setter Property="BackgroundColor" Value="White"/>
<Setter Property="Padding" Value="16,20"/>
<Setter Property="BorderColor" Value="{StaticResource Gray100}"/>
<Setter Property="Margin" Value="0"/>
</Style>

</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ public async Task GoToReportsBalanceAnalysis(){
await NavigateTo(nameof(ReportsBalanceAnalysisPage));
}

public async Task GoToTransactions() {
await NavigateTo("///main/transactions");
}

private async Task NavigateTo(String route) {
try {
Logger.LogInformation($"navigating to {route}");
Expand Down
Loading