Policlinica2/Policlinica/Views/AdminView.axaml

163 lines
9.1 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<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"
xmlns:viewModels="clr-namespace:Policlinica.ViewModels"
mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="900"
x:Class="Policlinica.Views.AdminView"
x:DataType="viewModels:AdminViewModel">
<UserControl.Styles>
<Style Selector="TextBox">
<Setter Property="Background" Value="White"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="CaretBrush" Value="Red"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
</UserControl.Styles>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Margin="30" Spacing="20">
<!-- Заголовок с поиском и кнопкой выхода -->
<Grid ColumnDefinitions="*,Auto,Auto,Auto" Margin="0,0,0,10" VerticalAlignment="Center">
<TextBlock Grid.Column="0" Text="Управление записями" FontSize="24" FontWeight="Bold" Foreground="Black" VerticalAlignment="Center"/>
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="10">
<TextBox Text="{Binding SearchText}"
Watermark="Поиск по имени/фамилии"
Width="200"
Padding="10"
FontSize="13"/>
<Button Content="Искать"
FontSize="14"
Padding="15,8"
Background="Blue"
Foreground="White"
Command="{Binding SearchRecordsCommand}"/>
<Button Content="Показать все"
FontSize="14"
Padding="15,8"
Background="Green"
Foreground="White"
Command="{Binding ShowAllRecordsCommand}"/>
</StackPanel>
<Button Grid.Column="3" Content="Выход"
FontSize="14"
Padding="15,8"
Background="Red"
Foreground="White"
Command="{Binding ExitApplicationCommand}"/>
</Grid>
<!-- Таблица записей с ползунком -->
<Border BorderBrush="LightGray" BorderThickness="1" Padding="0" CornerRadius="5" ClipToBounds="True">
<StackPanel Spacing="0">
<TextBlock Text="Список записей (кликните для редактирования):"
FontWeight="Bold" FontSize="16" Foreground="Black" Padding="15,15,15,10"/>
<ScrollViewer MaxHeight="300" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<DataGrid ItemsSource="{Binding RecordsList }"
SelectedItem="{Binding SelectedRecord }"
Width="1100"
CanUserResizeColumns="True"
CanUserSortColumns="True">
<DataGrid.Columns>
<DataGridCheckBoxColumn IsVisible="True"/>
<DataGridTextColumn Binding="{Binding ClientName}" Header="Имя клиента" Width="150"/>
<DataGridTextColumn Binding="{Binding ClientSurname}" Header="Фамилия клиента" Width="150"/>
<DataGridTextColumn Binding="{Binding Title}" Header="Врач" Width="150"/>
<DataGridTextColumn Binding="{Binding TotalAmount}" Header="Цена" Width="100"/>
<DataGridTextColumn Binding="{Binding ServiceName}" Header="Услуга" Width="200"/>
<DataGridTextColumn Binding="{Binding RecordDate}" Header="Дата" Width="200"/>
</DataGrid.Columns>
</DataGrid>
</ScrollViewer>
</StackPanel>
</Border>
<!-- Форма редактирования -->
<Border BorderBrush="DodgerBlue" BorderThickness="2" Padding="20" CornerRadius="5" Background="White">
<StackPanel Spacing="20">
<TextBlock Text="Редактирование записи:" FontWeight="Bold" FontSize="16" Foreground="Black"/>
<!-- Имя клиента -->
<StackPanel Spacing="8">
<TextBlock Text="Имя клиента:" FontWeight="Bold" Foreground="Black" FontSize="14"/>
<TextBox Text="{Binding EditClientName}" Padding="12" FontSize="14"/>
</StackPanel>
<!-- Фамилия клиента -->
<StackPanel Spacing="8">
<TextBlock Text="Фамилия клиента:" FontWeight="Bold" Foreground="Black" FontSize="14"/>
<TextBox Text="{Binding EditClientSurname}" Padding="12" FontSize="14"/>
</StackPanel>
<!-- Врач -->
<StackPanel Spacing="8">
<TextBlock Text="Врач:" FontWeight="Bold" Foreground="Black" FontSize="14"/>
<ComboBox ItemsSource="{Binding DoctorList}"
SelectedItem="{Binding EditSelectedDoctor}"
DisplayMemberBinding="{Binding Title}"
Padding="12" FontSize="14" Background="White" Foreground="Black"/>
</StackPanel>
<!-- Услуга (зависит от выбранного врача) -->
<StackPanel Spacing="8">
<TextBlock Text="Услуга:" FontWeight="Bold" Foreground="Black" FontSize="14"/>
<ComboBox ItemsSource="{Binding EditServiceList}"
SelectedItem="{Binding EditSelectedService}"
DisplayMemberBinding="{Binding ServiceName}"
Padding="12" FontSize="14" Background="White" Foreground="Black"/>
</StackPanel>
<!-- Сумма (только для отображения) -->
<StackPanel Spacing="8">
<TextBlock Text="Сумма:" FontWeight="Bold" Foreground="Black" FontSize="14"/>
<Border Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="1" Padding="12" CornerRadius="3">
<TextBlock Text="{Binding EditTotalAmount}" FontSize="14" Foreground="Black"/>
</Border>
</StackPanel>
<!-- Дата -->
<StackPanel Spacing="8">
<TextBlock Text="Дата (YYYY-MM-DD):" FontWeight="Bold" Foreground="Black" FontSize="14"/>
<TextBox Text="{Binding EditRecordDate}" Padding="12" FontSize="14"/>
</StackPanel>
</StackPanel>
</Border>
<!-- Сообщение статуса -->
<TextBlock Text="{Binding StatusMessage}" Foreground="Green" FontSize="14" TextWrapping="Wrap"/>
<!-- Кнопки -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="20">
<Button Content="Обновить запись"
FontSize="16"
Padding="18,12"
Background="Blue"
Foreground="White"
Command="{Binding UpdateRecordCommand}"/>
<Button Content="Удалить запись"
FontSize="16"
Padding="18,12"
Background="Red"
Foreground="White"
Command="{Binding DeleteRecordCommand}"/>
<Button Content="Добавить запись"
FontSize="16"
Padding="18,12"
Background="Green"
Foreground="White"
Command="{Binding GoServiceCommand}"/>
<Button Content="Проверка сахара"
FontSize="16"
Padding="18,12"
Background="Orange"
Foreground="White"
Command="{Binding GoSugarCheckCommand}"/>
</StackPanel>
</StackPanel>
</ScrollViewer>
</UserControl>