<?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="WorkFlowCheck.MAUI.Pages.BaseStock.CheckPointsPage"
             Title="Ellenőrzési pontok">
    <StackLayout>
        <Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Medium" HorizontalOptions="Center" />
        <ProgressBar x:Name="progressBar" WidthRequest="300" HeightRequest="40" />
        <Button
            x:Name="ButtonSync" Margin="5"
            Text="Adatok szinkronizálása" 
            SemanticProperties.Hint="Adatok szinkronizálása"
            Clicked="OnButtonSync"
            HorizontalOptions="Fill" />
        <RefreshView x:Name="refreshView" Command="{Binding RefreshCommand}" IsRefreshing="{Binding IsRefreshing}">
            <CollectionView x:Name="CheckPointsList">
                <CollectionView.ItemTemplate>
                    <DataTemplate>
                        <Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
                            <StackLayout>
                                <Label Text="{Binding ShortName}" FontSize="16" FontAttributes="Bold" />
                                <Label Text="{Binding Code}" FontSize="14" />
                                <HorizontalStackLayout HorizontalOptions="End">
                                    <Button Text="Edit" Margin="5,0,0,0"
                                    Command="{Binding BindingContext.EditCommand, Source={x:Reference CheckPointsList}}" 
                                    CommandParameter="{Binding .}" />
                                    <Button Text="Pair" Margin="5,0,0,0"
                                    Command="{Binding BindingContext.PairCommand, Source={x:Reference CheckPointsList}}" 
                                    CommandParameter="{Binding .}" />
                                </HorizontalStackLayout>
                            </StackLayout>
                        </Frame>
                    </DataTemplate>
                </CollectionView.ItemTemplate>
            </CollectionView>
        </RefreshView>
    </StackLayout>
</ContentPage>