예제 #1
0
        public CardDetailsView(Opdracht opdracht)
        {
            bedrijven = DataController.Instance.GetCompanys();
            BackgroundColor = Color.White;

            Label TitleText = new Label () {
                FormattedText = bedrijven[opdracht.BedrijfID].Naam,
                FontSize = 18,
                TextColor = StyleKit.LightTextColor
            };

            Label DescriptionText = new Label () {
                FormattedText = opdracht.Omschrijving,
                FontSize = 12,
                TextColor = StyleKit.LightTextColor
            };

            var stack = new StackLayout () {
                Spacing = 0,
                Padding = new Thickness (10, 0, 0, 0),
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Children = {
                    TitleText,
                    DescriptionText//,
                    //new DateTimeView (opdracht)
                }
            };

            Content = stack;
        }
        public ListPreviousContact(Opdracht opdracht,String CompanyName)
        {
            Title = CompanyName;
            Padding = new Thickness(10, 10, 10, 10);
            BackgroundColor = Color.White;

            layout = new StackLayout();

            lstvPreviousContact = new ListView
            {
                HasUnevenRows = true,
                ItemTemplate = new DataTemplate(typeof(PreviousCell)),
                ItemsSource = PreviousData.GetData(opdracht),
                SeparatorColor = Color.FromHex("ddd"),
                BackgroundColor = Color.White,
            };

            lstvPreviousContact.ItemSelected += (sender, e) => {
                if (e.SelectedItem != null){
                    Previous pre = e.SelectedItem as Previous;
                    List<Opdracht> lijstopdracht = DataController.Instance.GetAssessmentsByID(pre.OpdrachtID);
                    Navigation.PushAsync(new AssessmentDetailPage(lijstopdracht[0]));

                }

                ((ListView)sender).SelectedItem = null;

            };

            layout.Children.Add(lstvPreviousContact);
        }
예제 #3
0
        public static List<Previous> GetData(Opdracht opdracht)
        {
            List<Previous> ListPrevious = new List<Previous> ();
            List<Opdracht> ListOpdracht = DataController.Instance.GetAssessmentsByCompanyID(opdracht.BedrijfID);
            List<OpdrachtWerknemer> ListOpdrachtWerknemer = DataController.Instance.GetAssessmentEmployers();

            if (ListOpdracht.Count > 0){
                foreach (Opdracht opd in ListOpdracht) {
                    foreach (OpdrachtWerknemer opdw in ListOpdrachtWerknemer) {
                        if ( opd.ID == opdw.OpdrachtID && LoginController.Instance.GetCurrentUser.ID == opdw.WerknemerID) {
                            ListPrevious.Add (new Previous{
                                Description = opd.Omschrijving,
                                Datum = (DateTime )opdw.Datum,
                                OpdrachtID = opd.ID
                            });
                        }
                    }

                }

            }else
            {
                ListPrevious.Add(new Previous
                    {
                        Description="nog geen contact geweest",
                        Datum = DateTime.Now,
                        OpdrachtID = 0
                    });
            }

            return ListPrevious;
        }
예제 #4
0
        public CardView(Opdracht opdracht)
        {
            Card card = new Card ();
            Grid grid = new Grid {
                Padding = new Thickness (0, 1, 1, 1),
                RowSpacing = 1,
                ColumnSpacing = 1,
                BackgroundColor = StyleKit.CardBorderColor,
                VerticalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions = {
                    new RowDefinition { Height = new GridLength (70, GridUnitType.Absolute) },
                    new RowDefinition { Height = new GridLength (30, GridUnitType.Absolute) }
                },
                ColumnDefinitions = {
                    new ColumnDefinition { Width = new GridLength (4, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
                    new ColumnDefinition { Width = new GridLength (100, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength (60, GridUnitType.Absolute) }
                }
            };

            // Meegeven als de opdracht is afgewerkt.
            grid.Children.Add (
                new CardStatusView (opdracht), 0, 1, 0, 2);

            // Meegeven van de detail (bedrijf, adres ... )
            grid.Children.Add (new CardDetailsView (opdracht), 1, 4, 0, 1);

            grid.Children.Add (new IconLabelView (opdracht,StyleKit.Icons.Alert, "Navigeer"), 1, 1);

            switch (opdracht.Statuslabel) {

            case "Afgewerkt":
                source = StyleKit.Icons.Completed;
                break;
            case "Start":
                source = StyleKit.Icons.Resume;
                break;
            case "Stop":
                source = StyleKit.Icons.Stop;
                break;

            default:
                break;
            }

            grid.Children.Add (
                new IconLabelView (opdracht,
                    source,
                    opdracht.Statuslabel
                )
                , 2, 1);

            //Detailpage
            grid.Children.Add (new ConfigIconView (opdracht), 3, 1);

            Content = grid;
        }
예제 #5
0
        public ListSoldArticles(Opdracht assignment)
        {
            Title = "Verbruikte Artikels";
            Padding = new Thickness (10, 10, 10, 10);
            BackgroundColor = Color.White;

            layout = new StackLayout ();

            lstvwUsedArticles = new ListView {
                HasUnevenRows = true,
                ItemTemplate = new DataTemplate (typeof(VerbruiktArtikelCell)),
                SeparatorColor = Color.FromHex ("ddd"),
                BackgroundColor = Color.White,
                ItemsSource = VerbruiktDataArtikel.GetData(DataController.Instance.GetUsedArticlesByAssignment(assignment)),

            };

            layout.Children.Add (lstvwUsedArticles);
        }
예제 #6
0
        public ConfigIconView(Opdracht opdracht)
        {
            BackgroundColor = StyleKit.CardFooterBackgroundColor;
            Image image = new Image
            {
                HeightRequest = 10,
                WidthRequest = 10,
                Source = StyleKit.Icons.Cog
            };

            Label l = new Label
            {
                Text = "Details",
                FontSize = 9,
                FontAttributes = FontAttributes.Bold,
                TextColor = StyleKit.LightTextColor
            };
            var tapGestureRecognizer = new TapGestureRecognizer();
            tapGestureRecognizer.Tapped += (sender, e) => {
                if (LoginController.Instance.GetCurrentUser.Functie == 2)
                {
                    Navigation.PushAsync(new AppointmentDetailPage(opdracht));
                }
                else
                {
                    Navigation.PushAsync(new AssessmentDetailPage(opdracht));
                }

            };
            image.GestureRecognizers.Add(tapGestureRecognizer);
            l.GestureRecognizers.Add(tapGestureRecognizer);
            Content = new StackLayout
            {
                Padding = new Thickness(5),
                Orientation = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions = LayoutOptions.Center,
                Children = {
                    image, l
                }
            };
        }
예제 #7
0
        public ListSoldProducts(Opdracht opdracht)
        {
            Title = "Gekochte Artikels";
            Padding = new Thickness(10, 10, 10, 10);
            BackgroundColor = Color.White;

            layout = new StackLayout();

            lstvwSoldArticles = new ListView
            {
                HasUnevenRows = true,
                ItemTemplate = new DataTemplate(typeof(ArtikelCell)),
                ItemsSource = ArtikelData.GetData(DataController.Instance.GetSoldArticlesByCompany(DataController.Instance.GetCompanyFromAssessment(opdracht))),
                SeparatorColor = Color.FromHex("ddd"),
                BackgroundColor = Color.White,
                HeightRequest = 140

            };

            layout.Children.Add(lstvwSoldArticles);
        }
        public AppointmentDetailPage(Opdracht opdracht)
        {
            formattedAddress = DataController.Instance.FormattedAddress(DataController.Instance.GetCompanyFromAssessment(opdracht).ID);
            prestatielijst = DataController.Instance.GetAchievements();

            Title = DataController.Instance.GetCompanyFromAssessment(opdracht).Naam;
            BackgroundColor = Color.White;
            Padding = new Thickness(10, 10, 10, 10);
            layout = new StackLayout();

            generalInfoLayout = new StackLayout();

            lblGeneralInfo = new Label
            {
                Text = "Algemene info",
                TextColor = Color.Black,
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };

            lblAddress = new Label
            {
                Text = "Adres: " + formattedAddress,
                TextColor = Color.Black
            };

            lblBTW = new Label
            {
                Text = "BTW: " + DataController.Instance.GetCompanyFromAssessment(opdracht).BTW,
                TextColor = Color.Black
            };

            generalInfoLayout.Children.Add(lblGeneralInfo);
            generalInfoLayout.Children.Add(new BoxView
            {
                Color = Color.FromHex("ddd"),
                HeightRequest = 1,
                VerticalOptions = LayoutOptions.Fill
            });
            generalInfoLayout.Children.Add(lblAddress);
            generalInfoLayout.Children.Add(lblBTW);
            generalInfoLayout.Children.Add(new BoxView
            {
                Color = Color.FromHex("ddd"),
                HeightRequest = 1,
                VerticalOptions = LayoutOptions.Fill
            });

            ContactLayout = new StackLayout();

            lblContact = new Label
            {
                Text = "Contactpersonen",
                TextColor = Color.Black,
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };

            btnListContacts = new Button
            {
                Text = "Contactpersonen"
            };

            ContactLayout.Children.Add(lblContact);
            ContactLayout.Children.Add(new BoxView
            {
                Color = Color.FromHex("ddd"),
                HeightRequest = 1,
                VerticalOptions = LayoutOptions.Fill
            });
            ContactLayout.Children.Add(btnListContacts);
            ContactLayout.Children.Add(new BoxView
            {
                Color = Color.FromHex("ddd"),
                HeightRequest = 1,
                VerticalOptions = LayoutOptions.Fill
            });

            articleLayout = new StackLayout();

            lblSoldArticle = new Label
            {
                Text = "Gekochte Artikels",
                TextColor = Color.Black,
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };

            btnListSoldArticles = new Button
            {
                Text = "Gekochte Artikels"
            };

            articleLayout.Children.Add(lblSoldArticle);
            articleLayout.Children.Add(new BoxView
            {
                Color = Color.FromHex("ddd"),
                HeightRequest = 1,
                VerticalOptions = LayoutOptions.Fill
            });
            articleLayout.Children.Add(btnListSoldArticles);
            articleLayout.Children.Add(new BoxView
            {
                Color = Color.FromHex("ddd"),
                HeightRequest = 1,
                VerticalOptions = LayoutOptions.Fill
            });

            reportLayout = new StackLayout();

            lblReport = new Label
            {
                Text = "Verslag",
                TextColor = Color.Black,
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };
            btnAddReport = new Button
            {
                Text = "voeg verslag toe"
            };

            reportLayout.Children.Add(lblReport);
            reportLayout.Children.Add(new BoxView
            {
                Color = Color.FromHex("ddd"),
                HeightRequest = 1,
                VerticalOptions = LayoutOptions.Fill
            });
            reportLayout.Children.Add(btnAddReport);
            reportLayout.Children.Add(new BoxView
            {
                Color = Color.FromHex("ddd"),
                HeightRequest = 1,
                VerticalOptions = LayoutOptions.Fill
            });

            previousLayout = new StackLayout();

            lblPrevious = new Label
            {
                Text = "Vorige Contact momenten",
                TextColor = Color.Black,
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };

            btnListPreviousContact = new Button
            {
                Text = "Vorige Contact"
            };

            previousLayout.Children.Add(lblPrevious);
            previousLayout.Children.Add(new BoxView
            {
                Color = Color.FromHex("ddd"),
                HeightRequest = 1,
                VerticalOptions = LayoutOptions.Fill
            });
            previousLayout.Children.Add(btnListPreviousContact);
            previousLayout.Children.Add(new BoxView
            {
                Color = Color.FromHex("ddd"),
                HeightRequest = 1,
                VerticalOptions = LayoutOptions.Fill
            });

            achievementLayout = new StackLayout();

            lblAchievement = new Label
            {
                Text = "Prestatie",
                TextColor = Color.Black,
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };

            timeLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
            };

            lblDuration = new Label
            {
                Text = "Duur: ",
                TextColor = Color.Black
            };

            lblMinutes = new Label
            {
                Text = prestatielijst[0].Duur + " minuten",
                TextColor = Color.Black
            };

            timeLayout.Children.Add(lblDuration);
            timeLayout.Children.Add(lblMinutes);

            achievementsortLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal
            };

            lblSort = new Label
            {
                Text = "soort: ",
                TextColor = Color.Black,
            };

            pckAchievementsort = new Picker
            {
                Title = "Prestatiesoort",
                VerticalOptions = LayoutOptions.CenterAndExpand,
            };

            foreach (Prestatiesoort actType in DataController.Instance.GetAchievementtypes().OrderBy(t => t.ID))
            {
                pckAchievementsort.Items.Add(actType.Omschrijving);
            }

            btnAddPerformance = new Button
            {
                Text = "Voeg Prestatie toe"
            };

            btnshowListPerformances = new Button
            {
                Text = "lijst presatie's"
            };

            achievementsortLayout.Children.Add(lblSort);
            achievementsortLayout.Children.Add(pckAchievementsort);

            achievementLayout.Children.Add(lblAchievement);
            achievementLayout.Children.Add(new BoxView
            {
                Color = Color.FromHex("ddd"),
                HeightRequest = 1,
                VerticalOptions = LayoutOptions.Fill
            });
            achievementLayout.Children.Add(timeLayout);
            achievementLayout.Children.Add(achievementsortLayout);
            achievementLayout.Children.Add(btnAddPerformance);
            achievementLayout.Children.Add(btnshowListPerformances);
            achievementLayout.Children.Add(new BoxView
            {
                Color = Color.FromHex("ddd"),
                HeightRequest = 1,
                VerticalOptions = LayoutOptions.Fill
            });

            finishedLayout = new StackLayout();

            lblFinished = new Label
            {
                Text = "Afgewerkt",
                TextColor = Color.Black,
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };

            isFinished = new Switch
            {
                IsToggled = (bool)opdracht.Afgewerkt
            };

            finishedLayout.Children.Add(lblFinished);
            finishedLayout.Children.Add(new BoxView
            {
                Color = Color.FromHex("ddd"),
                HeightRequest = 1,
                VerticalOptions = LayoutOptions.Fill
            });
            finishedLayout.Children.Add(isFinished);
            finishedLayout.Children.Add(new BoxView
            {
                Color = Color.FromHex("ddd"),
                HeightRequest = 1,
                VerticalOptions = LayoutOptions.Fill
            });

            btnSendAppointment = new Button
            {
                Text = "Verzend afspraak"
            };

            layout.Children.Add(generalInfoLayout);
            layout.Children.Add(ContactLayout);
            layout.Children.Add(articleLayout);
            layout.Children.Add(previousLayout);
            layout.Children.Add(reportLayout);
            layout.Children.Add(achievementLayout);
            layout.Children.Add(finishedLayout);
            layout.Children.Add(btnSendAppointment);

            btnAddReport.Clicked += (object sender, EventArgs e) => {
                Navigation.PushAsync(new ReportPage(DataController.Instance.GetAchievementsFromAssessment(opdracht)[0]));
            };

            btnListSoldArticles.Clicked += (object sender, EventArgs e) => {
                Navigation.PushAsync(new ListSoldProducts(opdracht));
            };

            btnListContacts.Clicked += (object sender, EventArgs e) => {
                Navigation.PushAsync(new ListContacts(DataController.Instance.GetAllContactsFromACompany(DataController.Instance.GetCompanyFromAssessment(opdracht).ID)));
            };

            btnSendAppointment.Clicked += (object sender, EventArgs e) => {
                if (isFinished.IsToggled == true)
                {
                    opdracht.Afgewerkt = true;
                    opdracht.Statuslabel = "Afgewerkt";

                    DataController.Instance.Update(opdracht);
                    SyncController.Instance.SyncNeeded();
                    Navigation.PopAsync();
                }
                else
                {
                    DisplayAlert("Error", "Gelieve het product afgewerkt aan te vinken", "Ok");
                }
            };

            btnListPreviousContact.Clicked += (object sender, EventArgs e) => {
                Navigation.PushAsync(new ListPreviousContact(opdracht, DataController.Instance.GetCompanyFromAssessment(opdracht).Naam));
            };

            btnAddPerformance.Clicked += (object sender, EventArgs e) => {
                int prestatieid = 0;

                if (pckAchievementsort.SelectedIndex != -1)
                {
                    switch (pckAchievementsort.Items[pckAchievementsort.SelectedIndex])
                    {
                        case "Herstelling":
                            prestatieid = 1;
                            break;
                        case "Verkoop":
                            prestatieid = 2;
                            break;
                        case "Onderhoud":
                            prestatieid = 0;
                            break;
                    }

                    List<PrestatiesPrestatiesoorten> lijstprestatiesoorten = DataController.Instance.GetAchievementsAchievementTypeByIDs(prestatielijst[0].ID, prestatieid);

                    if (lijstprestatiesoorten.Count == 0)
                    {
                        PrestatiesPrestatiesoorten pres = new PrestatiesPrestatiesoorten
                        {
                            PrestatieID = prestatielijst[0].ID,
                            PrestatieSoortID = prestatieid
                        };

                        DependencyService.Get<IToastNotificator>().Notify(
                            ToastNotificationType.Success,
                            "Prestatie ",
                            "Presatie wordt toegevoegd",
                            TimeSpan.FromSeconds(3));

                        DataController.Instance.Insert(pres);
                        SyncController.Instance.SyncNeeded();
                    }
                    else
                    {
                        DisplayAlert("Error", "Opdracht is al toegevoegd", "Ok");
                    }

                }
                else
                {
                    DisplayAlert("Error", "Gelieve een prestatiesoort te selcteren", "Ok");
                };
            };

            btnshowListPerformances.Clicked += (object sender, EventArgs e) => {
                Navigation.PushAsync(new ListPrestaties(prestatielijst[0].ID));
            };
        }
예제 #9
0
        public IconLabelView(Opdracht opdracht, FileImageSource source, String text)
        {
            adressen = DataController.Instance.GetAddresses();
            presatielijst = DataController.Instance.GetAchievements();
            gemeentes = DataController.Instance.GetCitys();
            adrestText = adressen[opdracht.Adres].Straat + " " + adressen[opdracht.Adres].Nummer + ", " + gemeentes[adressen[opdracht.Adres].Gemeente].Postcode + " " + gemeentes[adressen[opdracht.Adres].Gemeente].Plaats;
            BackgroundColor = StyleKit.CardFooterBackgroundColor;

            img = new Image()
            {
                Source = source,
                HeightRequest = 10,
                WidthRequest = 10
            };

            var label = new Label()
            {
                Text = text,
                FontSize = 9,
                FontAttributes = FontAttributes.Bold,
                TextColor = StyleKit.LightTextColor
            };

            var tapGestureRecognizer = new TapGestureRecognizer();
            tapGestureRecognizer.Tapped += (sender, e) => {

                if (label.Text == "Navigeer")
                {
                    label.Text = "geklikt";
                    Geocode geo = new Geocode();
                    geo.Latitude = opdracht.Latitude;
                    geo.Longitude = opdracht.Longitude;

                    Place place = new Place();

                    if (Device.OS == TargetPlatform.iOS)
                    {
                        place.Name = adrestText;
                        place.Vicinity = "Brugge";
                    }
                    else
                    {
                        place.Name = "Brugge";
                        place.Vicinity = adrestText;
                    }
                    place.Location = geo;

                    LaunchMapApp(place);

                }
                else if (label.Text == "Start")
                {
                    label.Text = "Stop";
                    opdracht.Statuslabel = "Stop";
                    img.Source = StyleKit.Icons.Stop;
                    opdracht.starttijd = DateTime.Now;
                    DataController.Instance.Update(opdracht);
                    SyncController.Instance.SyncNeeded();

                    bool found = false;
                    foreach (Prestatie pres in presatielijst)
                    {
                        if (pres.OpdrachtID == opdracht.ID)
                        {
                            found = true;
                        }
                    }

                    if (!found)
                    {
                        Prestatie presatie = new Prestatie();
                        presatie.Aanvang = DateTime.Now;
                        presatie.Duur = 0;
                        presatie.OpdrachtID = opdracht.ID;
                        DataController.Instance.Insert(presatie);
                        SyncController.Instance.SyncNeeded();
                    }

                }
                else if (label.Text == "Stop")
                {
                    label.Text = "Start";
                    opdracht.Statuslabel = "Start";
                    img.Source = StyleKit.Icons.Resume;
                    Debug.WriteLine("gevonden tijd: " + opdracht.starttijd);
                    start = opdracht.starttijd.Value.TimeOfDay;
                    DataController.Instance.Update(opdracht);
                    SyncController.Instance.SyncNeeded();
                    einde = DateTime.Now.TimeOfDay;
                    TimeSpan tijd = CalculateTime();

                    foreach (Prestatie pres in presatielijst)
                    {
                        if (pres.OpdrachtID == opdracht.ID)
                        {
                            pres.Duur = pres.Duur + Convert.ToDecimal(tijd.TotalMinutes);
                            DataController.Instance.Update(pres);
                            SyncController.Instance.SyncNeeded();
                        }
                    }
                }
            };

            label.GestureRecognizers.Add(tapGestureRecognizer);

            //TO-DO: latitude & longitude in een navigeerknop.
            //opdracht.Latitude, opdracht.Longitude

            var stack = new StackLayout()
            {
                Padding = new Thickness(5),
                Orientation = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions = LayoutOptions.Center,
                Children = {
                    img,label
                }
            };

            Content = stack;
        }
예제 #10
0
 public List<Prestatie> GetAchievementsFromAssessment(Opdracht assessment)
 {
     return GetAchievements().Where(t => t.OpdrachtID == assessment.ID).ToList();
 }
예제 #11
0
 public List<Verbruiksartikel> GetUsedArticlesByAssignment(Opdracht opdracht)
 {
     return GetUsedArticles().Where(t => t.OpdrachtID == opdracht.ID).ToList();
 }
예제 #12
0
 public Bedrijf GetCompanyFromAssessment(Opdracht assesment)
 {
     var companys = GetCompanys().Where(t => assesment.BedrijfID == t.ID).ToList();
     if (companys.Count > 0)
         return companys[0];
     else
         return _nullObjects.Bedrijf();
 }
        public AssessmentDetailPage(Opdracht opdracht)
        {
            contactpersoon = DataController.Instance.GetPersons()
            [
                DataController.Instance.GetCompanyPersons().Where(t => t.BedrijfID == opdracht.BedrijfID).ToList().Count > 0 ?
                    DataController.Instance.GetCompanyPersons().Where(t => t.BedrijfID == opdracht.BedrijfID).ToList()[0].PersoonID -1 :
                    0
            ];
            formattedAddress = DataController.Instance.FormattedAddress(opdracht.Adres);
            prestatielijst = DataController.Instance.GetAchievementsFromAssessment (opdracht);

            if (prestatielijst.Count == 0) {
                Prestatie presatie = new Prestatie();
                presatie.Aanvang = DateTime.Now;
                presatie.Duur = 0;
                presatie.OpdrachtID = opdracht.ID;
                DataController.Instance.Insert(presatie);
                SyncController.Instance.SyncNeeded();
                prestatielijst.Add (presatie);
            }

            Title = "Opdracht: " + opdracht.ID;
            Padding = new Thickness (10, 10, 10, 10);
            scanner = DependencyService.Get<IScanner> ();

            BackgroundColor = Color.White;
            generalTermsLayout = new StackLayout ();
            articleLayout = new StackLayout ();
            reportLayout = new StackLayout ();

            lblGeneralTerms = new Label {
                Text = "Algemene info",
                TextColor = Color.Black,
                FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };

            lblCustommerName = new Label {
                Text = "Naam: "+ DataController.Instance.GetCompanys()[opdracht.BedrijfID].Naam,
                TextColor = Color.Black
            };

            lblDescription = new Label {
                Text = "Omschrijving: "+opdracht.Omschrijving,
                TextColor = Color.Black
            };
            lblAddress = new Label{
                Text = "Adres: " + formattedAddress,
                TextColor = Color.Black
            };

            phoneLayout = new StackLayout {
                Orientation = StackOrientation.Horizontal
            };

            lblPhone = new Label {
                Text = "Telefoon: ",
                TextColor = Color.Black
            };

            lblPhoneNumber = new Label {
                Text = contactpersoon.TelefoonWerk,
                TextColor = Color.Blue
            };

            var tapGestureRecognizer = new TapGestureRecognizer();
            tapGestureRecognizer.Tapped += (s, e) => {
                var dialer = DependencyService.Get<IDialer> ();
                if (dialer != null && contactpersoon.TelefoonWerk != null || contactpersoon.TelefoonWerk!= "") {
                    dialer.Dial (contactpersoon.TelefoonWerk);
                }
            };
            lblPhoneNumber.GestureRecognizers.Add(tapGestureRecognizer);

            phoneLayout.Children.Add (lblPhone);
            phoneLayout.Children.Add (lblPhoneNumber);

            generalTermsLayout.Children.Add (lblGeneralTerms);
            generalTermsLayout.Children.Add (new BoxView{
                Color = Color.FromHex ("ddd"),
                HeightRequest=1,
                VerticalOptions = LayoutOptions.Fill
            });
            generalTermsLayout.Children.Add (lblCustommerName);
            generalTermsLayout.Children.Add (lblDescription);
            generalTermsLayout.Children.Add (lblAddress);
            generalTermsLayout.Children.Add (phoneLayout);
            generalTermsLayout.Children.Add (new BoxView{
                Color = Color.FromHex ("ddd"),
                HeightRequest=1,
                VerticalOptions = LayoutOptions.Fill
            });

            achievementLayout = new StackLayout ();

            lblAchievement = new Label{
                Text = "Prestatie",
                TextColor = Color.Black,
                FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };

            timeLayout = new StackLayout {
                Orientation = StackOrientation.Horizontal,
            };

            lblDuration = new Label {
                Text = "Totale Duur: ",
                TextColor = Color.Black
            };

            lblMinutes = new Label {
                Text = prestatielijst[0].Duur + " minuten",
                TextColor = Color.Black
            };

            btnAddPerformance = new Button
            {
                Text = "Voeg Prestatie toe"
            };

            btnshowListPerformances = new Button
            {
                Text = "lijst presatie's"
            };

            timeLayout.Children.Add (lblDuration);
            timeLayout.Children.Add (lblMinutes);

            achievementsortLayout = new StackLayout {
                Orientation = StackOrientation.Horizontal
            };

            lblSort = new Label{
                Text="soort: ",
                TextColor = Color.Black,
            };

            pckAchievementsort = new Picker
            {
                Title = "Prestatiesoort",
                VerticalOptions = LayoutOptions.CenterAndExpand,
            };

            foreach (Prestatiesoort actType in DataController.Instance.GetAchievementtypes().OrderBy(t=>t.ID))
            {
                pckAchievementsort.Items.Add(actType.Omschrijving);
            }

            achievementsortLayout.Children.Add (lblSort);
            achievementsortLayout.Children.Add (pckAchievementsort);

            achievementLayout.Children.Add (lblAchievement);
            achievementLayout.Children.Add (new BoxView{
                Color = Color.FromHex ("ddd"),
                HeightRequest=1,
                VerticalOptions = LayoutOptions.Fill
            });
            achievementLayout.Children.Add (timeLayout);
            achievementLayout.Children.Add (achievementsortLayout);
            achievementLayout.Children.Add(btnAddPerformance);
            achievementLayout.Children.Add(btnshowListPerformances);
            achievementLayout.Children.Add (new BoxView{
                Color = Color.FromHex ("ddd"),
                HeightRequest=1,
                VerticalOptions = LayoutOptions.Fill
            });

            lblArticle = new Label {
                Text = "Artikel",
                TextColor = Color.Black,
                FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };

            articlesButtonLayout = new StackLayout {
                Orientation = StackOrientation.Horizontal
            };
            btnAddProduct = new Button {
                Text = "voeg product toe"
            };

            if (opdracht.Afgewerkt == true) {
                btnAddProduct.IsEnabled = false;
            };

            btnShowArticles = new Button {
                Text = "verbruikte producten"
            };
            articlesButtonLayout.Children.Add (btnAddProduct);
            articlesButtonLayout.Children.Add (btnShowArticles);

            articleLayout.Children.Add (lblArticle);
            articleLayout.Children.Add (new BoxView{
                Color = Color.FromHex ("ddd"),
                HeightRequest=1,
                VerticalOptions = LayoutOptions.Fill
            });
            articleLayout.Children.Add (articlesButtonLayout);
            articleLayout.Children.Add (new BoxView{
                Color = Color.FromHex ("ddd"),
                HeightRequest=1,
                VerticalOptions = LayoutOptions.Fill
            });

            lblReport = new Label {
                Text = "Verslag",
                TextColor = Color.Black,
                FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };
            btnAddReport = new Button {
                Text = "voeg verslag toe"
            };

            reportLayout.Children.Add (lblReport);
            reportLayout.Children.Add (new BoxView{
                Color = Color.FromHex ("ddd"),
                HeightRequest=1,
                VerticalOptions = LayoutOptions.Fill
            });
            reportLayout.Children.Add (btnAddReport);
            reportLayout.Children.Add (new BoxView{
                Color = Color.FromHex ("ddd"),
                HeightRequest=1,
                VerticalOptions = LayoutOptions.Fill
            });

            finishedLayout = new StackLayout ();

            lblFinished = new Label {
                Text = "Afgewerkt",
                TextColor = Color.Black,
                FontSize = Device.GetNamedSize (NamedSize.Large, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };

            isFinished = new Switch {
                IsToggled =  (bool) opdracht.Afgewerkt
            };

            finishedLayout.Children.Add (lblFinished);
            finishedLayout.Children.Add (new BoxView{
                Color = Color.FromHex ("ddd"),
                HeightRequest=1,
                VerticalOptions = LayoutOptions.Fill
            });
            finishedLayout.Children.Add (isFinished);
            finishedLayout.Children.Add (new BoxView{
                Color = Color.FromHex ("ddd"),
                HeightRequest=1,
                VerticalOptions = LayoutOptions.Fill
            });

            btnSendAssesment = new Button {
                Text="Verzend opdracht"
            };

            btnAddProduct.Clicked += async (object sender, EventArgs e) => {
                var foundScan =  await scanner.Scan();
                System.Diagnostics.Debug.WriteLine("gevonden: " +foundScan.Text);

                if(foundScan.Text !="")
                {

                string[] foundScanString = foundScan.Text.Split('/');
                System.Diagnostics.Debug.WriteLine("deel 1: " +foundScanString[0]);
                System.Diagnostics.Debug.WriteLine("deel 2: " +foundScanString[1]);

                foreach(Artikel art in DataController.Instance.GetArticles()){
                    if(art.Barcode == foundScanString[0])
                    {

                        System.Diagnostics.Debug.WriteLine("juiste artikel ingescand :D :" + art.Omschrijving);
                        nameArticle = art.Omschrijving;
                        bool found = false;
                        foreach(Verbruiksartikel usedArticle in DataController.Instance.GetUsedArticles())
                        {
                            if(usedArticle.ArtikelID == art.ID && usedArticle.OpdrachtID == opdracht.ID)
                            {
                                found = true;
                                usedArticle.Gebruikt++;
                                DataController.Instance.Update(usedArticle);
                                SyncController.Instance.SyncNeeded();
                            }
                        }

                        if (!found) {
                            Verbruiksartikel usedArt = new Verbruiksartikel ();
                            usedArt.ArtikelID = art.ID;
                            usedArt.Gebruikt = 1;
                            usedArt.OpdrachtID = opdracht.ID;
                            DataController.Instance.Insert(usedArt);
                            SyncController.Instance.SyncNeeded();
                            }

                        //toevoegen aangekocht product
                        VerkochtArtikel sold = new VerkochtArtikel();
                        sold.Artikel = art.ID;
                        sold.Bedrijf = DataController.Instance.GetCompanys()[opdracht.BedrijfID].ID;
                        sold.Serienummer = foundScanString[1];
                        sold.Datum = DateTime.Today;
                        DataController.Instance.Insert(sold);
                        SyncController.Instance.SyncNeeded();

                        foreach (Ligplaats place in DataController.Instance.GetStockplaces())
                        {
                            if(place.VerantwoordelijkeLigplaatsID == LoginController.Instance.GetCurrentUser.ID)
                            {
                                foreach(VerbruikLigplaats usedPlace in DataController.Instance.GetUsedArticlesByStockPlace(place))
                                {
                                    if(place.ID == usedPlace.LigplaatsID && art.ID == usedPlace.ArtikelID)
                                    {
                                        usedPlace.AantalStock--;
                                        DataController.Instance.Update(usedPlace);
                                        SyncController.Instance.SyncNeeded();
                                    }
                                }
                            }
                        }
                    }
                }

                    DependencyService.Get<IToastNotificator>().Notify(
                        ToastNotificationType.Success,
                        "Product gescand",
                        nameArticle+" wordt toegevoegd",
                        TimeSpan.FromSeconds(3));

                }

            };

            btnShowArticles.Clicked += (object sender, EventArgs e) => {
                Navigation.PushAsync(new ListSoldArticles(opdracht));
            };

            btnAddReport.Clicked += (object sender, EventArgs e) => {
                Navigation.PushAsync(new ReportPage(prestatielijst[0]));
            };

            btnAddPerformance.Clicked += (object sender, EventArgs e) => {
                int prestatieid = 0;

                if (pckAchievementsort.SelectedIndex != -1)
                {
                    switch (pckAchievementsort.Items[pckAchievementsort.SelectedIndex])
                    {
                        case "Herstelling":
                            prestatieid = 1;
                            break;
                        case "Verkoop":
                            prestatieid = 2;
                            break;
                        case "Onderhoud":
                            prestatieid = 0;
                            break;
                    }

                    List<PrestatiesPrestatiesoorten> lijstprestatiesoorten = DataController.Instance.GetAchievementsAchievementTypeByIDs(prestatielijst[0].ID, prestatieid);

                    if (lijstprestatiesoorten.Count == 0)
                    {
                        PrestatiesPrestatiesoorten pres = new PrestatiesPrestatiesoorten
                        {
                            PrestatieID = prestatielijst[0].ID,
                            PrestatieSoortID = prestatieid
                        };

                        DependencyService.Get<IToastNotificator>().Notify(
                            ToastNotificationType.Success,
                            "Prestatie ",
                            "Presatie wordt toegevoegd",
                            TimeSpan.FromSeconds(3));

                        DataController.Instance.Insert(pres);
                        SyncController.Instance.SyncNeeded();
                    }
                    else
                    {
                        DisplayAlert("Error", "Opdracht is al toegevoegd", "Ok");
                    }
                }
                else
                {
                    DisplayAlert("Error", "Gelieve een prestatiesoort te selcteren", "Ok");
                };

            };

            btnshowListPerformances.Clicked += (object sender, EventArgs e) => {
                Navigation.PushAsync(new ListPrestaties(prestatielijst[0].ID));
            };

            btnSendAssesment.Clicked += (object sender, EventArgs e) => {
                if (isFinished.IsToggled == true)
                {
                    opdracht.Afgewerkt = true;
                    opdracht.Statuslabel = "Afgewerkt";

                    DataController.Instance.Update(opdracht);
                    SyncController.Instance.SyncNeeded();
                    Navigation.PopAsync ();
                }else{
                    DisplayAlert("Error", "Gelieve product afgewerkt aan te vinken", "Ok");
                }
            };
        }