demo_trade/Views/OrderManagerControl.axaml
2024-10-04 15:41:04 +03:00

48 lines
2.8 KiB
XML

<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
xmlns:vm="using:demo_trade.ViewModels"
x:DataType="vm:OrderManagerViewModel"
xmlns:conv="using:demo_trade.UI.Converters"
x:Class="demo_trade.OrderManagerControl">
<UserControl.Resources>
<conv:ItemDateConverter x:Key="itemDateConverter"/>
<conv:ItemColorOrderConverter x:Key="itemColorOrderConverter"/>
<conv:ItemComboboxConverter x:Key="itemComboboxConverter"/>
<conv:ItemEnableConverterByDate x:Key="itemEnableConverterByDate"/>
</UserControl.Resources>
<DockPanel>
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" >
<ComboBox MinWidth="100" SelectedIndex="{Binding SelectedSortNumber}">
<ComboBoxItem>отсут.</ComboBoxItem>
<ComboBoxItem>по убыв.</ComboBoxItem>
<ComboBoxItem>по возраст.</ComboBoxItem>
</ComboBox>
</StackPanel>
<StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Center">
<Button Content="Применить" Command="{Binding ConfirmChangeCommand}"/>
</StackPanel>
<ListBox ItemsSource="{Binding Orders}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel Orientation="Vertical" Background="{Binding ProductStock, Converter={StaticResource itemColorOrderConverter}}">
<TextBlock Text="{Binding Orderid, StringFormat='Номер заказа: {0}'}"/>
<ComboBox SelectedIndex="{Binding Orderstatus, Converter={StaticResource itemComboboxConverter}}" IsEnabled="{Binding Orderdeliverydate, Converter={StaticResource itemEnableConverterByDate}}" Tag="{Binding Orderid}" SelectionChanged="StatusComboBox_SelectionChanged">
<ComboBoxItem>Новый</ComboBoxItem>
<ComboBoxItem>Завершен</ComboBoxItem>
</ComboBox>
<DatePicker SelectedDate="{Binding Orderdeliverydate, Converter={StaticResource itemDateConverter}}" Tag="{Binding Orderid}" SelectedDateChanged="DeliveryDatePicker_SelectedDateChanged"/>
<TextBlock Text="{Binding PickupPointName, StringFormat='Пункт выдачи:{0}'}"/>
<TextBlock Text="{Binding OrderSumCost, StringFormat='Сумма заказа: {0}'}" IsVisible="{Binding OrderSumCost, Converter={x:Static ObjectConverters.IsNotNull}}"/>
<TextBlock Text="{Binding OrderClient, StringFormat='Клиент: {0}'}" IsVisible="{Binding OrderClient, Converter={x:Static ObjectConverters.IsNotNull}}"/>
<TextBlock Text="{Binding ProductList}"/>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DockPanel>
</UserControl>