Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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 @@ -62,6 +62,8 @@ Task GoToBillPaymentPayBillPage(ProductDetails productDetails,
Task GoToMyAccountContacts();
Task GoToMyAccountDetails();

Task GoToTransactionsPage();

Task GoToReportsSalesAnalysis();
Task GoToReportsBalanceAnalysis();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,96 @@
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using CommunityToolkit.Mvvm.Input;
using TransactionProcessor.Mobile.BusinessLogic.Common;
using TransactionProcessor.Mobile.BusinessLogic.Models;
using TransactionProcessor.Mobile.BusinessLogic.Services;
using TransactionProcessor.Mobile.BusinessLogic.UIServices;

namespace TransactionProcessor.Mobile.BusinessLogic.ViewModels;

[ExcludeFromCodeCoverage]
public class HomePageViewModel : ExtendedBaseViewModel
public partial class HomePageViewModel : ExtendedBaseViewModel
{
#region Fields

private String merchantName;
private String availableBalance;

#endregion

#region Constructors

public HomePageViewModel(IApplicationCache applicationCache,
IDialogService dialogService,
IDeviceService deviceService,
INavigationService navigationService,
INavigationParameterService navigationParameterService) :base(applicationCache,dialogService, navigationService, deviceService,navigationParameterService)
INavigationParameterService navigationParameterService)
: base(applicationCache, dialogService, navigationService, deviceService, navigationParameterService)
{
this.Title = "Home";
}

#endregion

#region Properties

public String MerchantName
{
get => this.merchantName;
set => this.SetProperty(ref this.merchantName, value);
}

public String AvailableBalance
{

get => this.availableBalance;
set => this.SetProperty(ref this.availableBalance, value);
}
}

#endregion

#region Methods

public override async Task Initialise(CancellationToken cancellationToken)
{
await base.Initialise(cancellationToken);

MerchantDetailsModel merchantDetails = this.ApplicationCache.GetMerchantDetails();
if (merchantDetails != null)
{
this.MerchantName = merchantDetails.MerchantName;
this.AvailableBalance = merchantDetails.AvailableBalance.ToString("C2");
}
else
{
this.MerchantName = String.Empty;
this.AvailableBalance = "-";
}
}

[RelayCommand]
public async Task MobileTopup()
{
CorrelationIdProvider.NewId();
await this.NavigationService.GoToMobileTopupSelectOperatorPage();
}

[RelayCommand]
public async Task BillPayment()
{
CorrelationIdProvider.NewId();
await this.NavigationService.GoToBillPaymentSelectOperatorPage();
}

[RelayCommand]
public async Task Voucher()
{
CorrelationIdProvider.NewId();
await this.NavigationService.GoToVoucherSelectOperatorPage();
}

[RelayCommand]
public async Task AllTransactions()
{
await this.NavigationService.GoToTransactionsPage();
}

#endregion
}
106 changes: 96 additions & 10 deletions TransactionProcessor.Mobile/Pages/AppHome/HomePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,99 @@
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>
</common:NoBackWithoutLogoutPage>
Shell.NavBarIsVisible="False"
x:Name="HomeView">
<ScrollView BackgroundColor="{StaticResource pageBackgroundColor}">
<VerticalStackLayout Spacing="0">

<!-- Header section -->
<Frame Style="{StaticResource PageHeaderStyle}">
<VerticalStackLayout Spacing="4">
<Label Text="Transaction Processor" Style="{StaticResource HeaderTitleStyle}"
AutomationId="Home"/>
<Label Text="{Binding MerchantName}" Style="{StaticResource HeaderSubtitleStyle}"/>
</VerticalStackLayout>
</Frame>

<!-- Dashboard content -->
<VerticalStackLayout Padding="16,16,16,16" Spacing="0">

<!-- Available balance card -->
<Frame Style="{StaticResource BalanceCardStyle}">
<VerticalStackLayout Spacing="4">
<Label Text="Available Balance" TextColor="White" FontSize="13" Opacity="0.85"/>
<Label Text="{Binding AvailableBalance}" TextColor="White"
FontSize="32" FontAttributes="Bold"/>
</VerticalStackLayout>
</Frame>

<!-- Quick Actions label -->
<Label Text="Quick Actions" FontSize="16" FontAttributes="Bold"
TextColor="{StaticResource labelTextColor}" Margin="4,0,0,8"/>

<!-- Quick action tiles grid (2 columns) -->
<Grid ColumnDefinitions="*,*" RowDefinitions="auto,auto">

<!-- Mobile Topup tile -->
<Frame Grid.Row="0" Grid.Column="0" Style="{StaticResource DashboardTileStyle}"
BackgroundColor="{StaticResource mobileTopup}">
<Frame.GestureRecognizers>
<TapGestureRecognizer Command="{Binding MobileTopupCommand}"/>
</Frame.GestureRecognizers>
<VerticalStackLayout VerticalOptions="Center" HorizontalOptions="Center" Spacing="4">
<Label Text="Mobile" Style="{StaticResource TileLabelStyle}" FontAttributes="Bold"/>
<Label Text="Topup" Style="{StaticResource TileLabelStyle}"/>
</VerticalStackLayout>
</Frame>

<!-- Bill Payment tile -->
<Frame Grid.Row="0" Grid.Column="1" Style="{StaticResource DashboardTileStyle}"
BackgroundColor="{StaticResource billPayment}">
<Frame.GestureRecognizers>
<TapGestureRecognizer Command="{Binding BillPaymentCommand}"/>
</Frame.GestureRecognizers>
<VerticalStackLayout VerticalOptions="Center" HorizontalOptions="Center" Spacing="4">
<Label Text="Bill" Style="{StaticResource TileLabelStyle}" FontAttributes="Bold"/>
<Label Text="Payment" Style="{StaticResource TileLabelStyle}"/>
</VerticalStackLayout>
</Frame>

<!-- Voucher tile -->
<Frame Grid.Row="1" Grid.Column="0" Style="{StaticResource DashboardTileStyle}"
BackgroundColor="{StaticResource voucher}">
<Frame.GestureRecognizers>
<TapGestureRecognizer Command="{Binding VoucherCommand}"/>
</Frame.GestureRecognizers>
<VerticalStackLayout VerticalOptions="Center" HorizontalOptions="Center" Spacing="4">
<Label Text="Voucher" Style="{StaticResource TileLabelStyle}" FontAttributes="Bold"/>
<Label Text="Issue" Style="{StaticResource TileLabelStyle}"/>
</VerticalStackLayout>
</Frame>

<!-- All Transactions tile (navigates to Transactions tab) -->
<Frame Grid.Row="1" Grid.Column="1" Style="{StaticResource DashboardTileStyle}"
BackgroundColor="{StaticResource primary}">
<Frame.GestureRecognizers>
<TapGestureRecognizer Command="{Binding AllTransactionsCommand}"/>
</Frame.GestureRecognizers>
<VerticalStackLayout VerticalOptions="Center" HorizontalOptions="Center" Spacing="4">
<Label Text="All" Style="{StaticResource TileLabelStyle}" FontAttributes="Bold"/>
<Label Text="Transactions" Style="{StaticResource TileLabelStyle}"/>
</VerticalStackLayout>
</Frame>

</Grid>

<!-- Exit button -->
<Frame Style="{StaticResource ActionTileStyle}"
BackgroundColor="{StaticResource MidGray}">
<Frame.GestureRecognizers>
<TapGestureRecognizer Command="{Binding BackButtonCommand}"/>
</Frame.GestureRecognizers>
<Label Text="Exit Application" Style="{StaticResource TileLabelStyle}" FontAttributes="Bold" AutomationId="BackButton"/>
</Frame>

</VerticalStackLayout>
</VerticalStackLayout>
</ScrollView>
</common:NoBackWithoutLogoutPage>
105 changes: 66 additions & 39 deletions TransactionProcessor.Mobile/Pages/LoginPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,54 +7,81 @@
Shell.NavBarIsVisible="False"
Shell.FlyoutItemIsVisible="True"
x:Name="Logon">
<ContentPage.Content>
<ScrollView>
<!-- Main structure-->
<VerticalStackLayout x:Name="MainLayout" Style="{DynamicResource Layout}">
<!--Main image-->
<Image Source="loginimage.jpg" VerticalOptions="Start" Style="{DynamicResource LoginImage}"/>

<!-- Title-->
<Label Text="Log In" FontSize="34" HorizontalOptions="Center" FontAttributes="Bold" Padding="20,0,0,20"
AutomationId="LoginLabel"
x:Name="LoginLabel"/>
<Frame Style="{DynamicResource MainFrame}">

<VerticalStackLayout x:Name="SubLayout">
<Entry x:Name="UserNameEntry"
Placeholder="User name or email address"
AutomationId="UserNameEntry"
Style="{DynamicResource UserNameEntryStyle}"
Text="{Binding UserName}">
</Entry>

<Entry x:Name="PasswordEntry"
Placeholder="******"
AutomationId="PasswordEntry"
Style="{DynamicResource PasswordEntryStyle}"
Text="{Binding Password}">
</Entry>
<HorizontalStackLayout Margin="20" Spacing="10">
<Label Text="Use Training Mode?" VerticalOptions="Center" HorizontalOptions="Start"/>

<Switch x:Name="UseTrainingMode" VerticalOptions="Center" HorizontalOptions="Start" AutomationId="UseTrainingModeSwitch"
IsToggled="{Binding UseTrainingMode}"
/>
<Grid RowDefinitions="220,*">

<!-- Branded header section -->
<BoxView Grid.Row="0" Color="{StaticResource primary}"/>
<VerticalStackLayout Grid.Row="0" VerticalOptions="Center" HorizontalOptions="Center" Spacing="4">
<Label Text="Transaction Processor" Style="{StaticResource HeaderTitleStyle}"
HorizontalOptions="Center" AutomationId="LoginLabel"/>
<Label Text="Merchant Point of Sale" Style="{StaticResource HeaderSubtitleStyle}"
HorizontalOptions="Center"/>
</VerticalStackLayout>

<!-- Login form card -->
<ScrollView Grid.Row="1" BackgroundColor="{StaticResource pageBackgroundColor}">
<VerticalStackLayout Spacing="0" Padding="0,20,0,20">

<Frame Style="{StaticResource LoginFormFrameStyle}">
<VerticalStackLayout Spacing="8">

<Label Text="Sign In" FontSize="22" FontAttributes="Bold"
TextColor="{StaticResource primary}" Margin="0,0,0,8"/>

<!-- Username field -->
<Frame Style="{StaticResource FormEntryStyle}">
<Entry x:Name="UserNameEntry"
Placeholder="Username or email address"
AutomationId="UserNameEntry"
Style="{DynamicResource UserNameEntryStyle}"
Text="{Binding UserName}"/>
</Frame>

<!-- Password field -->
<Frame Style="{StaticResource FormEntryStyle}">
<Entry x:Name="PasswordEntry"
Placeholder="Password"
AutomationId="PasswordEntry"
Style="{DynamicResource PasswordEntryStyle}"
Text="{Binding Password}"/>
</Frame>

<!-- Training mode toggle -->
<HorizontalStackLayout Margin="0,8,0,4" Spacing="12">
<Label Text="Training Mode" VerticalOptions="Center"
TextColor="{StaticResource labelTextColor}" FontSize="14"/>
<Switch x:Name="UseTrainingMode"
VerticalOptions="Center"
AutomationId="UseTrainingModeSwitch"
IsToggled="{Binding UseTrainingMode}"/>
</HorizontalStackLayout>

<Button Text="Continue" Style="{StaticResource StandardButton}" AutomationId="LoginButton">
<Button Text="Sign In" Style="{StaticResource StandardButton}"
AutomationId="LoginButton" Margin="0,8,0,0">
<Button.Behaviors>
<toolkit:EventToCommandBehavior
EventName="Clicked"
Command="{Binding LogonCommand}" BindingContext="{Binding Source={x:Reference Logon}, Path=BindingContext}" />
Command="{Binding LogonCommand}"
BindingContext="{Binding Source={x:Reference Logon}, Path=BindingContext}"/>
</Button.Behaviors>
</Button>

<Label AutomationId="DeviceSerial" VerticalOptions="Center" HorizontalOptions="Start" Text="{Binding DeviceIdentifier}"/>
<Entry x:Name="ConfigHostUrlEntry" AutomationId="ConfigHostUrlEntry" Text="{Binding ConfigHostUrl}"/>
<Label AutomationId="DeviceSerial" FontSize="11"
TextColor="{StaticResource MidGray}"
HorizontalOptions="Center" Margin="0,8,0,0"
Text="{Binding DeviceIdentifier}"/>

<!-- Config URL (advanced, small) -->
<Entry x:Name="ConfigHostUrlEntry" AutomationId="ConfigHostUrlEntry"
Text="{Binding ConfigHostUrl}"
Placeholder="Config host URL (optional)"
FontSize="11" TextColor="{StaticResource MidGray}"
PlaceholderColor="{StaticResource MidGray}"/>
</VerticalStackLayout>
</Frame>

</VerticalStackLayout>
</ScrollView>
</ContentPage.Content>
</ContentPage>

</Grid>
</ContentPage>
Loading
Loading