<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:signature="clr-namespace:SignaturePad.Forms;assembly=SignaturePad.Forms"
             xmlns:views="clr-namespace:ZicMoove.Views;assembly=ZicMoove"
             x:Class="ZicMoove.Pages.EstimatePages.EstimateSigningPage">

  <ContentPage.Resources>
    <ResourceDictionary>
      <Style TargetType="Label">
        <Setter Property="Style" Value="{StaticResource ContentLabelStyle}" />
      </Style>
      <Style TargetType="Button">
        <Setter Property="Style" Value="{StaticResource ButtonStyle}" />
      </Style>
    </ResourceDictionary>
  </ContentPage.Resources>
  <ContentPage.Content>
      <StackLayout Padding="10,10,10,10" x:Name="mainLayout">
    <ScrollView>
    <StackLayout>
        <Grid MinimumHeightRequest="12">
          <Grid.RowDefinitions>
            <RowDefinition Height="*" />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="2*" />
            <ColumnDefinition Width="*" />
          </Grid.ColumnDefinitions>
          <Label Grid.Row="0" Grid.Column="0" Text="{Binding Client.UserName}" ></Label>
          <Label Grid.Row="0" Grid.Column="1" Text="{Binding Query.Location.Address}"  ></Label>
          <Label Grid.Row="0" Grid.Column="2" Text="{Binding Query.EventDate, StringFormat='{0:dddd d MMMM yyyy à hh:mm}'}" ></Label>
        </Grid>

        <Label Text="{Binding Title}"  Style="{StaticResource BigLabelStyle}" />

        <views:MarkdownView x:Name="mdview" 
           HorizontalOptions="FillAndExpand"
    Markdown="{Binding Description}"
     />
        <ListView x:Name="billListView" ItemsSource="{Binding Bill}"
       MinimumHeightRequest="40" HasUnevenRows="true" VerticalOptions="FillAndExpand"
                        HeightRequest="40" >
          <ListView.ItemTemplate>
            <DataTemplate >
              <ViewCell>
                <ViewCell.View>
                  <Grid MinimumHeightRequest="12">
                    <Grid.RowDefinitions>
                      <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                      <ColumnDefinition Width="*" />
                      <ColumnDefinition Width="*" />
                      <ColumnDefinition Width="30" />
                      <ColumnDefinition Width="90" />
                    </Grid.ColumnDefinitions>
                    <Label Text="{Binding Description}"
                           Grid.Row="0" Grid.Column="0" ></Label>
                    <Label Text="{Binding Duration, StringFormat=\{0\}}"
                           Grid.Row="0" Grid.Column="1" ></Label>
                    <Label Text="{Binding Count}"
                           Grid.Row="0" Grid.Column="2" ></Label>
                    <Label Text="{Binding UnitaryCost}"
                           Grid.Row="0" Grid.Column="3"
                           FontFamily="Monospace"></Label>
                  </Grid>
                </ViewCell.View>
              </ViewCell>
            </DataTemplate>
          </ListView.ItemTemplate>
        </ListView>
        <Label FormattedText="{Binding FormattedTotal}"/>
      <StackLayout Orientation="Horizontal">
        <Image Source="{Binding ProSignImage}" HorizontalOptions="Start"></Image>
        <Image Source="{Binding CliSignImage}" HorizontalOptions="End"></Image>
      </StackLayout>
</StackLayout>  
    </ScrollView> 
         <signature:SignaturePadView x:Name="padView"
                                    VerticalOptions="FillAndExpand"
                                    HorizontalOptions="FillAndExpand"
                          BackgroundColor="White"
                          CaptionText="{Binding Data.Owner?.UserName}" CaptionTextColor="Black"
                          ClearText="Effacer!" ClearTextColor="Red"
                          PromptText="Prompt Here" PromptTextColor="Red"
                          SignatureLineColor="Aqua" StrokeColor="Black" StrokeWidth="2" />
        <Button Clicked="OnValidate" Text="Valider cette signature" x:Name="btnValidate" />
       
      </StackLayout>
  </ContentPage.Content>
</ContentPage>