TransferModule.xaml 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <mobile:MobilePage
  3. xmlns:local="clr-namespace:PRS.Mobile"
  4. xmlns="http://xamarin.com/schemas/2014/forms"
  5. xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
  6. x:Class="PRS.Mobile.TransferModule"
  7. xmlns:material="clr-namespace:XF.Material.Forms.UI;assembly=XF.Material"
  8. xmlns:views="http://xamarin.com/schemas/2020/toolkit"
  9. xmlns:mobile="clr-namespace:InABox.Mobile;assembly=InABox.Mobile.Shared"
  10. material:MaterialNavigationPage.AppBarColor="#a2006d"
  11. Title="Transfer Stock"
  12. x:DataType="local:TransferModuleViewModel"
  13. >
  14. <mobile:MobilePage.BindingContext>
  15. <local:TransferModuleViewModel x:Name="_viewModel" />
  16. </mobile:MobilePage.BindingContext>
  17. <mobile:MobilePage.Resources>
  18. <mobile:IntToBooleanConverter x:Key="SaveVisibleConverter" Value="2" Result="True"/>
  19. <mobile:IntToBooleanConverter x:Key="PhotoVisibleConverter" Value="1" Result="True"/>
  20. <mobile:IntToBooleanConverter x:Key="SaveEnabledConverter" Value="0" Result="False"/>
  21. <mobile:GuidToBooleanConverter x:Key="SearchVisibleConverter" EmptyValue="False"/>
  22. <mobile:StringWithDefaultValueConverter x:Key="FromConverter" Default="(Select)" />
  23. <mobile:StringWithDefaultValueConverter x:Key="ToConverter" Default="(Select)" />
  24. <mobile:ByteArrayToImageSourceConverter x:Key="ImageConverter"/>
  25. <mobile:GuidToBooleanConverter x:Key="GuidVisibleConverter"/>
  26. <local:TransactionDisplayConverter x:Key="TransactionDisplayConverter"/>
  27. <local:TransactionColorConverter x:Key="TransactionColorConverter"/>
  28. <DataTemplate x:Key="HoldingTemplate" x:DataType="local:StockHoldingShell">
  29. <ViewCell>
  30. <mobile:MobileCard
  31. BackgroundColor="{StaticResource Theme.Background}"
  32. Padding="0"
  33. Margin="0,0,0,5"
  34. IsClickable="True"
  35. Clicked="Holding_Clicked">
  36. <StackLayout Spacing="0" Orientation="Vertical">
  37. <Image
  38. Source = "{Binding Image, Converter={StaticResource ImageConverter}}"
  39. Aspect="AspectFit"
  40. HeightRequest="80"
  41. Margin="5,5,5,0"
  42. IsVisible="{Binding ImageID,Converter={StaticResource GuidVisibleConverter}}"/>
  43. <Label
  44. Text="{Binding ProductCode}"
  45. Margin="5,5,5,0"
  46. FontAttributes="Bold"
  47. FontSize="Small"
  48. HorizontalTextAlignment="Center"
  49. TextColor="{StaticResource Theme.OnBackground}"/>
  50. <Label
  51. Text="{Binding ProductName}"
  52. Margin="5,5,5,0"
  53. FontSize="Micro"
  54. HorizontalTextAlignment="Center"
  55. TextColor="{StaticResource Theme.OnBackground}"/>
  56. <Label
  57. Text="{Binding StyleDescription}"
  58. Margin="5,5,5,0"
  59. FontSize="Micro"
  60. HorizontalTextAlignment="Center"
  61. TextColor="{StaticResource Theme.OnBackground}"
  62. IsVisible="{Binding StyleID, Converter={StaticResource GuidVisibleConverter}}"/>
  63. <StackLayout
  64. Margin="5,5,5,0"
  65. Orientation="Horizontal"
  66. HorizontalOptions="Center"
  67. IsVisible="{Binding JobID, Converter={StaticResource GuidVisibleConverter}}">
  68. <Label
  69. Text="Job:"
  70. FontSize="Micro"
  71. TextColor="{StaticResource Theme.OnBackground}"/>
  72. <Label
  73. Text="{Binding JobNumber}"
  74. FontSize="Micro"
  75. TextColor="{StaticResource Theme.OnBackground}" />
  76. </StackLayout>
  77. <StackLayout
  78. Margin="5,5,5,0"
  79. Orientation="Horizontal"
  80. HorizontalOptions="Center">
  81. <Label
  82. FontSize="Micro"
  83. Text="{Binding Units}"
  84. TextColor="{StaticResource Theme.OnBackground}"/>
  85. <Label
  86. FontSize="Micro"
  87. Text="@"
  88. TextColor="{StaticResource Theme.OnBackground}"/>
  89. <Label
  90. FontSize="Micro"
  91. Text="{Binding DimensionsUnitSize}"
  92. TextColor="{StaticResource Theme.OnBackground}"/>
  93. <Label
  94. FontSize="Micro"
  95. Text="{Binding Available, StringFormat='({0} avail.)'}"
  96. TextColor="{StaticResource Theme.OnBackground}"/>
  97. </StackLayout>
  98. <StackLayout
  99. Orientation="Vertical"
  100. Spacing="0"
  101. Margin="0,5,0,0"
  102. BindableLayout.ItemsSource="{Binding Transactions}">
  103. <BindableLayout.ItemTemplate>
  104. <DataTemplate x:DataType="local:StockTransaction" >
  105. <!-- <StackLayout Spacing="0" Orientation="Vertical" HorizontalOptions="Fill" Background="LightGreen"> -->
  106. <Grid RowSpacing="0" ColumnSpacing="5">
  107. <Grid.Background>
  108. <MultiBinding Converter="{StaticResource TransactionColorConverter}">
  109. <Binding Path="." />
  110. <Binding Source="{RelativeSource AncestorType={x:Type local:StockHoldingShell}}" Path="LocationID"/>
  111. </MultiBinding>
  112. </Grid.Background>
  113. <Grid.ColumnDefinitions>
  114. <ColumnDefinition Width="30" />
  115. <ColumnDefinition Width="*"/>
  116. </Grid.ColumnDefinitions>
  117. <Grid.RowDefinitions>
  118. <RowDefinition Height="1"/>
  119. <RowDefinition Height="Auto"/>
  120. </Grid.RowDefinitions>
  121. <BoxView
  122. Grid.Row="0"
  123. Grid.Column="0"
  124. Grid.ColumnSpan="2"
  125. BackgroundColor="Gray"/>
  126. <Label
  127. Grid.Row="1"
  128. Grid.Column="0"
  129. Text="{Binding Quantity}"
  130. HorizontalTextAlignment="Center"
  131. VerticalTextAlignment="Center"
  132. FontSize="8"
  133. TextColor="{StaticResource Theme.OnBackground}"
  134. Margin="0,2"/>
  135. <Label
  136. Grid.Row="1"
  137. Grid.Column="1"
  138. FontSize="8"
  139. TextColor="{StaticResource Theme.OnBackground}"
  140. HorizontalTextAlignment="Center"
  141. VerticalTextAlignment="Center"
  142. Margin="0,2">
  143. <Label.Text>
  144. <MultiBinding Converter="{StaticResource TransactionDisplayConverter}">
  145. <Binding Path="." />
  146. <Binding Source="{RelativeSource AncestorType={x:Type local:StockHoldingShell}}" Path="LocationID"/>
  147. </MultiBinding>
  148. </Label.Text>
  149. </Label>
  150. </Grid>
  151. </DataTemplate>
  152. </BindableLayout.ItemTemplate>
  153. </StackLayout>
  154. </StackLayout>
  155. </mobile:MobileCard>
  156. </ViewCell>
  157. </DataTemplate>
  158. <DataTemplate x:Key="TransactionTemplate" x:DataType="{x:Type local:StockTransaction}">
  159. <ViewCell>
  160. <Grid RowSpacing="0" ColumnSpacing="0">
  161. <Grid.ColumnDefinitions>
  162. <ColumnDefinition Width="Auto"/>
  163. <ColumnDefinition Width="*"/>
  164. <ColumnDefinition Width="Auto" />
  165. </Grid.ColumnDefinitions>
  166. <Grid.RowDefinitions>
  167. <RowDefinition Height="*"/>
  168. <RowDefinition Height="1"/>
  169. </Grid.RowDefinitions>
  170. <Image
  171. Grid.Row="0"
  172. Grid.Column="0"
  173. Source="{Binding Image, Converter={StaticResource ImageConverter}}"
  174. HeightRequest="40"
  175. WidthRequest="40"
  176. VerticalOptions="Center"
  177. Margin="5">
  178. <Image.GestureRecognizers>
  179. <TapGestureRecognizer Tapped="TransactionImage_Clicked" />
  180. </Image.GestureRecognizers>
  181. </Image>
  182. <mobile:MobileCard
  183. Grid.Row="0"
  184. Grid.Column="1"
  185. BorderColor="Transparent "
  186. BackgroundColor="Transparent"
  187. IsClickable="True"
  188. Clicked="Transaction_Clicked">
  189. <Grid>
  190. <Grid.RowDefinitions>
  191. <RowDefinition Height="*"/>
  192. <RowDefinition Height="*"/>
  193. </Grid.RowDefinitions>
  194. <Grid.ColumnDefinitions>
  195. <ColumnDefinition Width="*"/>
  196. </Grid.ColumnDefinitions>
  197. <Label
  198. Grid.Row="0"
  199. Grid.Column="0"
  200. Margin="5,5,5,2.5"
  201. VerticalTextAlignment="Center"
  202. Text="{Binding ProductDisplay}"
  203. TextColor="{StaticResource Theme.OnBackground}"
  204. FontSize="{StaticResource Theme.Text.Body.Size}"/>
  205. <FlexLayout
  206. Grid.Row="1"
  207. Grid.Column="0"
  208. Margin="5,2.5,5,5"
  209. AlignItems="Start"
  210. JustifyContent="Start"
  211. HorizontalOptions="Fill">
  212. <Label
  213. Text="{Binding Quantity}"
  214. Margin="0"
  215. TextColor="{StaticResource Theme.OnBackground}"
  216. FontSize="{StaticResource Theme.Text.Small.Size}"/>
  217. <Label
  218. Text="From"
  219. Margin="2,0,0,0"
  220. TextColor="{StaticResource Theme.OnBackground}"
  221. FontSize="{StaticResource Theme.Text.Small.Size}"/>
  222. <Label
  223. Text="{Binding Source.LocationCode}"
  224. Margin="2,0,0,0"
  225. TextColor="{StaticResource Theme.OnBackground}"
  226. FontSize="{StaticResource Theme.Text.Small.Size}"
  227. IsVisible="{Binding LocationChanged}"/>
  228. <Label
  229. Text="{Binding Source.StyleCode}"
  230. Margin="2,0,0,0"
  231. TextColor="{StaticResource Theme.OnBackground}"
  232. FontSize="{StaticResource Theme.Text.Small.Size}"
  233. IsVisible="{Binding StyleChanged}"/>
  234. <Label
  235. Text="{Binding Source.JobNumber}"
  236. Margin="2,0,0,0"
  237. TextColor="{StaticResource Theme.OnBackground}"
  238. FontSize="{StaticResource Theme.Text.Small.Size}"
  239. IsVisible="{Binding JobChanged}"/>
  240. <Label
  241. Text="To"
  242. Margin="2,0,0,0"
  243. TextColor="{StaticResource Theme.OnBackground}"
  244. FontSize="{StaticResource Theme.Text.Small.Size}" />
  245. <Label
  246. Text="{Binding Target.LocationCode}"
  247. Margin="2,0,0,0"
  248. TextColor="{StaticResource Theme.OnBackground}"
  249. FontSize="{StaticResource Theme.Text.Small.Size}"
  250. IsVisible="{Binding LocationChanged}"/>
  251. <Label
  252. Text="{Binding Target.StyleCode}"
  253. Margin="2,0,0,0"
  254. TextColor="{StaticResource Theme.OnBackground}"
  255. FontSize="{StaticResource Theme.Text.Small.Size}"
  256. IsVisible="{Binding StyleChanged}"/>
  257. <Label
  258. Text="{Binding Target.JobNumber}"
  259. Margin="2,0,0,0"
  260. TextColor="{StaticResource Theme.OnBackground}"
  261. FontSize="{StaticResource Theme.Text.Small.Size}"
  262. IsVisible="{Binding JobChanged}"/>
  263. </FlexLayout>
  264. </Grid>
  265. </mobile:MobileCard>
  266. <mobile:MobileMenuButton
  267. Grid.Row="0"
  268. Grid.Column="2"
  269. Image="minus"
  270. HeightRequest="30"
  271. WidthRequest="30"
  272. VerticalOptions="Center"
  273. Margin="5"
  274. Clicked="DeleteTransaction_Clicked"/>
  275. <BoxView
  276. Grid.Row="1"
  277. Grid.Column="0"
  278. Grid.ColumnSpan="3"
  279. Color="Gray"/>
  280. </Grid>
  281. </ViewCell>
  282. </DataTemplate>
  283. <DataTemplate x:Key="PhotoTemplate" x:DataType="local:StockTransactionImage">
  284. <ViewCell>
  285. <mobile:MobileCard
  286. IsClickable="True"
  287. Clicked="Image_Clicked"
  288. Margin="0,0,0,5">
  289. <Image
  290. Margin="5"
  291. Source="{Binding Thumbnail, Converter={StaticResource ImageConverter}}"
  292. HeightRequest="200"
  293. Aspect="AspectFit"
  294. />
  295. </mobile:MobileCard>
  296. </ViewCell>
  297. </DataTemplate>
  298. </mobile:MobilePage.Resources>
  299. <mobile:MobilePage.PrimaryMenu>
  300. <mobile:MobileMenuButton
  301. x:Name="Photo"
  302. Image="camera"
  303. IsVisible="{Binding Source={x:Reference Name=_tabStrip}, Path=SelectedIndex, Converter={StaticResource PhotoVisibleConverter}}">
  304. <mobile:MobileMenuButton.Items>
  305. <mobile:MobileMenuItem Text="Take Photo" Clicked="TakePhoto_Clicked" />
  306. <mobile:MobileMenuItem Text="Browse Library" Clicked="PickPhoto_Clicked" />
  307. </mobile:MobileMenuButton.Items>
  308. </mobile:MobileMenuButton>
  309. <mobile:MobileMenuButton
  310. x:Name="Save"
  311. Clicked="SaveBatch_Clicked"
  312. Image="save"
  313. IsVisible="{Binding Source={x:Reference Name=_tabStrip}, Path=SelectedIndex, Converter={StaticResource SaveVisibleConverter}}"
  314. IsEnabled="{Binding Transactions.Count, Converter={StaticResource SaveEnabledConverter}}"/>
  315. </mobile:MobilePage.PrimaryMenu>
  316. <mobile:MobilePage.PageContent>
  317. <Grid Padding="5" Grid.RowSpacing="5" >
  318. <Grid.RowDefinitions>
  319. <RowDefinition Height="*"/>
  320. <RowDefinition Height="Auto"/>
  321. </Grid.RowDefinitions>
  322. <mobile:MobilePageStack
  323. Grid.Row="0"
  324. SelectedIndex="{Binding Source={x:Reference Name=_tabStrip}, Path=SelectedIndex}">
  325. <mobile:MobilePageStack.Items>
  326. <mobile:MobilePageStackItem>
  327. <mobile:MobilePageStackItem.Content>
  328. <Grid RowSpacing="5" ColumnSpacing="5">
  329. <Grid.ColumnDefinitions>
  330. <ColumnDefinition Width="*"/>
  331. <ColumnDefinition Width="*"/>
  332. </Grid.ColumnDefinitions>
  333. <Grid.RowDefinitions>
  334. <RowDefinition Height="*"/>
  335. </Grid.RowDefinitions>
  336. <views:DockLayout
  337. Grid.Column="0">
  338. <mobile:MobileButton
  339. x:Name="From"
  340. views:DockLayout.Dock="Top"
  341. Text="{Binding Source.Code, Converter={StaticResource FromConverter}}"
  342. Clicked="From_Clicked"
  343. Prefix="From: "/>
  344. <mobile:MobileCard
  345. views:DockLayout.Dock="Top"
  346. Margin="0,5,0,0"
  347. HeightRequest="{Binding Source={x:Reference From}, Path=Height}"
  348. BackgroundColor="{Binding Source={x:Reference SourceSearch}, Path=BackgroundColor}"
  349. IsVisible="{Binding Source.ID, Converter={StaticResource SearchVisibleConverter}}"
  350. Padding="10,0">
  351. <mobile:MobileEntry
  352. x:Name="SourceSearch"
  353. TextChanged="SourceSearch_OnTextChanged"
  354. Placeholder="Search..." />
  355. </mobile:MobileCard>
  356. <mobile:MobileListView
  357. x:Name="_sourceHoldings"
  358. views:DockLayout.Dock="Top"
  359. Margin="0,5,0,0"
  360. ItemsSource="{Binding SourceHoldings.Items}"
  361. ItemTemplate="{StaticResource HoldingTemplate}"
  362. PullToRefresh="False"
  363. ShowRecordCount="False" />
  364. </views:DockLayout>
  365. <views:DockLayout
  366. Grid.Row="0"
  367. Grid.Column="1">
  368. <mobile:MobileButton
  369. views:DockLayout.Dock="Top"
  370. Text="{Binding Target.Code, Converter={StaticResource ToConverter}}"
  371. Clicked="To_Clicked"
  372. Prefix="To:"/>
  373. <mobile:MobileCard
  374. views:DockLayout.Dock="Top"
  375. Margin="0,5,0,0"
  376. HeightRequest="{Binding Source={x:Reference From}, Path=Height}"
  377. BackgroundColor="{Binding Source={x:Reference TargetSearch}, Path=BackgroundColor}"
  378. IsVisible="{Binding Target.ID, Converter={StaticResource SearchVisibleConverter}}"
  379. Padding="10,0">
  380. <mobile:MobileEntry
  381. x:Name="TargetSearch"
  382. TextChanged="TargetSearch_OnTextChanged"
  383. Placeholder="Search..." />
  384. </mobile:MobileCard>
  385. <mobile:MobileListView
  386. x:Name="_targetHoldings"
  387. views:DockLayout.Dock="Top"
  388. Margin="0,5,0,0"
  389. ItemsSource="{Binding TargetHoldings.Items}"
  390. ItemTemplate="{StaticResource HoldingTemplate}"
  391. PullToRefresh="False"
  392. ShowRecordCount="False"/>
  393. </views:DockLayout>
  394. </Grid>
  395. </mobile:MobilePageStackItem.Content>
  396. </mobile:MobilePageStackItem>
  397. <mobile:MobilePageStackItem>
  398. <mobile:MobilePageStackItem.Content>
  399. <mobile:MobileListView
  400. x:Name="_imagelist"
  401. PullToRefresh="False"
  402. ShowRecordCount="False"
  403. ItemsSource="{Binding Images}"
  404. ItemTemplate="{StaticResource PhotoTemplate}" />
  405. </mobile:MobilePageStackItem.Content>
  406. </mobile:MobilePageStackItem>
  407. <mobile:MobilePageStackItem>
  408. <mobile:MobilePageStackItem.Content>
  409. <Grid>
  410. <Grid.RowDefinitions>
  411. <RowDefinition Height="Auto" />
  412. <RowDefinition Height="2*" />
  413. <RowDefinition Height="Auto" />
  414. <RowDefinition Height="*" />
  415. </Grid.RowDefinitions>
  416. <Label
  417. Grid.Row="0"
  418. Text="Items to Be Transferred:"
  419. FontSize="{StaticResource Theme.Text.Body.Size}"
  420. TextColor="{StaticResource Theme.OnBackground}"/>
  421. <mobile:MobileCard
  422. Grid.Row="1"
  423. Background="{StaticResource Theme.Background}">
  424. <mobile:MobileListView
  425. ItemsSource="{Binding Transactions}"
  426. ItemTemplate="{StaticResource TransactionTemplate}"/>
  427. </mobile:MobileCard>
  428. <Label
  429. Grid.Row="2"
  430. Text="Transfer Notes:"
  431. FontSize="{StaticResource Theme.Text.Body.Size}"
  432. TextColor="{StaticResource Theme.OnBackground}"/>
  433. <mobile:MobileCard
  434. Grid.Row="3"
  435. Background="{StaticResource Theme.Surface}"
  436. Padding="5">
  437. <mobile:MobileEditor
  438. Text="{Binding Notes}"
  439. BackgroundColor="Transparent"/>
  440. </mobile:MobileCard>
  441. </Grid>
  442. </mobile:MobilePageStackItem.Content>
  443. </mobile:MobilePageStackItem>
  444. </mobile:MobilePageStack.Items>
  445. </mobile:MobilePageStack>
  446. <mobile:MobileTabStrip
  447. x:Name="_tabStrip"
  448. Grid.Row="1">
  449. <mobile:MobileTabStrip.Items>
  450. <mobile:MobileTabStripItem Text="Locations" />
  451. <mobile:MobileTabStripItem Text="Photos" />
  452. <mobile:MobileTabStripItem Text="Summary" />
  453. </mobile:MobileTabStrip.Items>
  454. </mobile:MobileTabStrip>
  455. </Grid>
  456. </mobile:MobilePage.PageContent>
  457. </mobile:MobilePage>