| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Comal.Classes;
- using InABox.Core;
- using InABox.Mobile;
- using Xamarin.Forms;
- using Xamarin.Forms.Xaml;
- namespace PRS.Mobile
- {
- [XamlCompilation(XamlCompilationOptions.Compile)]
- public partial class RequisitionEditDetailsView : RequisitionEditView
- {
-
- public RequisitionEditDetailsView()
- {
- InitializeComponent();
- }
- public override void Refresh()
- {
-
- }
- private void Subject_OnTextChanged(object sender, TextChangedEventArgs e)
- {
- DoChanged(nameof(RequisitionShell.Title));
- }
- private void SelectJob_Clicked(object sender, MobileButtonClickEventArgs args)
- {
- ShowPopup(() => SelectionView.Execute<JobShell>(
- (columns) =>
- {
- columns.Add(new MobileGridTextColumn<JobShell>()
- {
- Column = x => x.JobNumber,
- Width = GridLength.Auto,
- Caption = "#",
- Alignment = TextAlignment.Center
- });
- columns.Add(new MobileGridTextColumn<JobShell>()
- {
- Column = x => x.Name,
- Width = GridLength.Star,
- Caption = "Select Job",
- Alignment = TextAlignment.Start
- });
- },
- (refresh) => App.Data.Jobs.Refresh(false),
- (jobs) =>
- {
- ViewModel.Item.JobID = jobs.FirstOrDefault()?.ID ?? Guid.Empty;
- ViewModel.Item.JobName = jobs.FirstOrDefault()?.Name ?? string.Empty;
- ViewModel.Item.JobNumber = jobs.FirstOrDefault()?.JobNumber ?? string.Empty;
- DoChanged(nameof(RequisitionShell.JobDisplay));
- DismissPopup();
- }));
- }
- private void Notes_OnTextChanged(object sender, TextChangedEventArgs e)
- {
- DoChanged(nameof(RequisitionShell.Notes));
- }
- private void Due_OnChanged(object sender, DateButtonChangedArgs args)
- {
- DoChanged(nameof(RequisitionShell.Due));
- }
-
- private void RequestedBy_Clicked(object sender, MobileButtonClickEventArgs args)
- {
- ShowPopup(() => SelectionView.Execute<EmployeeShell>(
- (columns) => columns.Add(new MobileGridTextColumn<Employee>() { Column = x=>x.Name, Width = GridLength.Star, Caption = "Select Employee", Alignment = TextAlignment.Start}),
- (refresh) => App.Data.Employees.Refresh(false),
- (employees) =>
- {
- ViewModel.Item.RequestedByID = employees.FirstOrDefault()?.ID ?? Guid.Empty;
- ViewModel.Item.RequestedByName = employees.FirstOrDefault()?.Name ?? string.Empty;
- DoChanged(nameof(RequisitionShell.RequestedByName));
- DismissPopup();
- }));
- }
-
-
- private void Destination_Clicked(object sender, MobileButtonClickEventArgs args)
- {
- ShowPopup(() => SelectionView.Execute<RequisitionDestinationShell>(
- (columns) => columns.Add(new MobileGridTextColumn<RequisitionDestinationShell>() { Column = x=>x.Description, Width = GridLength.Star, Caption = "Select Destination", Alignment = TextAlignment.Start}),
- (refresh) => App.Data.RequisitionDestinations.Refresh(false),
- (destinations) =>
- {
- ViewModel.Item.DestinationID = destinations.FirstOrDefault()?.ID ?? Guid.Empty;
- ViewModel.Item.DestinationDescription = destinations.FirstOrDefault()?.Description ?? string.Empty;
- DoChanged(nameof(RequisitionShell.DestinationDescription));
- DismissPopup();
- }));
- DoChanged(nameof(RequisitionShell.DestinationDescription));
- }
-
- private object EditorBackground_OnConverting(RequisitionEditMode value, object parameter)
- {
- return value == RequisitionEditMode.EditRequest
- ? Color.LightYellow
- : Color.Silver;
- }
- private object EditorForeground_OnConverting(RequisitionEditMode value, object parameter)
- {
- return value == RequisitionEditMode.EditRequest
- ? Color.Black
- : Color.Gray;
- }
-
- private object IsPickMode_OnConverting(RequisitionEditMode value, object parameter)
- => value == RequisitionEditMode.PickStock;
-
- private object IsEditMode_OnConverting(RequisitionEditMode value, object parameter)
- => value == RequisitionEditMode.EditRequest;
- private object RequestedBy_OnConverting(RequisitionShell? value, object parameter)
- {
- return value == null || value.RequestedByID == Guid.Empty
- ? "(Select Employee)"
- : ViewModel.Item.RequestedByName;
- }
-
- private object Destination_OnConverting(RequisitionShell? value, object parameter)
- {
- return value == null || value.DestinationID == Guid.Empty
- ? "(Select Delivery Method)"
- : ViewModel.Item.DestinationDescription;
- }
-
- private void Subject_OnFocused(object sender, FocusEventArgs e)
- {
- ViewModel.HideElements = true;
- }
- private void Subject_OnUnfocused(object sender, FocusEventArgs e)
- {
- ViewModel.HideElements = false;
- }
- private void Request_OnFocused(object sender, FocusEventArgs e)
- {
- ViewModel.HideElements = true;
- }
- private void Request_OnUnfocused(object sender, FocusEventArgs e)
- {
- ViewModel.HideElements = false;
- }
- }
- }
|