<?xml version="1.0" encoding="utf-8" ?>
<xct:Popup xmlns="http://xamarin.com/schemas/2014/forms"
           xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
           xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
           xmlns:local="clr-namespace:TINK.View"
           x:TypeArguments="local:FeedbackPopup+Result"
             x:Class="TINK.View.FeedbackPopup">
    <xct:Popup.Resources>
        <x:String x:Key="check_circle">&#xf058;</x:String>
    </xct:Popup.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <!-- Head and title row -->
            <RowDefinition Height="auto"/>
            <!--- checkbox and input elements-->
            <RowDefinition Height="*"/>
            <!--- ok button-->
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>
        <Grid 
            Padding="30"
            BackgroundColor="{DynamicResource primary-back-title-color}">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>
            <Label
                    HorizontalTextAlignment="Center"
                    FontSize="Large"
                    Text="Fahrrad erfolgreich zurückgegeben!"/>
            <Image Grid.Row="1">
                <Image.Source>
                    <FontImageSource Size="Header" Glyph="{StaticResource check_circle}" FontFamily="FA-S"/>
                </Image.Source>
            </Image>
        </Grid>
        <ScrollView Grid.Row="1">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <StackLayout
                    Orientation="Vertical">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <CheckBox x:Name="brockenCheckBox" IsChecked="True"/>
                        <Label 
                            Grid.Column="1" 
                            FontSize="Medium"
                            Text="Rad ist in Ordnung"/>
                    </Grid>
                    <Editor 
                        Grid.Row="1"
                        x:Name="feedbackMessage"
                        AutoSize="TextChanges"  
                        Placeholder="Bei Bedarf bitte hier Rückmeldung eingeben."
                        Text="">
                        <Editor.Triggers>
                            <DataTrigger TargetType="Editor"
                                        Binding="{Binding Source={x:Reference brockenCheckBox}, Path=IsChecked}"
                                        Value="true">
                                <Setter Property="Placeholder"
                                            Value="Bei Bedarf bitte hier Rückmeldung eingeben." />
                            </DataTrigger>
                            <DataTrigger TargetType="Editor"
                                        Binding="{Binding Source={x:Reference brockenCheckBox}, Path=IsChecked}"
                                        Value="false">
                                <Setter Property="Placeholder"
                                            Value="Bitte Zustand/ Defekt hier beschreiben." />
                            </DataTrigger>
                        </Editor.Triggers>
                    </Editor>
                </StackLayout>
            </Grid>
        </ScrollView>
        <Button 
                Grid.Row="2"
                Clicked="OnOkClicked"
                Text="OK"/>
    </Grid>
</xct:Popup>