<?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="GMCabsDriverAssistantSolution.Views.PassgerCollectedPage"
             xmlns:d="http://schemas.microsoft.com/dotnet/2021/maui/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:viewmodels="clr-namespace:GMCabsDriverAssistantSolution.ViewModels" 
             xmlns:models="clr-namespace:GMCabsDriverAssistant.Models" 
             xmlns:cmp="clr-namespace:Microsoft.Maui.Controls.Compatibility;assembly=Microsoft.Maui.Controls"
             xmlns:UserControl="clr-namespace:GMCabsDriverAssistant.UserControl" x:DataType="viewmodels:StartRideViewModel"
             NavigationPage.HasBackButton="False"
             Title="{Binding Title}">
    <Shell.BackButtonBehavior>
        <BackButtonBehavior IsEnabled="false" IconOverride="ic_menu_blank.png" TextOverride="" />
    </Shell.BackButtonBehavior>
    <ContentPage.Content>
        <StackLayout Orientation="Horizontal" 
                     BackgroundColor="#DCDCDC">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <StackLayout Grid.Row="0" 
                    Grid.Column="0" 
                    BackgroundColor="#DCDCDC">
                    <StackLayout>
                        <cmp:RelativeLayout VerticalOptions="CenterAndExpand" Margin="30,30,10,10">
                            <Frame BackgroundColor="#8B0000" WidthRequest="360" Margin="20,0,0,0" CornerRadius="10" IsVisible="{Binding IsCorporate}">
                                <StackLayout HorizontalOptions="EndAndExpand">
                                    <Label FontSize="20" VerticalTextAlignment="End" TextColor="White" Text="VIP" />
                                </StackLayout>
                            </Frame>
                            <Frame BackgroundColor="#E9E4D4" WidthRequest="{Binding FrameWidth}" IsVisible="True" CornerRadius="10">
                                <StackLayout Orientation="Horizontal">
                                    <Image Source="passenger.png"
                                           HeightRequest="30"/>
                                    <Label FontSize="20" Text="{Binding PassengerName}" TextColor="Black" FontAttributes="Bold" />
                                </StackLayout>
                            </Frame>
                        </cmp:RelativeLayout>

                        <Grid Margin="30,0,0,0" IsVisible="{Binding StopOver}">
                            <CollectionView ItemsSource="{Binding StopoverLocationsList}">
                                <CollectionView.ItemsLayout>
                                    <LinearItemsLayout
                            Orientation="Vertical"
                            ItemSpacing="0"/>
                                </CollectionView.ItemsLayout>
                                <CollectionView.ItemTemplate>
                                    <DataTemplate>
                                        <cmp:RelativeLayout>
                                            <StackLayout x:DataType="models:StopoverLocations" Grid.Row="0" Grid.Column="0" Orientation="Vertical" HorizontalOptions="StartAndExpand">
                                                <Ellipse Fill="{StaticResource Primary}" Opacity="{Binding CircleColorOpecity}"
                                                            WidthRequest="30"
                                                            HeightRequest="30"
                                                            HorizontalOptions="StartAndExpand" />
                                            </StackLayout>
                                            <StackLayout x:DataType="models:StopoverLocations" Orientation="Horizontal" VerticalOptions="Start" Margin="50,0,70,0">
                                                <Label FontSize="22"
                                       Text="{Binding FullStopOverAddress}" 
                                       TextColor="{Binding LabelColor}"/>
                                            </StackLayout>
                                            <StackLayout x:DataType="models:StopoverLocations" VerticalOptions="CenterAndExpand" Margin="-25,30,0,0">
                                                <Line X1="40"
                                                      Y1="0"
                                                      X2="40"
                                                      Y2="48"
                                                      Stroke="white"
                                                      StrokeDashArray="1,1"
                                                      StrokeThickness="7"
                                                      StrokeDashOffset="6"
                                                      IsVisible="{Binding IsLineVisible}"/>
                                            </StackLayout>
                                        </cmp:RelativeLayout>
                                    </DataTemplate>
                                </CollectionView.ItemTemplate>
                            </CollectionView>
                            <Grid VerticalOptions="CenterAndExpand" IsVisible="False">
                                <StackLayout Grid.Row="0" Grid.Column="0" Orientation="Vertical" HorizontalOptions="StartAndExpand" Margin="0,10,0,0">
                                    <Ellipse Fill="{StaticResource Primary}" Opacity="{Binding DestinationCircleColorOpecity}"
                                                            WidthRequest="30"
                                                            HeightRequest="30"
                                                            HorizontalOptions="StartAndExpand" />
                                </StackLayout>
                                <StackLayout Orientation="Horizontal" VerticalOptions="StartAndExpand" Margin="50,10,70,0">
                                    <Label FontSize="20" 
                                       Text="{Binding FullDestinationAddress}" 
                                       TextColor="{Binding DestinationStopLabelColorCode}"/>
                                </StackLayout>
                            </Grid>
                        </Grid>

                        <Grid Margin="30,0,0,0" IsVisible="{Binding NoStopOver}">
                            <StackLayout Grid.Row="0" Grid.Column="0" Orientation="Vertical" HorizontalOptions="StartAndExpand">
                                <Ellipse Fill="{StaticResource Primary}" Opacity="0.5"
                                                            WidthRequest="30"
                                                            HeightRequest="30"
                                                            HorizontalOptions="StartAndExpand" />
                            </StackLayout>
                            <StackLayout Orientation="Horizontal" VerticalOptions="CenterAndExpand" Margin="50,0,70,0">
                                <Label FontSize="20" 
                                       Text="{Binding FullDestinationAddress}" 
                                       TextColor="Black"/>
                            </StackLayout>
                        </Grid>

                    </StackLayout>
                    <StackLayout VerticalOptions="EndAndExpand" Orientation="Vertical" Margin="50,0,60,30" IsVisible="{Binding IsStopOver}">
                        <Button
                                Text="Passenger Collected"
                                FontSize="20"
                                TextTransform="Uppercase"
                                Command="{Binding OnPassengerCollectedClick}"
                                />
                    </StackLayout>
                    <StackLayout VerticalOptions="EndAndExpand" Orientation="Vertical" Margin="50,0,60,30" IsVisible="{Binding IsNoStopOver}">
                        <Button
                                Text="Passenger Dropped Off"
                                FontSize="20"
                                TextTransform="Uppercase"
                                Command="{Binding OnPassengerDroppedOffClick}"
                                />
                    </StackLayout>
                </StackLayout>
                <UserControl:TripInformationPage Grid.Row="0" 
                             Grid.Column="1" />
            </Grid>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>