<?xml version="1.0" encoding="UTF-8" ?>
<ContentView
    x:Class="CafeTerrace.Views.Controller.BuyBagSlideMenu"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:controller="clr-namespace:CafeTerrace.Views.Controller;assembly=CafeTerrace"
    xmlns:d="http://xamarin.com/schemas/2014/forms/design"
    xmlns:forms="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:model="clr-namespace:CafeTerrace.Models;assembly=CafeTerrace">
    <Grid Margin="0,0,0,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <ScrollView Grid.Row="1" HeightRequest="400">
            <StackLayout
                Padding="20,0"
                BindableLayout.ItemsSource="{Binding Foods}"
                HorizontalOptions="Center">
                <BindableLayout.ItemTemplate>
                    <DataTemplate>
                        <controller:BuyBagFoodItem
                            BindingContext="{Binding .}"
                            FoodAmountChanged="BuyBagFoodItem_OnFoodAmountChanged"
                            FoodRemoved="BuyBagFoodItem_OnFoodRemoved" />
                    </DataTemplate>
                </BindableLayout.ItemTemplate>
            </StackLayout>
        </ScrollView>
        <StackLayout Grid.Row="2" Margin="15,0">
            <Grid Margin="15,0" VerticalOptions="Center">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Label
                    FontSize="18"
                    Text="مجموع پرداخت"
                    VerticalOptions="Center" />

                <StackLayout Grid.Column="1" Orientation="Horizontal">
                    <Label
                        FontFamily="{StaticResource ShabnameBold}"
                        FontSize="24"
                        Text="{Binding TotalAmount, StringFormat='{0:N0}'}"
                        TextColor="{StaticResource Orange}" />
                    <Label
                        FontFamily="{StaticResource Shabname}"
                        FontSize="15"
                        Text="ریال"
                        TextColor="{StaticResource Orange}"
                        VerticalOptions="Center" />
                </StackLayout>
            </Grid>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Button
                    Margin="5"
                    BackgroundColor="{StaticResource Green}"
                    Clicked="PayementButton_OnClicked"
                    CornerRadius="8"
                    Text="تایید و سفارش"
                    TextColor="White" />
            </Grid>
        </StackLayout>
    </Grid>
</ContentView>