-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
CheckoutView.xaml
170 lines (158 loc) · 6.4 KB
/
CheckoutView.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<?xml version="1.0" encoding="utf-8" ?>
<views:ContentPageBase
x:Class="eShop.ClientApp.Views.CheckoutView"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:templates="clr-namespace:eShop.ClientApp.Views.Templates"
xmlns:viewmodels="clr-namespace:eShop.ClientApp.ViewModels"
xmlns:views="clr-namespace:eShop.ClientApp.Views"
Title="CHECKOUT"
x:DataType="viewmodels:CheckoutViewModel">
<ContentPage.Resources>
<ResourceDictionary>
<Style x:Key="OrderTitleStyle" TargetType="{x:Type Label}">
<Setter Property="FontFamily" Value="Montserrat-Regular" />
<Setter Property="FontSize" Value="{StaticResource MediumSize}" />
<Setter Property="TextColor" Value="Gray" />
</Style>
<Style x:Key="OrderContentStyle" TargetType="{x:Type Label}">
<Setter Property="FontFamily" Value="Montserrat-Regular" />
<Setter Property="FontSize" Value="{StaticResource MediumSize}" />
</Style>
<Style
x:Key="ShippingAddressStyle"
BasedOn="{StaticResource OrderTitleStyle}"
TargetType="{x:Type Label}">
<Setter Property="FontSize" Value="{StaticResource LargeSize}" />
</Style>
<Style
x:Key="AddressStyle"
BasedOn="{StaticResource OrderContentStyle}"
TargetType="{x:Type Label}">
<Setter Property="FontSize" Value="{StaticResource LittleSize}" />
</Style>
</ResourceDictionary>
</ContentPage.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- ORDER INFO -->
<Grid Grid.Row="0" Padding="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="8" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="8" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label
Grid.Row="0"
Grid.Column="0"
Style="{StaticResource OrderTitleStyle}"
Text="ORDER NUMBER" />
<Label
Grid.Row="1"
Grid.Column="0"
Style="{StaticResource OrderContentStyle}"
Text="{Binding Order.OrderNumber}" />
<Label
Grid.Row="3"
Grid.Column="0"
Style="{StaticResource OrderTitleStyle}"
Text="TOTAL" />
<Label
Grid.Row="4"
Grid.Column="0"
Style="{StaticResource OrderContentStyle}"
Text="{Binding Order.Total, StringFormat='${0:N2}'}" />
<Label
Grid.Row="0"
Grid.Column="1"
Style="{StaticResource OrderTitleStyle}"
Text="DATE" />
<Label
Grid.Row="1"
Grid.Column="1"
Style="{StaticResource OrderContentStyle}"
Text="{Binding Order.OrderDate, StringFormat={StaticResource DateTimeFormat}}" />
<Label
Grid.Row="3"
Grid.Column="1"
Style="{StaticResource OrderTitleStyle}"
Text="STATUS" />
<Label
Grid.Row="4"
Grid.Column="1"
Style="{StaticResource OrderContentStyle}"
Text="{Binding Order.OrderStatus}" />
<!-- SHIPPING ADDRESS -->
<Label
Grid.Row="6"
Grid.Column="0"
Grid.ColumnSpan="2"
Style="{StaticResource ShippingAddressStyle}"
Text="SHIPPING ADDRESS" />
<VerticalStackLayout
Grid.Row="7"
Grid.Column="0"
Grid.ColumnSpan="2">
<Label Style="{StaticResource AddressStyle}" Text="{Binding ShippingAddress.Street}" />
<Label Style="{StaticResource AddressStyle}" Text="{Binding ShippingAddress.ZipCode}" />
<Label Style="{StaticResource AddressStyle}" Text="{Binding ShippingAddress.State}" />
<Label Style="{StaticResource AddressStyle}" Text="{Binding ShippingAddress.Country}" />
</VerticalStackLayout>
</Grid>
<!-- ORDER ITEMS -->
<CollectionView
Grid.Row="1"
ItemSizingStrategy="MeasureAllItems"
ItemsSource="{Binding Order.OrderItems}">
<CollectionView.ItemTemplate>
<DataTemplate>
<templates:OrderItemTemplate />
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<!-- CHECKOUT -->
<Grid
Grid.Row="2"
Padding="16"
BackgroundColor="{StaticResource LightGrayColor}"
ColumnDefinitions="*"
RowDefinitions="auto">
<Button
Grid.Row="0"
Grid.Column="0"
BackgroundColor="Black"
Command="{Binding CheckoutCommand}"
CornerRadius="4"
Text="Place order" />
</Grid>
<!-- INDICATOR -->
<ActivityIndicator
Grid.Row="0"
Grid.RowSpan="2"
HorizontalOptions="Center"
IsRunning="{Binding IsBusy}"
IsVisible="{Binding IsBusy}"
VerticalOptions="Center"
Color="{StaticResource HighlightColor}">
<ActivityIndicator.WidthRequest>
<OnPlatform x:TypeArguments="x:Double">
<On Platform="iOS, Android" Value="100" />
<On Platform="WinUI" Value="400" />
</OnPlatform>
</ActivityIndicator.WidthRequest>
</ActivityIndicator>
</Grid>
</views:ContentPageBase>