TeachersView.axaml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <UserControl xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:vm="using:Teachers.ViewModels"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
  7. x:DataType="vm:TeachersViewModel"
  8. x:Class="Teachers.TeachersView" FontSize="17">
  9. <Grid>
  10. <ScrollViewer>
  11. <StackPanel>
  12. <Button Classes="bDo" Command="{Binding ToAdd}">Добавить учителя</Button>
  13. <!--Поиск-->
  14. <TextBox Height="40" Classes="tbAddTeacher" Text="{Binding SearchStr}"></TextBox>
  15. <Grid Classes="gFilters" ColumnDefinitions="0.5*, 0.5*, 0.5*, 0.5*">
  16. <Border Grid.Column="0" Classes="bordFilters">
  17. <StackPanel>
  18. <!--Фильтрация-->
  19. <RadioButton IsChecked="{Binding RemoveSort}">Все</RadioButton>
  20. <RadioButton IsChecked="{Binding IsCheckedGender1}">Мужчины</RadioButton>
  21. <RadioButton IsChecked="{Binding IsCheckedGender2}">Женщины</RadioButton>
  22. </StackPanel>
  23. </Border>
  24. <Border Grid.Column="1" Classes="bordFilters">
  25. <StackPanel>
  26. <CheckBox IsChecked="{Binding IsCheckedPhone}">Есть номер телефона</CheckBox>
  27. <ComboBox Classes="cbFilters" ItemsSource="{Binding SubjectList}" SelectedItem="{Binding SelectedSubject}">
  28. <ComboBox.ItemTemplate>
  29. <DataTemplate>
  30. <TextBlock Text="{Binding Name}"></TextBlock>
  31. </DataTemplate>
  32. </ComboBox.ItemTemplate>
  33. </ComboBox>
  34. </StackPanel>
  35. </Border>
  36. <Border Grid.Column="2" Classes="bordFilters">
  37. <StackPanel>
  38. <!--Сортировка-->
  39. <ComboBox Classes="cbFilters" SelectedIndex="{Binding SelectedSort}">
  40. <ComboBoxItem>Без сортировки</ComboBoxItem>
  41. <ComboBoxItem>Стаж</ComboBoxItem>
  42. <ComboBoxItem>Фамилия</ComboBoxItem>
  43. </ComboBox>
  44. <StackPanel IsEnabled="{Binding IsEnabledSort}">
  45. <RadioButton Content="По возрастанию" IsChecked="{Binding SortUp}"/>
  46. <RadioButton Content="По убыванию" IsChecked="{Binding SortDown}"/>
  47. </StackPanel>
  48. </StackPanel>
  49. </Border>
  50. <Border Classes="bordFilters" Grid.Column="3">
  51. <StackPanel>
  52. <TextBlock Margin="0 7 0 7" TextWrapping="Wrap">Сортировать по общему количеству часов курсов</TextBlock>
  53. <StackPanel IsEnabled="{Binding}">
  54. <RadioButton IsChecked="{Binding RemoveSortHours}">Без сортировки</RadioButton>
  55. <RadioButton Content="По возрастанию" IsChecked="{Binding SortUpHours}"/>
  56. <RadioButton Content="По убыванию" IsChecked="{Binding SortDownHours}"/>
  57. </StackPanel>
  58. </StackPanel>
  59. </Border>
  60. </Grid>
  61. <ListBox ItemsSource="{Binding TeachersList}">
  62. <ListBox.ItemTemplate>
  63. <DataTemplate>
  64. <Border Classes="bordMain">
  65. <Grid ColumnDefinitions="1*, 0.7*, 0.5*">
  66. <StackPanel Grid.Column="0">
  67. <TextBlock Classes="tbHeader">Личная информация:</TextBlock>
  68. <TextBlock Classes="tbFIO" Text="{Binding FIO}"></TextBlock>
  69. <StackPanel Orientation="Horizontal" Classes="spLittleSp">
  70. <TextBlock Classes="tbLittleHeader">Пол: </TextBlock>
  71. <TextBlock Text="{Binding GenderNavigation.Gender1, StringFormat=' {0}'}"></TextBlock>
  72. </StackPanel>
  73. <StackPanel Orientation="Horizontal" Classes="spLittleSp">
  74. <TextBlock Classes="tbLittleHeader">Дата рождения: </TextBlock>
  75. <TextBlock Text="{Binding Birthday, StringFormat=' dd.MM.yyyy года'}"></TextBlock>
  76. </StackPanel>
  77. <StackPanel Orientation="Horizontal" Classes="spLittleSp">
  78. <TextBlock Classes="tbLittleHeader">Стаж работы: </TextBlock>
  79. <TextBlock Text="{Binding Exp, StringFormat=' {0}'}"></TextBlock>
  80. </StackPanel>
  81. <TextBlock Classes="tbHeader">Контактная информация:</TextBlock>
  82. <Grid ColumnDefinitions="*, *" RowDefinitions="*">
  83. <StackPanel Orientation="Horizontal" Grid.Column="0" Classes="spLittleSp">
  84. <TextBlock Classes="tbLittleHeader">Почта: </TextBlock>
  85. <TextBlock Text="{Binding Email, StringFormat=' {0}'}"></TextBlock>
  86. </StackPanel>
  87. <StackPanel Orientation="Horizontal" Grid.Column="1" Classes="spLittleSp">
  88. <TextBlock Classes="tbLittleHeader">Телефон: </TextBlock>
  89. <TextBlock Text="{Binding Phone, StringFormat=' {0}'}"></TextBlock>
  90. </StackPanel>
  91. </Grid>
  92. <TextBlock Classes="tbHeader" Text="{Binding CoursesHours}"></TextBlock>
  93. <ItemsRepeater ItemsSource="{Binding TeacherCourses}">
  94. <ItemsRepeater.ItemTemplate>
  95. <DataTemplate>
  96. <TextBlock TextWrapping="Wrap" Text="{Binding IdCourseNavigation.Name, StringFormat='- {0}'}"></TextBlock>
  97. </DataTemplate>
  98. </ItemsRepeater.ItemTemplate>
  99. </ItemsRepeater>
  100. </StackPanel>
  101. <StackPanel Grid.Column="1">
  102. <TextBlock Classes="tbHeader">Преподаваемые предметы:</TextBlock>
  103. <ItemsRepeater ItemsSource="{Binding SubjectsTaughts}">
  104. <ItemsRepeater.ItemTemplate>
  105. <DataTemplate>
  106. <TextBlock TextWrapping="Wrap" Text="{Binding IdSubjectNavigation.Name, StringFormat='- {0}'}"></TextBlock>
  107. </DataTemplate>
  108. </ItemsRepeater.ItemTemplate>
  109. </ItemsRepeater>
  110. </StackPanel>
  111. <StackPanel Classes="spButtons" Grid.Column="2">
  112. <Button Classes="bDo" Command="{Binding $parent[UserControl].((vm:TeachersViewModel)DataContext).ToUpdate}" CommandParameter="{Binding Id}">Редактировать</Button>
  113. <Button Classes="bDo" Command="{Binding $parent[UserControl].((vm:TeachersViewModel)DataContext).DeleteTeacher}" CommandParameter="{Binding Id}">Удалить</Button>
  114. </StackPanel>
  115. </Grid>
  116. </Border>
  117. </DataTemplate>
  118. </ListBox.ItemTemplate>
  119. </ListBox>
  120. </StackPanel>
  121. </ScrollViewer>
  122. </Grid>
  123. </UserControl>