<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="ZicMoove.Pages.EstimatePages.ViewEstimatePage"
             xmlns:views="clr-namespace:ZicMoove.Views;assembly=ZicMoove"
             xmlns:local="clr-namespace:ZicMoove;assembly=ZicMoove"
             Style="{StaticResource PageStyle}">
  <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>
    <ScrollView>
      <StackLayout Padding="10,10,10,10" x:Name="mainLayout">
        <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}" />
        <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>
    </ScrollView>
  </ContentPage.Content>
</ContentPage>