HomePageView.axaml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <UserControl xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:viewModels="clr-namespace:PRS.Avalonia.Modules"
  6. xmlns:moduleGrid="clr-namespace:InABox.Avalonia.Components.ModuleGrid;assembly=InABox.Avalonia"
  7. xmlns:converters="clr-namespace:InABox.Avalonia.Converters;assembly=InABox.Avalonia"
  8. mc:Ignorable="d" d:DesignWidth="450" d:DesignHeight="1000"
  9. x:Class="PRS.Avalonia.Modules.HomePageView"
  10. x:DataType="viewModels:HomePageViewModel">
  11. <UserControl.Resources>
  12. <converters:BooleanToColorConverter x:Key="BooleanToColorConverter" True="{StaticResource PrsButtonBackground}" False="{StaticResource PrsAlertBackground}" />
  13. <converters:BooleanToStringConverter x:Key="BooleanToStringConverter" True="CLOCK OFF" False="CLOCK ON" />
  14. <converters:BooleanMatcher x:Key="BooleanMatcher" Comparison="EqualTo" Type="All" />
  15. </UserControl.Resources>
  16. <Grid
  17. RowDefinitions="200 Auto Auto *"
  18. ColumnDefinitions="* 100">
  19. <Button Classes="Standard"
  20. Grid.Row="0"
  21. Grid.Column="0"
  22. Grid.ColumnSpan="2"
  23. Padding="0"
  24. IsVisible="{Binding ClockOnVisible}"
  25. Background="{Binding IsClockedOn, Converter={StaticResource BooleanToColorConverter}}"
  26. Command="{Binding ClockOnCommand}"
  27. HorizontalContentAlignment="Stretch"
  28. VerticalContentAlignment="Stretch">
  29. <Button.IsEnabled>
  30. <MultiBinding Converter="{x:Static BoolConverters.And}">
  31. <Binding Path="DataReady" />
  32. <Binding Path="ClockOnLocation" Converter="{x:Static ObjectConverters.IsNotNull}" />
  33. </MultiBinding>
  34. </Button.IsEnabled>
  35. <Grid
  36. ColumnDefinitions="* Auto"
  37. RowDefinitions="* Auto"
  38. HorizontalAlignment="Stretch"
  39. VerticalAlignment="Stretch">
  40. <StackPanel
  41. Orientation="Vertical"
  42. HorizontalAlignment="Center"
  43. VerticalAlignment="Center"
  44. Grid.Row="0"
  45. Grid.Column="0"
  46. Grid.RowSpan="2"
  47. Grid.ColumnSpan="2">
  48. <Label
  49. FontSize="{StaticResource PrsFontSizeExtraLarge}"
  50. FontWeight="Bold"
  51. Content="{Binding IsClockedOn, Converter={StaticResource BooleanToStringConverter}}"
  52. HorizontalAlignment="Center"/>
  53. <Label
  54. FontSize="{StaticResource PrsFontSizeNormal}"
  55. FontWeight="DemiBold"
  56. Content="{Binding ClockOnLocation}"
  57. HorizontalAlignment="Center">
  58. <Label.IsVisible>
  59. <MultiBinding Converter = "{x:Static BoolConverters.And}">
  60. <Binding Path="IsClockedOn" Converter="{x:Static BoolConverters.Not}" />
  61. <Binding Path="ClockOnLocation" Converter="{x:Static StringConverters.IsNotNullOrEmpty}" />
  62. </MultiBinding>
  63. </Label.IsVisible>
  64. </Label>
  65. <Label
  66. FontSize="{StaticResource PrsFontSizeNormal}"
  67. FontWeight="DemiBold"
  68. Content="No Job Site Found"
  69. HorizontalAlignment="Center">
  70. <Label.IsVisible>
  71. <MultiBinding Converter="{x:Static BoolConverters.And}">
  72. <Binding Path="IsClockedOn" Converter="{x:Static BoolConverters.Not}" />
  73. <Binding Path="ClockOnLocation" Converter="{x:Static ObjectConverters.IsNull}" />
  74. <Binding Path="CurrentLocation" Converter="{x:Static ObjectConverters.IsNotNull}" />
  75. </MultiBinding>
  76. </Label.IsVisible>
  77. </Label>
  78. <Label
  79. FontSize="{StaticResource PrsFontSizeNormal}"
  80. FontWeight="DemiBold"
  81. Content="Missing/Invalid GPS Signal"
  82. IsVisible="{Binding CurrentLocation, Converter={x:Static ObjectConverters.IsNull}}"
  83. HorizontalAlignment="Center"/>
  84. </StackPanel>
  85. <ProgressBar
  86. Grid.Row="0"
  87. Grid.Column="1"
  88. Foreground="Black"
  89. Background="Transparent"
  90. Opacity="0.2"
  91. Maximum="{Binding GpsFrequency}"
  92. Value="{Binding GpsRemaining}"
  93. Orientation="Vertical"/>
  94. </Grid>
  95. </Button>
  96. <Border Classes="Standard"
  97. Grid.Row="0"
  98. Grid.Column="0"
  99. Grid.ColumnSpan="2"
  100. Padding="10"
  101. IsVisible="{Binding SplashVisible}">
  102. <Image Source="{SvgImage ../Images/badge.svg}" />
  103. </Border>
  104. <Button Classes="Standard"
  105. Grid.Row="1"
  106. Grid.Column="0"
  107. Content="{Binding Repositories.CurrentAssignment.JobDisplay, FallbackValue='Select Job'}"
  108. IsVisible="{Binding ClockOnVisible}"
  109. Background="{Binding IsClockedOn, Converter={StaticResource BooleanToColorConverter}}"
  110. Command="{Binding SelectJobCommand}">
  111. <Button.IsEnabled>
  112. <MultiBinding Converter="{x:Static BoolConverters.And}">
  113. <Binding Path="DataReady" />
  114. <Binding Path="IsClockedOn" />
  115. <Binding Path="CurrentLocation" Converter="{x:Static ObjectConverters.IsNotNull}" />
  116. </MultiBinding>
  117. </Button.IsEnabled>
  118. </Button>
  119. <Button Classes="Standard"
  120. Grid.Row="2"
  121. Grid.Column="0"
  122. Content="{Binding Repositories.CurrentAssignment.TaskDisplay, FallbackValue='Select Task'}"
  123. IsVisible="{Binding ClockOnVisible}"
  124. Background="{Binding IsClockedOn, Converter={StaticResource BooleanToColorConverter}}"
  125. Command="{Binding SelectTaskCommand}">
  126. <Button.IsEnabled>
  127. <MultiBinding Converter="{x:Static BoolConverters.And}">
  128. <Binding Path="DataReady" />
  129. <Binding Path="IsClockedOn" />
  130. </MultiBinding>
  131. </Button.IsEnabled>
  132. </Button>
  133. <Button Classes="Standard"
  134. Grid.Row="1"
  135. Grid.Column="1"
  136. Grid.RowSpan="2"
  137. Content="Add Note"
  138. IsVisible="{Binding ClockOnVisible}"
  139. Background="{Binding IsClockedOn, Converter={StaticResource BooleanToColorConverter}}"
  140. Command="{Binding TimeSheetNotesCommand}">
  141. <Button.IsEnabled>
  142. <MultiBinding Converter="{x:Static BoolConverters.And}">
  143. <Binding Path="DataReady" />
  144. <Binding Path="IsClockedOn" />
  145. </MultiBinding>
  146. </Button.IsEnabled>
  147. </Button>
  148. <ScrollViewer Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2"
  149. Margin="0">
  150. <moduleGrid:AvaloniaModuleGrid
  151. Margin="{StaticResource PrsControlSpacing}"
  152. Padding="0"
  153. BorderThickness="0"
  154. Modules="{Binding Modules}"/>
  155. </ScrollViewer>
  156. </Grid>
  157. </UserControl>