StocktakeModule.xaml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <mobile:MobilePage xmlns:local="clr-namespace:PRS.Mobile" xmlns="http://xamarin.com/schemas/2014/forms"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
  4. xmlns:mobile="clr-namespace:InABox.Mobile;assembly=InABox.Mobile.Shared"
  5. xmlns:views="http://xamarin.com/schemas/2020/toolkit"
  6. x:Class="PRS.Mobile.StocktakeModule"
  7. Title="Stock Take">
  8. <mobile:MobilePage.BindingContext>
  9. <local:StockTakeViewModel x:Name="ViewModel"/>
  10. </mobile:MobilePage.BindingContext>
  11. <mobile:MobilePage.Resources>
  12. <mobile:BooleanToImageConverter x:Key="BooleanToImageConverter" Checked="hide" Unchecked="show"/>
  13. <mobile:BooleanToStringConverter x:Key="BooleanToStringConverter" TrueValue=", Active" FalseValue=", Inactive"/>
  14. <mobile:IntToBooleanConverter x:Key="ItemsVisibleConverter" Value="0" Result="True"/>
  15. <mobile:IntToBooleanConverter x:Key="PhotoVisibleConverter" Value="1" Result="True"/>
  16. <mobile:IntToBooleanConverter x:Key="SaveVisibleConverter" Value="2" Result="True" />
  17. <mobile:ByteArrayToImageSourceConverter x:Key="ImageConverter"/>
  18. <mobile:StringWithDefaultValueConverter x:Key="LocationConverter" Default="(Select)" />
  19. <local:StockHoldingShellColorConverter x:Key="StockHoldingShellColorConverter" x:Name="_stockHoldingShellColorConverter" />
  20. <local:StockHoldingShellAdjustmentConverter x:Key="StockHoldingShellAdjustmentConverter" x:Name="_stockHoldingShellAdjustmentConverter" />
  21. <local:StockHoldingShellBalanceConverter x:Key="StockHoldingShellBalanceConverter" />
  22. <local:StockLocationStatusConverter x:Key="StockLocationStatusConverter" />
  23. <DataTemplate x:Key="HoldingTemplate" x:DataType="local:StockHoldingShell">
  24. <ViewCell>
  25. <mobile:MobileCard
  26. BackgroundColor="{Binding ., Converter={StaticResource StockHoldingShellColorConverter}}"
  27. Padding="5"
  28. Margin="0,0,0,5"
  29. IsClickable="True"
  30. Clicked="Holding_Clicked">
  31. <Grid Grid.RowSpacing="5" Grid.ColumnSpacing="5">
  32. <Grid.ColumnDefinitions>
  33. <ColumnDefinition Width="80"/>
  34. <ColumnDefinition Width="*"/>
  35. <ColumnDefinition Width="80"/>
  36. </Grid.ColumnDefinitions>
  37. <Grid.RowDefinitions>
  38. <RowDefinition Height="*"/>
  39. <RowDefinition Height="Auto"/>
  40. <RowDefinition Height="Auto"/>
  41. <RowDefinition Height="Auto"/>
  42. </Grid.RowDefinitions>
  43. <Image
  44. Grid.Row="0"
  45. Grid.RowSpan="3"
  46. Grid.Column="0"
  47. Source = "{Binding Image, Converter={StaticResource ImageConverter}}"
  48. Aspect="AspectFit"
  49. HeightRequest="80"
  50. WidthRequest="80"
  51. HorizontalOptions="Center"
  52. VerticalOptions="Center"
  53. />
  54. <Label
  55. Grid.Row="3"
  56. Grid.Column="0"
  57. Text="{Binding ProductCode}"
  58. FontSize="Micro"
  59. TextColor="{StaticResource Theme.OnBackground}"
  60. LineBreakMode="NoWrap"
  61. HorizontalTextAlignment="Center"/>
  62. <Label
  63. Grid.Row="0"
  64. Grid.Column="1"
  65. Text="{Binding ProductName}"
  66. FontSize="Micro"
  67. TextColor="{StaticResource Theme.OnBackground}"
  68. HorizontalTextAlignment="Center"/>
  69. <Label
  70. Grid.Row="1"
  71. Grid.Column="1"
  72. Margin="5,0,0,0"
  73. Text="{Binding DimensionsUnitSize}"
  74. FontSize="Micro"
  75. TextColor="{StaticResource Theme.OnBackground}"
  76. HorizontalTextAlignment="Center"/>
  77. <Label
  78. Grid.Row="2"
  79. Grid.Column="1"
  80. Text="{Binding StyleDescription}"
  81. FontSize="Micro"
  82. LineBreakMode="TailTruncation"
  83. TextColor="{StaticResource Theme.OnBackground}"
  84. HorizontalTextAlignment="Center"/>
  85. <Label
  86. Grid.Row="3"
  87. Grid.Column="1"
  88. Text="{Binding JobDisplay}"
  89. FontSize="Micro"
  90. LineBreakMode="TailTruncation"
  91. HorizontalTextAlignment="Center"
  92. TextColor="{StaticResource Theme.OnBackground}"/>
  93. <StackLayout
  94. Orientation="Vertical"
  95. VerticalOptions="CenterAndExpand"
  96. Grid.Row="0"
  97. Grid.Column="2"
  98. Grid.RowSpan="4"
  99. Spacing="20">
  100. <Label Text="{Binding ., Converter={StaticResource StockHoldingShellBalanceConverter}}" HorizontalTextAlignment="Center" FontAttributes="Bold" />
  101. <Label Text="{Binding ., Converter={StaticResource StockHoldingShellAdjustmentConverter}}" HorizontalTextAlignment="Center" FontSize="{StaticResource Theme.Text.Small.Size}"/>
  102. </StackLayout>
  103. </Grid>
  104. </mobile:MobileCard>
  105. </ViewCell>
  106. </DataTemplate>
  107. <DataTemplate x:Key="PhotoTemplate" x:DataType="local:StockTransactionImage">
  108. <ViewCell>
  109. <mobile:MobileCard
  110. IsClickable="True"
  111. Clicked="Image_Clicked"
  112. Margin="0,0,0,5">
  113. <Image
  114. Margin="5"
  115. Source="{Binding Thumbnail, Converter={StaticResource ImageConverter}}"
  116. HeightRequest="200"
  117. Aspect="AspectFit"/>
  118. </mobile:MobileCard>
  119. </ViewCell>
  120. </DataTemplate>
  121. </mobile:MobilePage.Resources>
  122. <mobile:MobilePage.PrimaryMenu>
  123. <mobile:MobileMenuButton
  124. Image="plus" Clicked="AddHolding_Clicked"
  125. IsVisible="{Binding Source={x:Reference Name=_tabStrip}, Path=SelectedIndex, Converter={StaticResource ItemsVisibleConverter}}" />
  126. <mobile:MobileMenuButton
  127. x:Name="Photo"
  128. Image="camera"
  129. IsVisible="{Binding Source={x:Reference Name=_tabStrip}, Path=SelectedIndex, Converter={StaticResource PhotoVisibleConverter}}">
  130. <mobile:MobileMenuButton.Items>
  131. <mobile:MobileMenuItem Text="Take Photo" Clicked="TakePhoto_Clicked" />
  132. <mobile:MobileMenuItem Text="Browse Library" Clicked="PickPhoto_Clicked" />
  133. </mobile:MobileMenuButton.Items>
  134. </mobile:MobileMenuButton>
  135. <mobile:MobileMenuButton
  136. Image="save" Clicked="Save_Clicked"
  137. IsVisible="{Binding Source={x:Reference Name=_tabStrip}, Path=SelectedIndex, Converter={StaticResource SaveVisibleConverter}}" />
  138. </mobile:MobilePage.PrimaryMenu>
  139. <mobile:MobilePage.PageContent>
  140. <Grid Margin="5" RowSpacing="5">
  141. <Grid.RowDefinitions>
  142. <RowDefinition Height="*"/>
  143. <RowDefinition Height="Auto"/>
  144. </Grid.RowDefinitions>
  145. <Grid.ColumnDefinitions>
  146. <ColumnDefinition Width="*"/>
  147. </Grid.ColumnDefinitions>
  148. <mobile:MobilePageStack
  149. Grid.Row="0"
  150. SelectedIndex="{Binding Source={x:Reference Name=_tabStrip}, Path=SelectedIndex}">
  151. <mobile:MobilePageStack.Items>
  152. <mobile:MobilePageStackItem>
  153. <mobile:MobilePageStackItem.Content>
  154. <views:DockLayout>
  155. <mobile:MobileListView
  156. views:DockLayout.Dock="Top"
  157. x:Name="_holdings"
  158. ItemsSource="{Binding Holdings.Items}"
  159. ItemTemplate="{StaticResource HoldingTemplate}"
  160. PullToRefresh="False"
  161. ShowRecordCount="False" />
  162. </views:DockLayout>
  163. </mobile:MobilePageStackItem.Content>
  164. </mobile:MobilePageStackItem>
  165. <mobile:MobilePageStackItem>
  166. <mobile:MobilePageStackItem.Content>
  167. <mobile:MobileListView
  168. x:Name="_imagelist"
  169. PullToRefresh="False"
  170. ShowRecordCount="False"
  171. ItemsSource="{Binding Images}"
  172. ItemTemplate="{StaticResource PhotoTemplate}" />
  173. </mobile:MobilePageStackItem.Content>
  174. </mobile:MobilePageStackItem>
  175. <mobile:MobilePageStackItem>
  176. <mobile:MobilePageStackItem.Content>
  177. <Grid>
  178. <Grid.RowDefinitions>
  179. <RowDefinition Height="Auto" />
  180. <RowDefinition Height="*" />
  181. <RowDefinition Height="Auto" />
  182. <RowDefinition Height="Auto" />
  183. </Grid.RowDefinitions>
  184. <Label
  185. Grid.Row="0"
  186. Text="Stock Take Notes:"
  187. FontSize="{StaticResource Theme.Text.Body.Size}"
  188. TextColor="{StaticResource Theme.OnBackground}"/>
  189. <mobile:MobileCard
  190. Grid.Row="1"
  191. Background="{StaticResource Theme.Surface}"
  192. Padding="5">
  193. <mobile:MobileEditor
  194. Text="{Binding Notes}"
  195. BackgroundColor="Transparent"/>
  196. </mobile:MobileCard>
  197. <Label
  198. Grid.Row="2"
  199. Text="Move Stock Location To:"
  200. FontSize="{StaticResource Theme.Text.Body.Size}"
  201. TextColor="{StaticResource Theme.OnBackground}"/>
  202. <Grid
  203. Grid.Row="3">
  204. <Grid.ColumnDefinitions>
  205. <ColumnDefinition Width="*"/>
  206. <ColumnDefinition Width="Auto" />
  207. </Grid.ColumnDefinitions>
  208. <mobile:MobileCard
  209. Grid.Column="0"
  210. Padding="5,0"
  211. BackgroundColor="{StaticResource Theme.Background}">
  212. <Label
  213. HorizontalOptions="Fill"
  214. Text="{Binding Location.AreaDescription}"
  215. FontSize="Small"
  216. TextColor="{StaticResource Theme.OnBackground}"
  217. LineBreakMode="TailTruncation"
  218. VerticalTextAlignment="Center"
  219. />
  220. </mobile:MobileCard>
  221. <mobile:MobileButton
  222. Grid.Column="1"
  223. Image="lines"
  224. WidthRequest="40"
  225. Clicked="ChangeArea_Clicked"
  226. />
  227. </Grid>
  228. </Grid>
  229. </mobile:MobilePageStackItem.Content>
  230. </mobile:MobilePageStackItem>
  231. </mobile:MobilePageStack.Items>
  232. </mobile:MobilePageStack>
  233. <mobile:MobileTabStrip
  234. x:Name="_tabStrip"
  235. Grid.Row="1">
  236. <mobile:MobileTabStrip.Items>
  237. <mobile:MobileTabStripItem Text="Location" />
  238. <mobile:MobileTabStripItem Text="Photos" />
  239. <mobile:MobileTabStripItem Text="Summary" />
  240. </mobile:MobileTabStrip.Items>
  241. </mobile:MobileTabStrip>
  242. </Grid>
  243. </mobile:MobilePage.PageContent>
  244. </mobile:MobilePage>