<?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"
             xmlns:composant="clr-namespace:IHM.Composant"
             x:Class="IHM.Mobile.GestionBanques"
             Title="GestionBanques">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="0.10*"/>
            <RowDefinition Height="0.05*"/>
            <RowDefinition/>
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1.95*"/>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>

        <HorizontalStackLayout Grid.Row="0" Grid.Column="0" VerticalOptions="Center">
            <Image Source="Resources/Images/logo_sans_fond.png" HeightRequest="50" Margin="20"/>
            <Label Text="Cons'Eco" FontSize="20" VerticalOptions="Center" FontAttributes="Bold"/>
            <Button x:Name="boutonRetour" Text="retour" HeightRequest="50" Clicked="returnbutton" IsVisible="False" HorizontalOptions="End"/>
        </HorizontalStackLayout>

        <ImageButton Grid.Row="0" Grid.Column="2" Source="add_banks.png" 
                     HorizontalOptions="End" Padding="10" Margin="10"
                     CornerRadius="10" HeightRequest="65" 
                     BackgroundColor="{StaticResource Primary}"
                     Clicked="AddBanque_Clicked"/>

        <Label Grid.Row="1" Grid.ColumnSpan="3" Text="Liste de vos banques : " FontAttributes="Bold" FontSize="Body" Padding="20,10,0,0"/>

        <CollectionView Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" ItemsSource="{Binding User.LesBanques}">
            <CollectionView.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="1.75*"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>

                        <Label Grid.Column="0" Text="{Binding Nom}" 
                               FontAttributes="Bold" FontSize="Body" 
                               HorizontalOptions="Center"
                               VerticalOptions="Center"/>
                        <ImageButton Grid.Column="2" Source="reload_banks.png" 
                             Padding="10" Margin="5"
                             CornerRadius="10" HeightRequest="65" 
                             BackgroundColor="{StaticResource Primary}"/>

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



    </Grid>
</ContentPage>