<?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.Echeancier"
             BackgroundColor="{StaticResource Yellow300Accent}">
    
    <VerticalStackLayout Margin="20">

        <Label 
            Style="{StaticResource TitreWindows}"
            Text="ECHEANCIER"
            VerticalOptions="StartAndExpand"/>
        
        <HorizontalStackLayout HorizontalOptions="Center" VerticalOptions="Fill">
            
            <Button
                x:Name="SaveEcheance"
                Text="Enregistrer une échéance"
                Style="{StaticResource WindowsButton}"/>

            <Button
                x:Name="DelEcheance"
                Text="Supprimer une échéance"
                Style="{StaticResource WindowsButton}"/>
            
        </HorizontalStackLayout>

        <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>

        <HorizontalStackLayout HorizontalOptions="Center" VerticalOptions="Fill">

            <Border Background="{StaticResource Primary}"
            Style="{StaticResource TotalButton}">
            <Label Text=" -- BINDING -- " FontFamily="Comic sans MS"/>
            </Border>

            <Border Background="{StaticResource Tertiary}"
            Style="{StaticResource TotalButton}">
            <Label Text=" -- BINDING -- " FontFamily="Comic sans MS"/>
            </Border>

        </HorizontalStackLayout>



    </VerticalStackLayout>
</ContentView>