private void ListViewFood_MouseUp(object sender, MouseButtonEventArgs e)
        {
            if (((ListView)sender).SelectedIndex == -1)
            {
                return;
            }

            if (((ListView)sender).ItemContainerGenerator.ContainerFromIndex(((ListView)sender).SelectedIndex) is ListViewItem lvi)
            {
                var bc = new BrushConverter();

                for (int j = 0; j < Foods.Count; j++)
                {
                    ListViewItem lvi1 = ListViewFood.ItemContainerGenerator.ContainerFromIndex(j) as ListViewItem;
                    var          cp1  = VisualTreeHelperExtensions.FindVisualChild <ContentPresenter>(lvi1);

                    var dt1 = cp1.ContentTemplate as DataTemplate;
                    var rt1 = (Rectangle)dt1.FindName("BackGround", cp1);
                    var tb1 = (TextBlock)dt1.FindName("NameFood", cp1);
                    rt1.Fill = Brushes.White;
                }

                var cp = VisualTreeHelperExtensions.FindVisualChild <ContentPresenter>(lvi);

                var        dt           = cp.ContentTemplate as DataTemplate;
                var        rt           = (Rectangle)dt.FindName("BackGround", cp);
                var        tb           = (TextBlock)dt.FindName("NameFood", cp);
                Model.Food foodSelected = new Model.Food();

                foreach (var item in Foods)
                {
                    if (item.name == tb.Text)
                    {
                        foodSelected = item;
                        break;
                    }
                }
                ;

                NameFood.Text    = foodSelected.name;
                PriceFood.Text   = foodSelected.price;
                Ingredients.Text = foodSelected.ingredients;
                NoteFood.Text    = foodSelected.note;

                if (foodSelected.type == "appetizer")
                {
                    TypeFood.Text = "Khai vị";
                }
                else if (foodSelected.type == "dish")
                {
                    TypeFood.Text = "Món chính";
                }
                else
                {
                    TypeFood.Text = "Tráng miệng";
                }
                rt.Fill = (Brush)bc.ConvertFrom("#FF0BD9EE");
            }
        }
        private void ListViewTable_MouseUp(object sender, MouseButtonEventArgs e)
        {
            if (((ListView)sender).SelectedIndex == -1)
            {
                return;
            }

            if (((ListView)sender).ItemContainerGenerator.ContainerFromIndex(((ListView)sender).SelectedIndex) is ListViewItem lvi)
            {
                var bc = new BrushConverter();

                for (int j = 0; j < Tables.Count; j++)
                {
                    ListViewItem lvi1 = ListViewTable.ItemContainerGenerator.ContainerFromIndex(j) as ListViewItem;
                    var          cp1  = VisualTreeHelperExtensions.FindVisualChild <ContentPresenter>(lvi1);

                    var dt1 = cp1.ContentTemplate as DataTemplate;
                    var rt1 = (Rectangle)dt1.FindName("BackGround", cp1);
                    var tb1 = (TextBlock)dt1.FindName("NumberTable", cp1);
                    rt1.Fill = Brushes.White;
                }

                var cp = VisualTreeHelperExtensions.FindVisualChild <ContentPresenter>(lvi);

                var         dt            = cp.ContentTemplate as DataTemplate;
                var         rt            = (Rectangle)dt.FindName("BackGround", cp);
                var         tb            = (TextBlock)dt.FindName("NumberTable", cp);
                Model.Table tableSelected = new Model.Table();

                foreach (var item in Tables)
                {
                    if (item.number == tb.Text)
                    {
                        tableSelected = item;
                        break;
                    }
                }
                ;

                NumberTable.Text  = tableSelected.number;
                CustomerName.Text = tableSelected.customer.fullName;
                Phone.Text        = tableSelected.customer.phone;
                Status.Text       = tableSelected.status;
                Note.Text         = tableSelected.note;
                ID.Text           = tableSelected.id;
                if (tableSelected.type == "VIP")
                {
                    TypeTable.Text = "VIP";
                }
                else
                {
                    TypeTable.Text = "Tiêu chuẩn";
                }
                NumberOfSeat.Text = "Bàn " + tableSelected.numberOfSeat + " người";
                rt.Fill           = (Brush)bc.ConvertFrom("#FF0BD9EE");
            }
        }
        private void ListViewBill_MouseUp(object sender, MouseButtonEventArgs e)
        {
            if (((ListView)sender).SelectedIndex == -1)
            {
                return;
            }

            if (((ListView)sender).ItemContainerGenerator.ContainerFromIndex(((ListView)sender).SelectedIndex) is ListViewItem lvi)
            {
                var bc = new BrushConverter();

                for (int j = 0; j < Bills.Count; j++)
                {
                    ListViewItem lvi1 = ListViewBill.ItemContainerGenerator.ContainerFromIndex(j) as ListViewItem;
                    var          cp1  = VisualTreeHelperExtensions.FindVisualChild <ContentPresenter>(lvi1);

                    var dt1 = cp1.ContentTemplate as DataTemplate;
                    var rt1 = (Rectangle)dt1.FindName("BackGround", cp1);
                    var tb1 = (TextBlock)dt1.FindName("NumberBill", cp1);
                    rt1.Fill = Brushes.White;
                }

                var cp = VisualTreeHelperExtensions.FindVisualChild <ContentPresenter>(lvi);

                var        dt           = cp.ContentTemplate as DataTemplate;
                var        rt           = (Rectangle)dt.FindName("BackGround", cp);
                var        tb           = (TextBlock)dt.FindName("NumberBill", cp);
                Model.Bill billSelected = new Model.Bill();

                foreach (var item in Bills)
                {
                    if (item.billNumber.ToString() == tb.Text)
                    {
                        billSelected = item;
                        break;
                    }
                }
                ;

                NumberBill.Text      = billSelected.billNumber.ToString();
                NumberTableBill.Text = billSelected.tableNumber.ToString();
                TotalBill.Text       = billSelected.total.ToString();
                PromotionBill.Text   = billSelected.promotion;
                EmployeeBill.Text    = billSelected.employeeName;
                CustomerBill.Text    = billSelected.customer.fullName;
                LoadOrderFood(billSelected);

                rt.Fill = (Brush)bc.ConvertFrom("#FF0BD9EE");
            }
        }
        private async Task Load()
        {
            await Task.Run(() =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    foreach (var item in stuff)
                    {
                        Tables.Add(new Model.Table()
                        {
                            id           = item._id,
                            number       = item.number,
                            numberOfSeat = item.numberOfSeat,
                            type         = item.type,
                            status       = item.status,
                            note         = item.note,
                            customer     = new Customer()
                            {
                                fullName = item.customer.fullName, phone = item.customer.phone
                            }
                        });
                    }
                    ;
                });
            });

            await Task.Run(() =>
            {
                Thread.Sleep(1000);
                this.Dispatcher.Invoke(() =>
                {
                    for (int i = 0; i < Tables.Count; i++)
                    {
                        if (Tables[i].type == "standard")
                        {
                            ListViewItem lvi1 = ListViewTable.ItemContainerGenerator.ContainerFromIndex(i) as ListViewItem;
                            var cp1           = VisualTreeHelperExtensions.FindVisualChild <ContentPresenter>(lvi1);

                            var dt1        = cp1.ContentTemplate as DataTemplate;
                            var rt1        = (Grid)dt1.FindName("TicketType", cp1);
                            rt1.Background = Brushes.Blue;
                        }
                    }
                    ;
                });
            });
        }