<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="IHM.Desktop.Operations">


    <Border Stroke="{StaticResource Yellow100Accent}" StrokeThickness="4" Margin="10" StrokeShape="RoundRectangle 45,5,5,45">

        <Grid BackgroundColor="{StaticResource Tertiary}">
            <Grid.RowDefinitions>
                <RowDefinition Height="0.5*"/>
                <RowDefinition Height="0.75*"/>
                <RowDefinition Height="0.5*"/>
                <RowDefinition Height="5*"/>
                <RowDefinition Height="0.7*"/>

            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="1*"/>
            </Grid.ColumnDefinitions>

                <Label 
                    Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="4" 
            Style="{StaticResource TitreWindows}"
            Text="OPERATIONS"
            VerticalOptions="Center"
            HorizontalOptions="Center"/>
          



            <Button
                Clicked="AddCredit_Clicked"
                Grid.Column="0" Grid.Row="1" 
                x:Name="AddCredit"
                Text="Effectuer un crédit"
                Style="{StaticResource WindowsButton}"/>

            <Button
                Clicked="RetireOperation_Clicked"
                Grid.Column="1" Grid.Row="1" 
                x:Name="RetireOperation"
                Text="Retirer une opération"
                Style="{StaticResource WindowsButton}"/>

            <Button
                Clicked="AddDebit_Clicked"
                Grid.Column="2" Grid.Row="1" 
                x:Name="AddDebit"
                Text="Effectuer un débit"
                Style="{StaticResource WindowsButton}"/>

            <Button
                Clicked="DelOperation_Clicked"
                Grid.Column="3" Grid.Row="1" 
                x:Name="DelOperation"
                Text="Supprimer une opération"
                Style="{StaticResource WindowsButton}"/>




            <Border Stroke="{StaticResource Secondary}" Margin="10,0,10,0" Padding="3" StrokeThickness="4" StrokeShape="RoundRectangle 45,5,5,45"  Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="4">

                <Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="4">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1*"/>
                        <ColumnDefinition Width="1*"/>
                        <ColumnDefinition Width="1*"/>
                        <ColumnDefinition Width="1*"/>
                        <ColumnDefinition Width="1*"/>

                    </Grid.ColumnDefinitions>
                    <Label Text="Nom" Grid.Column="0" TextColor="{StaticResource Secondary}" HorizontalOptions="Center" FontSize="Micro" FontAttributes="Bold" VerticalOptions="Center"></Label>
                    <Label Text="Date" Grid.Column="1" TextColor="{StaticResource Secondary}" HorizontalOptions="Center" FontSize="Micro" FontAttributes="Bold" VerticalOptions="Center"></Label>
                    <Label Text="Moyen de Paiement" Grid.Column="2" TextColor="{StaticResource Secondary}" HorizontalOptions="Center" FontSize="Micro" FontAttributes="Bold" VerticalOptions="Center"></Label>
                    <Label Text="Tag" Grid.Column="3" TextColor="{StaticResource Secondary}" HorizontalOptions="Center" FontSize="Micro" FontAttributes="Bold" VerticalOptions="Center"></Label>
                    <Label Text="Montant" Grid.Column="4" TextColor="{StaticResource Secondary}" HorizontalOptions="Center" FontSize="Micro" FontAttributes="Bold" VerticalOptions="Center"></Label>

                </Grid>
            </Border>

            <ContentView  Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="4" Grid.RowSpan="1"   Margin="10,0,10,0" >

                <CollectionView  ItemsSource="{Binding SelectedCompte.LesOpe}"  Grid.Row="3" Grid.ColumnSpan="4" Grid.RowSpan="2">

                    <CollectionView.ItemTemplate>

                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="1*"/>
                                    <ColumnDefinition Width="1*"/>
                                    <ColumnDefinition Width="1*"/>
                                    <ColumnDefinition Width="1*"/>
                                    <ColumnDefinition Width="1*"/>

                                </Grid.ColumnDefinitions>



                                <Label Grid.Column="0" Text="{Binding Nom}" 
                                   TextColor="{StaticResource Secondary}" 
                               FontAttributes="Bold" FontSize="Body" 
                               HorizontalOptions="Center"
                               VerticalOptions="Center"/>

                                <Label Grid.Column="1" Text="{Binding DateOperation, StringFormat='{0:d}'}" 
                                   TextColor="{StaticResource Secondary}" 
                               FontAttributes="Bold" FontSize="Body" 
                               HorizontalOptions="Center"
                               VerticalOptions="Center"/>

                                <Label Grid.Column="2" Text="{Binding ModePayement}" 
                                   TextColor="{StaticResource Secondary}" 
                               FontAttributes="Bold" FontSize="Body" 
                               HorizontalOptions="Center"
                               VerticalOptions="Center"/>

                                <Label Grid.Column="3" Text="{Binding Tag}" 
                                   TextColor="{StaticResource Secondary}" 
                               FontAttributes="Bold" FontSize="Body" 
                               HorizontalOptions="Center"
                               VerticalOptions="Center"/>


                                <Label Grid.Column="4" Text="{Binding Montant}" 
                                   TextColor="{StaticResource Secondary}" 
                               FontAttributes="Bold" FontSize="Body" 
                               HorizontalOptions="Center"
                               VerticalOptions="Center"/>


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

            </ContentView>

            <ContentView Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4" Grid.RowSpan="5" x:Name="windowAjout">
                
            </ContentView>

            <Border Stroke="{StaticResource Secondary}" BackgroundColor="{StaticResource Yellow100Accent}" Margin="10,10,10,10" Padding="3" StrokeThickness="4" StrokeShape="RoundRectangle 45,5,5,45"  Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="4">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="6*"/>
                        <ColumnDefinition Width="1*"/>
                    </Grid.ColumnDefinitions>  
                    <Label Text="TOTAL" Grid.Column="0" Grid.ColumnSpan="2" HorizontalOptions="Center" TextColor="{StaticResource Secondary}"  FontSize="Medium" FontAttributes="Bold" VerticalOptions="Center"></Label>
                    <Label Text="{Binding SelectedCompte.Solde}" Grid.Column="1" Grid.ColumnSpan="2" HorizontalOptions="Center" TextColor="{StaticResource Secondary}"  FontSize="Medium" FontAttributes="Bold" VerticalOptions="Center"></Label>
                    <Label Text="€" Grid.Column="1" Grid.ColumnSpan="2" HorizontalOptions="End" Margin="0,0,50,0" TextColor="{StaticResource Secondary}"  FontSize="Medium" FontAttributes="Bold" VerticalOptions="Center"></Label>
                  
                </Grid>
              
            </Border>


        </Grid>
    </Border>
</ContentView>