Billing/Billing.Shared/Views/BillPage.xaml
2022-03-02 17:31:49 +08:00

77 lines
4.6 KiB
XML

<?xml version="1.0" encoding="utf-8" ?>
<ui:BillingPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:r="clr-namespace:Billing.Languages"
xmlns:ui="clr-namespace:Billing.UI"
xmlns:v="clr-namespace:Billing.Views"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Billing.Views.BillPage"
x:DataType="v:BillPage"
x:Name="billPage"
BindingContext="{x:Reference billPage}"
Title="{r:Text Bills}">
<ContentPage.Resources>
<ui:TitleDateConverter x:Key="titleDateConverter"/>
<ui:MoneyConverter x:Key="moneyConverter" MarkVisible="False" Absolute="True"/>
<ui:BalanceColorConverter x:Key="colorConverter"/>
<ui:UIBillConverter x:Key="billConverter"/>
<ui:IconConverter x:Key="iconConverter"/>
</ContentPage.Resources>
<Shell.TitleView>
<Grid ColumnSpacing="16" ColumnDefinitions="20,*,20">
<ui:TintImage Source="calendar.png" WidthRequest="20" HeightRequest="20" VerticalOptions="Center"/>
<ui:LongPressButton Grid.Column="1" Text="{Binding SelectedDate, Converter={StaticResource titleDateConverter}}"
TextColor="{DynamicResource PrimaryColor}"
HorizontalOptions="{OnPlatform iOS=Center, Android=Start}"
FontFamily="{DynamicResource RobotoCondensedFontBold}"
FontAttributes="Bold" FontSize="20" VerticalOptions="Center"
LongPressed="OnTitleDateLongPressed"/>
</Grid>
</Shell.TitleView>
<Grid RowDefinitions="Auto, Auto, *">
<ui:BillingDate x:Name="billingDate" SelectedDate="{Binding SelectedDate}" DateSelected="OnDateSelected"/>
<Grid Grid.Row="1" Padding="8" ColumnSpacing="8" ColumnDefinitions="Auto, *, Auto"
BackgroundColor="{DynamicResource PromptBackgroundColor}">
<ui:TintImage Source="bars.png" WidthRequest="23" HeightRequest="23"/>
<Label Grid.Column="1" Text="{r:Text NoRecords}" TextColor="{DynamicResource TextColor}"
VerticalOptions="Center"/>
<StackLayout Grid.Column="2" Orientation="Horizontal" Spacing="6">
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Command="{Binding AddBilling}"/>
</StackLayout.GestureRecognizers>
<Label Text="{r:Text TapToMemo}" TextColor="{DynamicResource PrimaryColor}"
VerticalOptions="Center"/>
<ui:TintImage Source="right.png" WidthRequest="24" HeightRequest="24"/>
</StackLayout>
</Grid>
<!-- bill list -->
<ScrollView Grid.Row="2">
<ui:GroupStackLayout x:Name="billsLayout" ItemsSource="{Binding Bills}" Margin="0, 10, 0, 0">
<ui:GroupStackLayout.ItemTemplate>
<DataTemplate x:DataType="v:UIBill">
<Grid Padding="20, 0, 10, 0" ColumnSpacing="10"
ColumnDefinitions="Auto, *, Auto" RowDefinitions="Auto, Auto">
<ui:TintImage Source="{Binding Icon, Converter={StaticResource iconConverter}}"
WidthRequest="26" HeightRequest="20" VerticalOptions="Center"/>
<Label Grid.Column="1" Text="{Binding Name}" TextColor="{DynamicResource TextColor}"
VerticalOptions="Center"
FontSize="Default" FontAttributes="Bold"/>
<Label Grid.Column="2" Text="{Binding Amount, Converter={StaticResource moneyConverter}}"
TextColor="{Binding Amount, Converter={StaticResource colorConverter}}"
VerticalOptions="Center"/>
<Label Grid.Row="1" Grid.Column="1" Text="{Binding ., Converter={StaticResource billConverter}}"
FontSize="Small"
TextColor="{DynamicResource SecondaryTextColor}"/>
</Grid>
</DataTemplate>
</ui:GroupStackLayout.ItemTemplate>
</ui:GroupStackLayout>
</ScrollView>
<!--<ui:CircleButton Grid.Row="1" VerticalOptions="End" HorizontalOptions="End"
Margin="20" Padding="0"
BackgroundColor="{DynamicResource PrimaryColor}"
ImageSource="plus.png" HeightRequest="24" WidthRequest="24"/>-->
</Grid>
</ui:BillingPage>