<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="IHM.Mobile.DashBoard">
<ScrollView>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="0.25*"/>
            <RowDefinition Height="0.15*"/>
            <RowDefinition Height="1.40*"/>
            <RowDefinition Height="0.15*"/>
            <RowDefinition/>
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <StackLayout Orientation="Horizontal">
            <Label
            Text="Bienvenue"
            VerticalOptions="Center" 
            HorizontalOptions="Start" 
            Margin="10,10,10,20"
            FontSize="25"
            />
            <Label
            FontAttributes="Bold"
            Margin="0,10,0,0"
            Text="{Binding User.Prenom}"
            FontSize="25"
                />
        </StackLayout>
        <ImageButton Grid.Row="0" Grid.Column="1" Source="account_banks.png" 
                     HorizontalOptions="End" Padding="10" Margin="10"
                     CornerRadius="10" HeightRequest="65" 
                     BackgroundColor="{StaticResource Primary}"
                     Clicked="Banques_Clicked"/>




        <Label Grid.Row="1" Grid.ColumnSpan="2" Text="Liste des Dernières Opérations : " FontAttributes="Bold" FontSize="Body" Padding="20,5,0,0"/>








        <CollectionView Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding LesOpe}">
            <CollectionView.ItemTemplate>
                <DataTemplate>
                    <Grid Padding="10">
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>

                        <ImageButton Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
                               Source="{Binding ImageSrc}"
                               CornerRadius="10"/>
                        <Label Grid.Row="0" Grid.Column="1"
                               Text="{Binding NomOpe}"
                               FontAttributes="Bold" />
                        <Label Grid.Row="1" Grid.Column="1"
                               Text="{Binding DetailTypeOpe}"
                               FontAttributes="Italic"/>
                        <Label Grid.Row="0" Grid.Column="2"
                               Text="{Binding DateOpe}"/>
                        <Label Grid.Row="0" Grid.Column="3" Grid.ColumnSpan="2"
                               Text="{Binding MontantOpe}"
                               FontAttributes="Bold"/>
                    </Grid>
                </DataTemplate>
            </CollectionView.ItemTemplate>
        </CollectionView>

        <Label Grid.Row="3" Grid.ColumnSpan="2" Text="Liste des Comptes favoris :" FontAttributes="Bold" FontSize="Body" Padding="20,0,0,0"/>

        <CollectionView Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding ComptesFav}" ItemsLayout="HorizontalList">
            <CollectionView.ItemTemplate>
                <DataTemplate>
                    <Grid Padding="10">
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>

                        <Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
                               Text="{Binding Banque}"
                               FontAttributes="Bold"/>
                        <Label Grid.Row="0" Grid.Column="1"
                               Text="{Binding Type}"
                               FontAttributes="Italic"/>
                        <Label Grid.Row="1" Grid.Column="1"
                               Text="{Binding Solde}"
                               FontAttributes="Bold"/>
                        <Label Grid.Row="0" Grid.Column="2"
                               Text="{Binding DateMaJ}"/>

                    </Grid>
                </DataTemplate>
            </CollectionView.ItemTemplate>
        </CollectionView>



    </Grid>
</ScrollView>
</ContentPage>