Example #1
0
        public InvoiceSideBar()
        {
            this.Layer.BorderColor = UIColor.Black.ColorWithAlpha(.25f).CGColor;
            this.Layer.BorderWidth = .5f;
            BackgroundColor        = Theme.Current.SideBarBackGroundColor;     //UIColor.DarkGray;
            AddSubview(tableView   = new UITableView(RectangleF.Empty, UITableViewStyle.Grouped)
            {
                BackgroundColor = UIColor.Clear,
                Source          = source = new CellTableViewSource {
                    (customer = new CustomerPickerCell {
                        Tapped = async() => {
                            CustomerSearchViewController customerSearch;
                            popover = new UIPopoverController(new UINavigationController(customerSearch = new CustomerSearchViewController {
                                CustomerPicked = (c) => {
                                    Invoice.Customer = c;
                                    popover.Dismiss(true);
                                    popover.Dispose();
                                    if (Invoice.Customer.IsNew)
                                    {
                                        //
                                        NewCustomerInfoViewController newCust;
                                        newCustPopover = new UIPopoverController(new UINavigationController(newCust = new NewCustomerInfoViewController()));
                                        newCust.Popover = newCustPopover;
                                        newCust.HowTheyHeard = (i) => {
                                            invoice.AddItem(i);
                                            newCustPopover.Dismiss(true);
                                            newCustPopover.Dispose();
                                        };
                                        newCustPopover.PresentFromRect(customer.Frame, tableView, UIPopoverArrowDirection.Right, true);

                                        //
                                    }
                                }
                            })
                            {
                                NavigationBar =
                                {
                                    BarStyle = UIBarStyle.BlackTranslucent,
                                }
                            });
                            customerSearch.Popover = popover;
                            popover.PresentFromRect(customer.Frame, tableView, UIPopoverArrowDirection.Right, true);
                        }
                    }),
                    (subtotal = new SubTotalCell()),
                    (discount = new DiscountCell {
                        AddDiscount = () => {
                        }
                    }),
                    (total = new TotalCell()),
                    new PayCell {
                        Frame     = new RectangleF(0, 0, 320, 60),
                        Text      = "Checkout",
                        TintColor = UIColor.White,
                        Tapped    = () => {
                            Checkout();
                        }
                    }, (lastPostedChange = new LastPostedCell()
                    {
                    }),
                    (printLastInvoice = new PrintLastInvoiceCell {
                        Text = "Print last invoice",
                        Tapped = () => {
                            WebService.Main.PrintInvoice(Settings.Shared.LastPostedInvoice);
                        }
                    }),
                },
                ScrollEnabled   = false,
                TableHeaderView = new UIView(new RectangleF(0, 0, 0, 64)),
            });
            Binding.Create(() => lastPostedChange.DetailTextLabel.Text == Settings.Shared.LastPostedChangeString);
            customerInfo = new UITableViewCell[] {
                (email = new MiniCell {
                    TextLabel =
                    {
                        Text = "Email"
                    },
                    Tapped = () => {
                        showEditor(email);
                    },
                }),
                (phoneNumber = new MiniCell {
                    TextLabel =
                    {
                        Text = "Phone"
                    },
                    Tapped = () => {
                        showEditor(phoneNumber);
                    },
                }),
                (onAccount = new MiniCell {
                    TextLabel =
                    {
                        Text = "On Account"
                    },
                    Tapped = () => {
                        showEditor(onAccount);
                    },
                }),
            };
        }
Example #2
0
        public InvoiceSideBar()
        {
            this.Layer.BorderColor = UIColor.Black.ColorWithAlpha (.25f).CGColor;
            this.Layer.BorderWidth = .5f;
            BackgroundColor = Theme.Current.SideBarBackGroundColor;//UIColor.DarkGray;
            AddSubview (tableView = new UITableView (RectangleF.Empty, UITableViewStyle.Grouped) {
                BackgroundColor = UIColor.Clear,
                Source = source = new CellTableViewSource {
                    (customer = new CustomerPickerCell {
                        Tapped = async () => {
                            CustomerSearchViewController customerSearch;
                            popover = new UIPopoverController (new UINavigationController (customerSearch = new CustomerSearchViewController {
                                CustomerPicked = (c) => {
                                    Invoice.Customer = c;
                                    popover.Dismiss (true);
                                    popover.Dispose ();
                                    if(Invoice.Customer.IsNew)
                                    {
                                        //
                                        NewCustomerInfoViewController newCust;
                                        newCustPopover = new UIPopoverController(new UINavigationController(newCust = new NewCustomerInfoViewController()));
                                        newCust.Popover = newCustPopover;
                                        newCust.HowTheyHeard = (i) => {
                                            invoice.AddItem(i);
                                            newCustPopover.Dismiss(true);
                                            newCustPopover.Dispose();
                                        };
                                        newCustPopover.PresentFromRect (customer.Frame, tableView, UIPopoverArrowDirection.Right, true);

                                        //
                                    }
                                }
                            }) {
                                NavigationBar = {
                                    BarStyle = UIBarStyle.BlackTranslucent,
                                }
                            });
                            customerSearch.Popover = popover;
                            popover.PresentFromRect (customer.Frame, tableView, UIPopoverArrowDirection.Right, true);
                        }
                    }),
                    (subtotal = new SubTotalCell ()),
                    (discount = new DiscountCell {
                        AddDiscount = () =>{

                        }
                    }),
                    (total = new TotalCell ()),
                    new PayCell {
                        Frame = new RectangleF(0,0,320,60),
                        Text = "Checkout",
                        TintColor = UIColor.White,
                        Tapped = () => {
                            Checkout ();
                        }
                    }, (lastPostedChange = new LastPostedCell () {

                    }),
                    (printLastInvoice = new PrintLastInvoiceCell{
                        Text = "Print last invoice",
                        Tapped = ()=>{
                            WebService.Main.PrintInvoice(Settings.Shared.LastPostedInvoice);
                        }
                    }),
                },
                ScrollEnabled = false,
                TableHeaderView = new UIView (new RectangleF (0, 0, 0, 64)),
            });
            Binding.Create (() => lastPostedChange.DetailTextLabel.Text == Settings.Shared.LastPostedChangeString);
            customerInfo = new UITableViewCell[] {
                (email = new MiniCell {
                    TextLabel = {
                        Text = "Email"
                    },
                    Tapped = ()=>{
                        showEditor(email);
                    },
                }),
                (phoneNumber = new MiniCell {
                    TextLabel = {
                        Text = "Phone"
                    },
                    Tapped = ()=>{
                        showEditor(phoneNumber);
                    },
                }),
                (onAccount = new MiniCell {
                    TextLabel = {
                        Text = "On Account"
                    },
                    Tapped = ()=>{
                        showEditor(onAccount);
                    },
                }),
            };
        }