<?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.Security.UsersPage"
             Title="Felhasználók">
    <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="UsersList">
                <CollectionView.ItemTemplate>
                    <DataTemplate>
                        <Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
                            <Grid ColumnDefinitions="*,Auto">
                                <StackLayout  Grid.Column="0" Spacing="2">
                                    <Label Text="{Binding FullName}" FontSize="16" FontAttributes="Bold" />
                                    <Label Text="{Binding NFCCode}" FontSize="14" />
                                </StackLayout>
                                <HorizontalStackLayout Grid.Column="1" HorizontalOptions="End" Spacing="5">
                                    <Button Text="Párosítás" Margin="5,0,0,0"
                                            HeightRequest="50"
                                            MaximumHeightRequest="50"
                                            WidthRequest="120" 
                                            MaximumWidthRequest="120"
                                            Command="{Binding BindingContext.PairCommand, Source={x:Reference UsersList}}" 
                                            CommandParameter="{Binding .}" />
                                </HorizontalStackLayout>
                            </Grid>
                        </Frame>
                    </DataTemplate>
                </CollectionView.ItemTemplate>
            </CollectionView>
        </RefreshView>
    </StackLayout>
</ContentPage>