Esempio n. 1
0
 private void SetBorder(ExtendedPicker view)
 {
     if (!view.HasBorder)
     {
         Control.SetBackgroundColor(global::Android.Graphics.Color.Transparent);
     }
 }
Esempio n. 2
0
 private void SetFont(ExtendedPicker view)
 {
     if (view.Font != Font.Default)
     {
         Control.TextSize = (float)view.Font.FontSize;
         var font = Typeface.CreateFromAsset(Forms.Context.ApplicationContext.Assets, view.Font.FontFamily + ".ttf");
         Control.Typeface = font;
     }
 }
        public App()
        {
            var extenderPicker = new ExtendedPicker();

            extenderPicker.ItemsSource = new List <Color> {
                Color.Aqua, Color.Black
            };

            // The root page of your application
            MainPage = new ExtendedPickerPage();
        }
        private void SetFont(ExtendedPicker view)
        {
            UIFont uiFont;

            if (view.Font != Font.Default && (uiFont = view.Font.ToUIFont()) != null)
            {
                Control.Font = uiFont;
            }
            else if (view.Font == Font.Default)
            {
                Control.Font = UIFont.SystemFontOfSize(14f);
            }
        }
Esempio n. 5
0
        private void SetTextAlignment(ExtendedPicker view)
        {
            switch (view.XAlign)
            {
            case Xamarin.Forms.TextAlignment.Center:
                Control.Gravity = GravityFlags.CenterVertical;
                break;

            case Xamarin.Forms.TextAlignment.End:
                Control.Gravity = GravityFlags.End;
                break;

            case Xamarin.Forms.TextAlignment.Start:
                Control.Gravity = GravityFlags.Start;
                break;
            }
        }
        private void SetTextAlignment(ExtendedPicker view)
        {
            switch (view.XAlign)
            {
            case TextAlignment.Center:
                Control.TextAlignment = UITextAlignment.Center;
                break;

            case TextAlignment.End:
                Control.TextAlignment = UITextAlignment.Right;
                break;

            case TextAlignment.Start:
                Control.TextAlignment = UITextAlignment.Left;
                break;
            }
        }
Esempio n. 7
0
        public ExtendedPickerPage()
        {
            InitializeComponent();
            BindingContext = this;
            myPicker       = new ExtendedPicker()
            {
                DisplayProperty = "FirstName"
            };
            myPicker.SetBinding(ExtendedPicker.ItemsSourceProperty, new Binding("MyDataList", BindingMode.TwoWay));
            myPicker.SetBinding(ExtendedPicker.SelectedItemProperty, new Binding("TheChosenOne", BindingMode.TwoWay));
            myStackLayout.Children.Add(new Label {
                Text = "Code Created:"
            });
            myStackLayout.Children.Add(myPicker);


            TheChosenOne = new DataClass()
            {
                FirstName = "Jet", LastName = "Li"
            };
            MyDataList = new ObservableCollection <object> ()
            {
                new DataClass()
                {
                    FirstName = "Jack", LastName = "Doe"
                },
                TheChosenOne,
                new DataClass()
                {
                    FirstName = "Matt", LastName = "Bar"
                },
                new DataClass()
                {
                    FirstName = "Mic", LastName = "Jaggery"
                },
                new DataClass()
                {
                    FirstName = "Michael", LastName = "Jackon"
                }
            };
        }
Esempio n. 8
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            IsBusy = true;
            EnturnamientoBLL enturnamientoBLL = new EnturnamientoBLL();
            AgenciaBLL       agenciaBLL       = new AgenciaBLL();

            agencias = await enturnamientoBLL.ObtenerAgenciasEnturnamiento();

            var pickerPuestos = new ExtendedPicker()
            {
                DisplayProperty = "NombreAgencia"
            };

            pickerPuestos.ItemsSource = agencias.Where(d => d.EsAgencia).ToList();
            puestoExpedicion.Children.Add(pickerPuestos);

            //List<string> destinos = new List<string> { "NACIONAL", "BARRANQUILLA", "BOGOTÁ", "BUENAVENTURA", "CALI", "CARTAGENA", "MEDELLÍN" };
            var pickerDestinos = new ExtendedPicker()
            {
                DisplayProperty = "NombreAgencia"
            };

            pickerDestinos.ItemsSource = agencias.Where(d => d.EsDestino).ToList();
            destino.Children.Add(pickerDestinos);

            List <string> tipoTRailer = new List <string>()
            {
                "Carroceria", "Plancha", "Ambos"
            };

            rbTipoTRailer.ItemsSource = tipoTRailer;
            Util util = new Util();

            if (!util.UsuarioTienePermiso("enturnarplacasilimitadas"))
            {
                txtCedulaConductor.IsVisible = false;

                var pickerConductores = new ExtendedPicker()
                {
                    DisplayProperty = "Nombre"
                };
                List <Proveedor> listaConductores = await enturnamientoBLL.ObtenerConductoresTurnosPorUsuario();

                pickerConductores.ItemsSource           = listaConductores;
                pickerConductores.SelectedIndexChanged += (sender, args) =>
                {
                    string    conductor             = pickerConductores.Items[pickerConductores.SelectedIndex].ToString();
                    Proveedor conductorSeleccionado = (from p in listaConductores
                                                       where p.Nombre == conductor
                                                       select p).FirstOrDefault();
                    if (conductorSeleccionado != null)
                    {
                        _turnoSeleccionado.NombreConductor    = conductorSeleccionado.Nombre;
                        _turnoSeleccionado.NumeroDocConductor = conductorSeleccionado.NumIdentificacionFiscal;
                    }
                };
                if (_turnoSeleccionado != null)
                {
                    //Se está modificando un turno

                    if (!String.IsNullOrEmpty(_turnoSeleccionado.NumeroDocConductor))
                    {
                        var conductorActual = listaConductores.FirstOrDefault(c => c.NumIdentificacionFiscal.TrimStart('0') == _turnoSeleccionado.NumeroDocConductor.TrimStart('0'));
                        if (conductorActual != null)
                        {
                            pickerConductores.SelectedIndex = pickerConductores.Items.IndexOf(conductorActual.Nombre);
                        }
                    }
                }
                layoutConductor.Children.Add(pickerConductores);
            }
            else
            {
                txtCedulaConductor.IsVisible = false;


                List <Proveedor> proveedores             = new List <Proveedor>();
                List <string>    nombreConductores       = new List <string>();
                AutoCompleteView autocompleteConductores = new AutoCompleteView();
                autocompleteConductores.ShowSearchButton = false;

                autocompleteConductores.TextChanged += async(sender, args) =>
                {
                    if (String.IsNullOrEmpty(autocompleteConductores.Text))
                    {
                        autocompleteConductores.Suggestions = new List <string>();
                    }
                    else if (autocompleteConductores.Text.Length >= 4)
                    {
                        IsBusy      = true;
                        proveedores = await enturnamientoBLL.ObtenerConductoresPorNombre(autocompleteConductores.Text);

                        IsBusy            = false;
                        nombreConductores = (from p in proveedores
                                             select p.Nombre).DefaultIfEmpty().ToList();
                        autocompleteConductores.Suggestions = nombreConductores;
                    }
                };

                autocompleteConductores.SelectedItemChanged += (sender, args) =>
                {
                    Proveedor conductorSeleccionado = (from p in proveedores
                                                       where p.Nombre == autocompleteConductores.Text
                                                       select p).FirstOrDefault();
                    if (conductorSeleccionado != null)
                    {
                        txtCedulaConductor.Text               = conductorSeleccionado.NumIdentificacionFiscal;
                        _turnoSeleccionado.NombreConductor    = conductorSeleccionado.Nombre;
                        _turnoSeleccionado.NumeroDocConductor = conductorSeleccionado.NumIdentificacionFiscal;
                    }
                };
                layoutConductor.Children.Add(autocompleteConductores);
            }
            if (_turnoSeleccionado != null)
            {
                //Si están modificando un turno
                var codigoPuestoExpedicion = _turnoSeleccionado.PuestoExpedicion;
                var PuestoExpedicion       = (from a in agencias
                                              where a.CodigoAgencia == _turnoSeleccionado.PuestoExpedicion
                                              select a).FirstOrDefault();

                if (PuestoExpedicion != null)
                {
                    pickerPuestos.SelectedIndex = pickerPuestos.Items.IndexOf(PuestoExpedicion.NombreAgencia);
                    pickerPuestos.IsEnabled     = false;
                }

                txtPlacaCabezote.Text   = _turnoSeleccionado.PlacaCabezote;
                txtPlacaTrailer.Text    = _turnoSeleccionado.PlacaTrailer;
                lblTipoTrailer.Text     = _turnoSeleccionado.TipoTrailer;
                txtCedulaConductor.Text = _turnoSeleccionado.NumeroDocConductor;

                if (_turnoSeleccionado.PlacaCabezote.Length > 0)
                {
                    txtPlacaCabezote.IsEnabled = false;
                }

                if (String.IsNullOrEmpty(_turnoSeleccionado.Destino))
                {
                    pickerDestinos.SelectedIndex = pickerDestinos.Items.IndexOf("Nacional");
                }
                else
                {
                    pickerDestinos.SelectedIndex = pickerDestinos.Items.IndexOf(_turnoSeleccionado.Destino);
                }

                if (_turnoSeleccionado.CodigoTipoTrailer == "13")
                {
                    rbTipoTRailer.IsVisible = true;
                }
            }
            else
            {
                //Si se está creando un turno
                _turnoSeleccionado = new Enturnamiento();


                cbDisponible.IsVisible = false;

                if (!util.UsuarioTienePermiso("enturnarplacasilimitadas"))
                {
                    txtPlacaCabezote.IsVisible = false;



                    List <Vehiculo> vehiculos = new List <Vehiculo>();
                    vehiculos = await enturnamientoBLL.ObtenerCabezotesTurnosPorUsuarioActual();

                    var pickerPlaca = new ExtendedPicker()
                    {
                        DisplayProperty = "Placa"
                    };
                    pickerPlaca.ItemsSource = vehiculos;
                    placaCabezote.Children.Add(pickerPlaca);
                    pickerPlaca.SelectedIndexChanged += (sender, args) =>
                    {
                        string placa = pickerPlaca.Items[pickerPlaca.SelectedIndex].ToString();
                        if (!string.IsNullOrEmpty(placa))
                        {
                            _turnoSeleccionado.PlacaCabezote = placa;
                        }
                    };
                }
            }

            //Se agregan los botones de guardar y cancelar
            Button btnGuardar = new Button();

            btnGuardar.Text     = "Guardar";
            btnGuardar.Clicked += Btn_Clicked;
            layoutBotones.Children.Add(btnGuardar);

            Button btn = new Button();

            btn.Text     = "Cancelar";
            btn.Clicked += Btn_Clicked;
            layoutBotones.Children.Add(btn);

            pickerPuestos.SelectedIndexChanged += (sender, args) =>
            {
                string  puesto             = pickerPuestos.Items[pickerPuestos.SelectedIndex].ToString();
                Agencia puestoSeleccionado = (from a in agencias
                                              where a.NombreAgencia == puesto
                                              select a).FirstOrDefault();
                if (puestoSeleccionado != null)
                {
                    _turnoSeleccionado.PuestoExpedicion = puestoSeleccionado.CodigoAgencia;
                }
            };
            pickerDestinos.SelectedIndexChanged += (sender, args) =>
            {
                string destino = pickerDestinos.Items[pickerDestinos.SelectedIndex].ToString();
                if (destino != "NACIONAL")
                {
                    destino = util.RemoveAccentsWithRegEx(destino);
                    _turnoSeleccionado.Destino = destino.ToUpper();
                }
                else
                {
                    _turnoSeleccionado.Destino = "";
                }
            };
            IsBusy = false;
        }
Esempio n. 9
0
        private View ContenidoTransferencia()
        {
            Label CambiarMetodo = new Label
            {
                BackgroundColor         = Color.Transparent,
                HorizontalTextAlignment = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                FontFamily = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null),
                TextColor  = Color.FromHex("BFBFBF"),
                FontSize   = (App.DisplayScreenWidth / 26.857142857142857),
                Text       = "Cambiar método de pago"
            };

            TapGestureRecognizer CambiarMetodoTAP = new TapGestureRecognizer {
                NumberOfTapsRequired = 1
            };

            CambiarMetodoTAP.Tapped += CambiarMetodoTAP_Tapped;
            CambiarMetodo.GestureRecognizers.Add(CambiarMetodoTAP);

            Button continuar = new Button
            {
                Margin            = 0,
                Text              = "CONTINUAR",
                TextColor         = Color.White,
                FontFamily        = Device.OnPlatform("Montserrat-Bold", "Montserrat-Bold", null),
                FontSize          = (App.DisplayScreenWidth / 25.066666666666667),
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                BackgroundColor   = Color.Transparent,
                WidthRequest      = (App.DisplayScreenHeight / 3.608888888888889),
                HeightRequest     = (App.DisplayScreenHeight / 20.3),
            };

            continuar.Clicked += Continuar_Clicked;

            Image continuarImage = new Image
            {
                Source            = "loginButton",
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                WidthRequest      = (App.DisplayScreenHeight / 3.608888888888889),
                HeightRequest     = (App.DisplayScreenHeight / 20.3),
            };

            Grid Continuar = new Grid
            {
                Padding  = 0,
                Children =
                {
                    continuarImage,
                    continuar
                }
            };

            ExtendedPicker Cuentas = new ExtendedPicker
            {
                XAlign     = TextAlignment.Center,
                TextColor  = Color.FromHex("4D4D4D"),
                FontFamily = Device.OnPlatform("Montserrat-Bold", "Montserrat-Bold", null),
                HasBorder  = false,
                Title      = "¿A qué área pertenece tu consulta?",
            };

            Cuentas.Items.Add("BI - 2345 - 0 - 5315");
            Cuentas.Items.Add("BANRURAL - 93872183921 - 0 - 12");
            Cuentas.Items.Add("G&T - 63635 - 05- 4");



            return(new ScrollView
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Content = new StackLayout
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    Spacing = 0,
                    Padding = new Thickness((App.DisplayScreenWidth / 9.060240963855422), 0),
                    Children =
                    {
                        new BoxView
                        {
                            HeightRequest = App.DisplayScreenWidth / 8.355555555555556,
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            BackgroundColor = Color.Transparent
                        },
                        new Label
                        {
                            BackgroundColor = Color.Transparent,
                            HorizontalTextAlignment = TextAlignment.Center,
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            FontFamily = Device.OnPlatform("Montserrat-Regular", "Montserrat-Regular", null),
                            TextColor = Color.FromHex("4D4D4D"),
                            FontSize = (App.DisplayScreenWidth / 26.857142857142857),
                            Text = "Selecciona la cuenta a debitar"
                        },
                        new BoxView
                        {
                            HeightRequest = App.DisplayScreenWidth / 17.090909090909091,
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            BackgroundColor = Color.Transparent
                        },
                        CambiarMetodo,
                        new BoxView
                        {
                            HeightRequest = App.DisplayScreenWidth / 9.894736842105263,
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            BackgroundColor = Color.Transparent
                        },
                        new StackLayout
                        {
                            Spacing = App.DisplayScreenWidth / 37.6,
                            Children =
                            {
                                new Grid
                                {
                                    Children =
                                    {
                                        Cuentas,
                                        new Image
                                        {
                                            Aspect = Aspect.Fill,
                                            HorizontalOptions = LayoutOptions.End,
                                            VerticalOptions = LayoutOptions.Center,
                                            WidthRequest = App.DisplayScreenWidth / 36.049856184084372,
                                            HeightRequest = App.DisplayScreenWidth / 25.066666666666667
                                        }
                                    }
                                },
                                new BoxView {
                                    BackgroundColor = Color.FromHex("4D4D4D"), HeightRequest = (App.DisplayScreenWidth / 341.818181818181818), HorizontalOptions = LayoutOptions.FillAndExpand
                                },
                            }
                        },
                        new BoxView
                        {
                            HeightRequest = App.DisplayScreenWidth / 9.894736842105263,
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            BackgroundColor = Color.Transparent
                        },
                        new Grid
                        {
                            BackgroundColor = Color.Transparent,
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            Padding = new Thickness(0, (App.DisplayScreenHeight / 20.3)),
                            Children =
                            {
                                Continuar
                            }
                        }
                    }
                }
            });
        }
Esempio n. 10
0
 private void SetBorder(ExtendedPicker view)
 {
     Control.BorderStyle = view.HasBorder ? UITextBorderStyle.RoundedRect : UITextBorderStyle.None;
 }
Esempio n. 11
0
        public EmpleadoPage(empleados empleado)
        {
            if (string.IsNullOrEmpty(empleado.firstName))
            {
                Title = "Nuevo empleado";
            }
            else
            {
                Title = "Edición de empleado";
            }
            try
            {
                puestos = App.Database.GetPuestos().ToList();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Write(ex.Message);
            }

            MessagingCenter.Subscribe <App>(this, "CargaInicialPuestos", (sender) =>
            {
                puestos = null;
                puestos = App.Database.GetPuestos().ToList();
                if (puestos.Count != 0)
                {
                    puesto.Items.Clear();
                    foreach (var puestoT in puestos)
                    {
                        puesto.Items.Add(puestoT.nombre);
                    }
                }
            });

            nombres = new ExtendedEntry
            {
                TextColor        = Color.FromHex("3F3F3F"),
                HasBorder        = false,
                Placeholder      = "Toca para ingresar",
                PlaceholderColor = Color.FromHex("B2B2B2"),
                XAlign           = TextAlignment.End,
                FontFamily       = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                FontSize         = 14,
            };
            nombres.Text = empleado.firstName;

            apellidos = new ExtendedEntry
            {
                TextColor        = Color.FromHex("3F3F3F"),
                HasBorder        = false,
                Placeholder      = "Toca para ingresar",
                PlaceholderColor = Color.FromHex("B2B2B2"),
                XAlign           = TextAlignment.End,
                FontFamily       = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                FontSize         = 14
            };
            apellidos.Text = empleado.lastName;

            genero = new ExtendedPicker
            {
                Title     = "Seleccione",
                TextColor = Color.FromHex("3F3F3F"),
                HasBorder = false,
                XAlign    = TextAlignment.End,
                Margin    = new Thickness(0, 0, 35, 0),
                Font      = Device.OnPlatform <Font>(Font.OfSize("OpenSans-Bold", 14), Font.OfSize("OpenSans-Bold", 14), Font.Default)
            };

            foreach (string generos in Constants.genero.Keys)
            {
                genero.Items.Add(generos);
            }

            IconView generoDropdown = new IconView
            {
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.End,
                Source            = "idropdown.png",
                WidthRequest      = 10,
                HeightRequest     = 10,
                Foreground        = Color.FromHex("373152")
            };

            Grid Genero = new Grid();

            Genero.Children.Add(genero);
            Genero.Children.Add(generoDropdown);
            genero.SelectedIndex = 0;

            puesto = new ExtendedPicker
            {
                Title     = "Seleccione",
                TextColor = Color.FromHex("3F3F3F"),
                HasBorder = false,
                XAlign    = TextAlignment.End,
                Margin    = new Thickness(0, 0, 35, 0),
                Font      = Device.OnPlatform <Font>(Font.OfSize("OpenSans-Bold", 14), Font.OfSize("OpenSans-Bold", 14), Font.Default)
            };
            puesto.Items.Add("Información no disponible");
            if (puestos.Count != 0)
            {
                puesto.Items.Clear();
                foreach (var puestosT in puestos)
                {
                    puesto.Items.Add(puestosT.nombre);
                }
            }
            puesto.Focused      += Puesto_Focused;;
            genero.SelectedIndex = 0;

            IconView puestoDropdown = new IconView
            {
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.End,
                Source            = "idropdown.png",
                WidthRequest      = 10,
                HeightRequest     = 10,
                Foreground        = Color.FromHex("373152")
            };

            Grid Puesto = new Grid();

            Puesto.Children.Add(puesto);
            Puesto.Children.Add(puestoDropdown);
            if (!string.IsNullOrEmpty(empleado.email))
            {
                puesto.SelectedIndex = 5;
            }
            else
            {
                puesto.SelectedIndex = -1;
            }

            Grid generoPuesto = new Grid
            {
                RowSpacing     = 0,
                ColumnSpacing  = 15,
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(5, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(5, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            generoPuesto.Children.Add(new Label
            {
                Text           = "PUESTO:",
                FontSize       = 13,
                TextColor      = Color.FromHex("373152"),
                FontAttributes = FontAttributes.Bold,
                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
            }, 0, 0);
            generoPuesto.Children.Add(new Label
            {
                Text           = "GÉNERO:",
                FontSize       = 13,
                TextColor      = Color.FromHex("373152"),
                FontAttributes = FontAttributes.Bold,
                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
            }, 1, 0);
            generoPuesto.Children.Add(Puesto, 0, 2);
            generoPuesto.Children.Add(Genero, 1, 2);
            generoPuesto.Children.Add(
                new BoxView {
                BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
            }
                , 0, 4);
            generoPuesto.Children.Add(
                new BoxView {
                BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
            }
                , 1, 4);



            correo = new ExtendedEntry
            {
                Placeholder      = "Toca para ingresar",
                PlaceholderColor = Color.FromHex("B2B2B2"),
                TextColor        = Color.FromHex("3F3F3F"),
                HasBorder        = false,
                Keyboard         = Keyboard.Email,
                XAlign           = TextAlignment.End,
                FontFamily       = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                FontSize         = 14
            };
            correo.Text = empleado.email;
            if (!string.IsNullOrEmpty(empleado.email))
            {
                correo.IsEnabled = false;
            }
            guardar = new Button
            {
                Text            = "REGISTRAR",
                FontSize        = 18,
                TextColor       = Color.White,
                FontAttributes  = FontAttributes.Bold,
                FontFamily      = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                VerticalOptions = LayoutOptions.Start,
                BackgroundColor = Color.FromHex("F7B819"),
                WidthRequest    = 128,
                HeightRequest   = 38,
            };
            guardar.Clicked += Guardar_Clicked;
            if (!string.IsNullOrEmpty(empleado.email))
            {
                guardar.Text = "ACTUALIZAR";
            }


            RelativeLayout gridBoton = new RelativeLayout
            {
                WidthRequest      = 130,
                HeightRequest     = 42,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.End,
            };

            gridBoton.Children.Add(
                new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView
            {
                BackgroundColor = Color.FromHex("B2B2B2"),
                CornerRadius    = 6,
                HeightRequest   = 40,
                WidthRequest    = 128,
            }, Constraint.Constant(2), Constraint.Constant(2));
            gridBoton.Children.Add(guardar, Constraint.Constant(0), Constraint.Constant(0));

            StackLayout advertencia = new StackLayout
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Spacing           = 0,
                Children          =
                {
                    new Label
                    {
                        HorizontalOptions = LayoutOptions.Center,
                        Text       = "Al tocar el botón REGISTRAR se enviarán los datos de acceso",
                        FontSize   = 11,
                        TextColor  = Color.FromHex("B2B2B2"),
                        FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                        HorizontalTextAlignment = TextAlignment.Center
                    },
                    new StackLayout
                    {
                        HorizontalOptions = LayoutOptions.Center,
                        Orientation       = StackOrientation.Horizontal,
                        Spacing           = 0,
                        Children          =
                        {
                            new Label
                            {
                                FontSize   = 11,
                                Text       = "al correo electrónico del empleado",
                                TextColor  = Color.FromHex("B2B2B2"),
                                FontFamily = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                            },
                        }
                    }
                }
            };

            StackLayout localizacion = new StackLayout
            {
                Padding         = new Thickness(15, 15, 15, 20),
                Spacing         = 15,
                BackgroundColor = Color.FromHex("E5E5E5"),
                Children        =
                {
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new Label
                            {
                                Text           = "NOMBRES:*",
                                FontSize       = 13,
                                TextColor      = Color.FromHex("373152"),
                                FontAttributes = FontAttributes.Bold,
                                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                            },
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    new Grid
                                    {
                                        Children =
                                        {
                                            nombres,
                                        }
                                    },
                                    new BoxView {
                                        BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
                                    },
                                    new BoxView {
                                        HeightRequest = 0
                                    }
                                }
                            }
                        }
                    },
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new Label
                            {
                                Text           = "APELLIDOS:*",
                                FontSize       = 13,
                                TextColor      = Color.FromHex("373152"),
                                FontAttributes = FontAttributes.Bold,
                                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                            },
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    new Grid
                                    {
                                        Children =
                                        {
                                            apellidos,
                                        }
                                    },
                                    new BoxView {
                                        BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
                                    },
                                    new BoxView {
                                        HeightRequest = 0
                                    }
                                }
                            }
                        }
                    },
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    generoPuesto,
                                }
                            }
                        }
                    },
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new Label
                            {
                                Text           = "CORREO ELECTRÓNICO:*",
                                FontSize       = 13,
                                TextColor      = Color.FromHex("373152"),
                                FontAttributes = FontAttributes.Bold,
                                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                            },
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    new Grid
                                    {
                                        Children =
                                        {
                                            correo
                                        }
                                    },
                                    new BoxView {
                                        BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
                                    },
                                    new BoxView {
                                        HeightRequest = 0
                                    }
                                }
                            }
                        }
                    },
                    new BoxView                 {
                        HeightRequest = 25
                    },
                    advertencia
                }
            };

            this.BackgroundColor = Color.White;

            contenidoCreacionEdicion = new ScrollView
            {
                Padding = 0,
                Content = new StackLayout
                {
                    Spacing  = 0,
                    Children =
                    {
                        localizacion,
                        new BoxView {
                            VerticalOptions = LayoutOptions.FillAndExpand,BackgroundColor                                       = Color.FromHex("B3B3B3"), HeightRequest = 4
                        },
                    }
                }
            };


            contenido2       = new RelativeLayout();
            headerBackground = new Image()
            {
                Source = "headerRegistro.png",
                Aspect = Aspect.AspectFill
            };

            IconView cerrar = new IconView
            {
                Margin            = new Thickness(0, 0, 10, 0),
                HorizontalOptions = LayoutOptions.End,
                Source            = Images.Cancelar,
                Foreground        = Color.FromHex("E9242A"),
                WidthRequest      = 15,
                HeightRequest     = 15
            };
            TapGestureRecognizer cerrarTAP = new TapGestureRecognizer();

            cerrarTAP.Tapped += async(sender, e) =>
            {
                bool accion = await DisplayAlert("", "¿Desea cerrar sin guardar los cambios?", "Cerrar", "Cancelar");

                if (accion)
                {
                    await Navigation.PopAsync();
                }
            };
            cerrar.GestureRecognizers.Add(cerrarTAP);
            EdicionCreacion = new StackLayout
            {
                Padding  = new Thickness(0, 5, 0, 15),
                Spacing  = 15,
                Children = { contenidoCreacionEdicion, gridBoton }
            };

            botonCerrar = new Grid
            {
                HeightRequest = 35,
                WidthRequest  = 80,
                Children      =
                {
                    new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView
                    {
                        BackgroundColor = Color.White,
                        CornerRadius    = 6
                    },
                    cerrar
                }
            };
            botonCerrar.GestureRecognizers.Add(cerrarTAP);


            contenido2.Children.Add(headerBackground,
                                    xConstraint: Constraint.Constant(0),
                                    yConstraint: Constraint.Constant(0),
                                    widthConstraint: Constraint.RelativeToParent((parent) => { return(parent.Width); }),
                                    heightConstraint: Constraint.Constant(120)
                                    );

            contenido2.Children.Add(botonCerrar,
                                    xConstraint: Constraint.Constant(-15),
                                    yConstraint: Constraint.Constant(20)
                                    );

            contenido2.Children.Add(
                EdicionCreacion,
                xConstraint: Constraint.Constant(0),
                yConstraint: Constraint.Constant(120),
                widthConstraint: Constraint.RelativeToParent((parent) => { return(parent.Width); }),
                heightConstraint: Constraint.RelativeToParent((parent) => { return(parent.Height - 120); })
                );

            Content = contenido2;
        }
Esempio n. 12
0
        public CuentaDTViewModel()
        {
            MessagingCenter.Subscribe <MainPage>(this, "DisplayAlert", (sender) =>
            {
                Focus();
                control = -1;
            });


            nombres = new ExtendedEntry
            {
                TextColor        = Color.FromHex("3F3F3F"),
                HasBorder        = false,
                Placeholder      = "Toca para ingresar",
                PlaceholderColor = Color.FromHex("B2B2B2"),
                XAlign           = TextAlignment.End,
                FontFamily       = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                FontSize         = 14,
                Text             = String.IsNullOrEmpty(cuenta.firstName) ?String.Empty: cuenta.firstName
            };



            apellidos = new ExtendedEntry
            {
                TextColor        = Color.FromHex("3F3F3F"),
                HasBorder        = false,
                Placeholder      = "Toca para ingresa",
                PlaceholderColor = Color.FromHex("B2B2B2"),
                XAlign           = TextAlignment.End,
                FontFamily       = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                FontSize         = 14,
                Text             = String.IsNullOrEmpty(cuenta.lastName) ? String.Empty : cuenta.lastName
            };

            nombreEmpresa = new ExtendedEntry
            {
                Placeholder      = "Toca para ingresar",
                PlaceholderColor = Color.FromHex("B2B2B2"),
                TextColor        = Color.FromHex("3F3F3F"),
                HasBorder        = false,
                XAlign           = TextAlignment.End,
                FontSize         = 14,
                FontFamily       = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                Text             = String.IsNullOrEmpty(cuenta1.nombre) ? String.Empty : cuenta1.nombre
            };



            direccion = new ExtendedEntry
            {
                Placeholder      = "Toca para ingresar",
                PlaceholderColor = Color.FromHex("B2B2B2"),
                TextColor        = Color.FromHex("3F3F3F"),
                HasBorder        = false,
                XAlign           = TextAlignment.End,
                FontFamily       = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                FontSize         = 14,
                Text             = String.IsNullOrEmpty(cuenta1.direccion) ? String.Empty : cuenta1.direccion
            };

            correo = new ExtendedEntry
            {
                Placeholder      = "Toca para ingresar",
                PlaceholderColor = Color.FromHex("B2B2B2"),
                TextColor        = Color.FromHex("B2B2B2"),
                HasBorder        = false,
                IsEnabled        = false,
                Keyboard         = Keyboard.Email,
                XAlign           = TextAlignment.End,
                FontFamily       = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                FontSize         = 14,
                Text             = String.IsNullOrEmpty(cuenta.email) ? String.Empty : cuenta.email
            };

            colaboradores = new ExtendedPicker
            {
                Title     = "Seleccione",
                TextColor = Color.FromHex("3F3F3F"),
                HasBorder = false,
                XAlign    = TextAlignment.End,
                Margin    = new Thickness(0, 0, 35, 0),
                Font      = Device.OnPlatform <Font>(Font.OfSize("OpenSans-Bold", 14), Font.OfSize("OpenSans-Bold", 14), Font.Default)
            };

            foreach (string colaboradoresT in Constants.colaboradores.Keys)
            {
                colaboradores.Items.Add(colaboradoresT);
            }

            IconView colaboradoresDropdown = new IconView
            {
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.End,
                Source            = "idropdown.png",
                WidthRequest      = 10,
                HeightRequest     = 10,
                Foreground        = Color.FromHex("373152")
            };

            Grid Colaboradores = new Grid();

            Colaboradores.Children.Add(colaboradores);
            Colaboradores.Children.Add(colaboradoresDropdown);
            colaboradores.SelectedIndex = 2;

            sector = new ExtendedPicker
            {
                Title     = "Seleccione",
                TextColor = Color.FromHex("3F3F3F"),
                HasBorder = false,
                XAlign    = TextAlignment.End,
                Margin    = new Thickness(0, 0, 35, 0),
                Font      = Device.OnPlatform <Font>(Font.OfSize("OpenSans-Bold", 14), Font.OfSize("OpenSans-Bold", 14), Font.Default)
            };


            IconView sectorDropdown = new IconView
            {
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.End,
                Source            = "idropdown.png",
                WidthRequest      = 10,
                HeightRequest     = 10,
                Foreground        = Color.FromHex("373152")
            };

            Grid Sector = new Grid();

            Sector.Children.Add(sector);
            Sector.Children.Add(sectorDropdown);
            sector.SelectedIndex = 5;


            genero = new ExtendedPicker
            {
                Title     = "Seleccione",
                TextColor = Color.FromHex("3F3F3F"),
                HasBorder = false,
                XAlign    = TextAlignment.End,
                Margin    = new Thickness(0, 0, 35, 0),
                Font      = Device.OnPlatform <Font>(Font.OfSize("OpenSans-Bold", 14), Font.OfSize("OpenSans-Bold", 14), Font.Default)
            };

            foreach (string generos in Constants.genero.Keys)
            {
                genero.Items.Add(generos);
            }

            IconView generoDropdown = new IconView
            {
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.End,
                Source            = "idropdown.png",
                WidthRequest      = 10,
                HeightRequest     = 10,
                Foreground        = Color.FromHex("373152")
            };

            Grid Genero = new Grid();

            Genero.Children.Add(genero);
            Genero.Children.Add(generoDropdown);
            genero.SelectedIndex = 0;


            puesto = new ExtendedPicker
            {
                Title     = "Seleccione",
                TextColor = Color.FromHex("3F3F3F"),
                HasBorder = false,
                XAlign    = TextAlignment.End,
                Margin    = new Thickness(0, 0, 35, 0),
                Font      = Device.OnPlatform <Font>(Font.OfSize("OpenSans-Bold", 14), Font.OfSize("OpenSans-Bold", 14), Font.Default)
            };



            puestos = App.Database.GetPuestos().ToList();
            if (puestos.Count != 0)
            {
                puesto.Items.Clear();
                foreach (var puestoT in puestos)
                {
                    puesto.Items.Add(puestoT.nombre);
                }
            }
            try
            {
                puesto.SelectedIndex = cuenta.idPuesto;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }


            sectores = App.Database.GetSectores().ToList();
            if (sectores.Count != 0)
            {
                sector.Items.Clear();
                foreach (var sectorT in sectores)
                {
                    sector.Items.Add(sectorT.nombre);
                }
            }


            try
            {
                sector.SelectedIndex = cuenta.idPuesto;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }

            IconView puestoDropdown = new IconView
            {
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.End,
                Source            = "idropdown.png",
                WidthRequest      = 10,
                HeightRequest     = 10,
                Foreground        = Color.FromHex("373152")
            };

            Grid Puesto = new Grid();

            Puesto.Children.Add(puesto);
            Puesto.Children.Add(puestoDropdown);

            Grid generoPuesto = new Grid
            {
                RowSpacing     = 0,
                ColumnSpacing  = 15,
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(5, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(5, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            generoPuesto.Children.Add(new Label
            {
                Text           = "PUESTO:",
                FontSize       = 13,
                TextColor      = Color.FromHex("373152"),
                FontAttributes = FontAttributes.Bold,
                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
            }, 0, 0);
            generoPuesto.Children.Add(new Label
            {
                Text           = "GÉNERO:",
                FontSize       = 13,
                TextColor      = Color.FromHex("373152"),
                FontAttributes = FontAttributes.Bold,
                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
            }, 1, 0);
            generoPuesto.Children.Add(Puesto, 0, 2);
            generoPuesto.Children.Add(Genero, 1, 2);
            generoPuesto.Children.Add(
                new BoxView {
                BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
            }
                , 0, 4);
            generoPuesto.Children.Add(
                new BoxView {
                BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
            }
                , 1, 4);

            Grid colaboradoresSector = new Grid
            {
                RowSpacing     = 0,
                ColumnSpacing  = 15,
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(5, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(5, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            colaboradoresSector.Children.Add(new Label
            {
                Text           = "COLABORADORES:",
                FontSize       = 13,
                TextColor      = Color.FromHex("373152"),
                FontAttributes = FontAttributes.Bold,
                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
            }, 0, 0);
            colaboradoresSector.Children.Add(new Label
            {
                Text           = "SECTOR INDUSTRIA:",
                FontSize       = 13,
                TextColor      = Color.FromHex("373152"),
                FontAttributes = FontAttributes.Bold,
                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
            }, 1, 0);
            colaboradoresSector.Children.Add(Colaboradores, 0, 2);
            colaboradoresSector.Children.Add(Sector, 1, 2);
            colaboradoresSector.Children.Add(
                new BoxView {
                BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
            }
                , 0, 4);
            colaboradoresSector.Children.Add(
                new BoxView {
                BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
            }
                , 1, 4);

            StackLayout datosGenerales = new StackLayout
            {
                Padding         = new Thickness(15, 15, 15, 20),
                Spacing         = 15,
                BackgroundColor = Color.FromHex("E5E5E5"),
                Children        =
                {
                    new StackLayout
                    {
                        Orientation       = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        Children          =
                        {
                            new IconView
                            {
                                Source          = "iEmpresa.png",
                                WidthRequest    = 20,
                                Foreground      = Color.FromHex("373152"),
                                VerticalOptions = LayoutOptions.Center
                            },
                            new Label
                            {
                                Text            = "Datos de la empresa",
                                TextColor       = Color.FromHex("373152"),
                                FontSize        = 18,
                                FontFamily      = Device.OnPlatform("OpenSans-ExtraBold", "OpenSans-ExtraBold", null),
                                VerticalOptions = LayoutOptions.Center
                            }
                        }
                    },
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new Label
                            {
                                Text           = "NOMBRE:*",
                                FontSize       = 13,
                                TextColor      = Color.FromHex("373152"),
                                FontAttributes = FontAttributes.Bold,
                                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                            },
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    new Grid
                                    {
                                        Children =
                                        {
                                            nombreEmpresa,
                                        }
                                    },
                                    new BoxView {
                                        BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
                                    },
                                    new BoxView {
                                        HeightRequest = 0
                                    }
                                }
                            }
                        }
                    },
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new Label
                            {
                                Text           = "DIRECCIÓN:*",
                                FontSize       = 13,
                                TextColor      = Color.FromHex("373152"),
                                FontAttributes = FontAttributes.Bold,
                                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                            },
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    new Grid
                                    {
                                        Children =
                                        {
                                            direccion,
                                        }
                                    },
                                    new BoxView {
                                        BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
                                    },
                                    new BoxView {
                                        HeightRequest = 0
                                    }
                                }
                            }
                        }
                    },
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    colaboradoresSector
                                }
                            }
                        }
                    }
                }
            };

            StackLayout localizacion = new StackLayout
            {
                Padding         = new Thickness(15, 15, 15, 20),
                Spacing         = 15,
                BackgroundColor = Color.FromHex("E5E5E5"),
                Children        =
                {
                    new StackLayout
                    {
                        Orientation       = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        Children          =
                        {
                            new IconView
                            {
                                Source          = "iNPadmin.png",
                                WidthRequest    = 15,
                                Foreground      = Color.FromHex("373152"),
                                VerticalOptions = LayoutOptions.Center
                            },
                            new Label
                            {
                                Text            = "Datos del administrador",
                                TextColor       = Color.FromHex("373152"),
                                VerticalOptions = LayoutOptions.Center,
                                FontFamily      = Device.OnPlatform("OpenSans-ExtraBold", "OpenSans-ExtraBold", null),
                                FontSize        = 18
                            }
                        }
                    },
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new Label
                            {
                                Text           = "NOMBRES:*",
                                FontSize       = 13,
                                TextColor      = Color.FromHex("373152"),
                                FontAttributes = FontAttributes.Bold,
                                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                            },
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    new Grid
                                    {
                                        Children =
                                        {
                                            nombres,
                                        }
                                    },
                                    new BoxView {
                                        BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
                                    },
                                    new BoxView {
                                        HeightRequest = 0
                                    }
                                }
                            }
                        }
                    },
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new Label
                            {
                                Text           = "APELLIDOS:*",
                                FontSize       = 13,
                                TextColor      = Color.FromHex("373152"),
                                FontAttributes = FontAttributes.Bold,
                                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                            },
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    new Grid
                                    {
                                        Children =
                                        {
                                            apellidos,
                                        }
                                    },
                                    new BoxView {
                                        BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
                                    },
                                    new BoxView {
                                        HeightRequest = 0
                                    }
                                }
                            }
                        }
                    },
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    generoPuesto,
                                }
                            }
                        }
                    },
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new Label
                            {
                                Text           = "CORREO ELECTRÓNICO:*",
                                FontSize       = 13,
                                TextColor      = Color.FromHex("373152"),
                                FontAttributes = FontAttributes.Bold,
                                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                            },
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    new Grid
                                    {
                                        Children =
                                        {
                                            correo
                                        }
                                    },
                                    new BoxView {
                                        BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
                                    },
                                    new BoxView {
                                        HeightRequest = 0
                                    }
                                }
                            }
                        }
                    }
                }
            };



            guardar = new Button
            {
                Text            = "GUARDAR",
                FontSize        = 18,
                TextColor       = Color.White,
                FontAttributes  = FontAttributes.Bold,
                FontFamily      = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                VerticalOptions = LayoutOptions.Start,
                BackgroundColor = Color.FromHex("F7B819"),
                WidthRequest    = 128,
                HeightRequest   = 38,
            };
            guardar.Clicked += Guardar_Clicked;

            RelativeLayout gridBoton = new RelativeLayout
            {
                WidthRequest      = 130,
                HeightRequest     = 42,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.End,
            };

            gridBoton.Children.Add(
                new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView
            {
                BackgroundColor = Color.FromHex("B2B2B2"),
                CornerRadius    = 6,
                HeightRequest   = 40,
                WidthRequest    = 128,
            }, Constraint.Constant(2), Constraint.Constant(2));
            gridBoton.Children.Add(guardar, Constraint.Constant(0), Constraint.Constant(0));



            this.BackgroundColor = Color.White;

            contenidoCreacionEdicion = new ScrollView
            {
                Padding = 0,
                Content = new StackLayout
                {
                    Spacing  = 10,
                    Children =
                    {
                        new StackLayout
                        {
                            Spacing  = 0,
                            Children =
                            {
                                datosGenerales,
                                new BoxView {
                                    VerticalOptions = LayoutOptions.FillAndExpand,BackgroundColor                                     = Color.FromHex("B3B3B3"), HeightRequest = 4
                                },
                            }
                        },
                        new StackLayout
                        {
                            Spacing  = 0,
                            Children =
                            {
                                localizacion,
                                new BoxView {
                                    VerticalOptions = LayoutOptions.FillAndExpand,BackgroundColor                                       = Color.FromHex("B3B3B3"), HeightRequest = 4
                                },
                            }
                        }
                    }
                }
            };


            EdicionCreacion = new StackLayout
            {
                Padding  = new Thickness(0, 15),
                Children = { contenidoCreacionEdicion, gridBoton }
            };
            Content = EdicionCreacion;



            /*if (!Constants.CargaInicial)
             *  Navigation.PushPopupAsync(new Indicador("Descargando datos de sistema, por favor espere.", Color.White));
             * else
             * {
             *
             *  try
             *  {
             *      int index = 0;
             *      foreach (var country in App.Database.GetPaises().ToList())
             *      {
             *          paises.Add(country.nombre, country.codigo);
             *          pais.Items.Add(country.nombre);
             *          paisSeleccionado.Add(country.codigo, index);
             *          index++;
             *      }
             *      index = 0;
             *  }
             *  catch (Exception ex)
             *  {
             *      System.Diagnostics.Debug.WriteLine(ex.Message);
             *  }
             *
             *  try
             *  {
             *      int index = 0;
             *      foreach (var speciality in App.Database.GetEspecialidades().ToList())
             *      {
             *          especialidades.Add(speciality.nombre.ToUpper(), speciality.idEspecialidad);
             *          especialidad1.Items.Add(speciality.nombre.ToUpper());
             *          especialidad2.Items.Add(speciality.nombre.ToUpper());
             *          especialidad1Seleccionado.Add(speciality.idEspecialidad, index);
             *          especialidad2Seleccionado.Add(speciality.idEspecialidad, index);
             *          index++;
             *      }
             *      index = 0;
             *  }
             *  catch (Exception ex)
             *  {
             *      System.Diagnostics.Debug.WriteLine(ex.Message);
             *  }
             *  CargarSeleccionables();
             * }*/
        }
Esempio n. 13
0
        public UsuarioDTViewModel()
        {
            MessagingCenter.Subscribe <MainPage>(this, "DisplayAlert", (sender) =>
            {
                Focus();
                control = -1;
            });


            guardar = new Button
            {
                Text            = "GUARDAR",
                FontSize        = 18,
                TextColor       = Color.White,
                FontAttributes  = FontAttributes.Bold,
                FontFamily      = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                VerticalOptions = LayoutOptions.Start,
                BackgroundColor = Color.FromHex("F7B819"),
                WidthRequest    = 128,
                HeightRequest   = 38,
            };
            guardar.Clicked += Guardar_Clicked;

            RelativeLayout gridBoton = new RelativeLayout
            {
                WidthRequest      = 130,
                HeightRequest     = 42,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.End,
            };

            gridBoton.Children.Add(
                new RoundedBoxView.Forms.Plugin.Abstractions.RoundedBoxView
            {
                BackgroundColor = Color.FromHex("B2B2B2"),
                CornerRadius    = 6,
                HeightRequest   = 40,
                WidthRequest    = 128,
            }, Constraint.Constant(2), Constraint.Constant(2));
            gridBoton.Children.Add(guardar, Constraint.Constant(0), Constraint.Constant(0));



            nombres = new ExtendedEntry
            {
                TextColor        = Color.FromHex("3F3F3F"),
                HasBorder        = false,
                Placeholder      = "Toca para ingresar",
                PlaceholderColor = Color.FromHex("B2B2B2"),
                XAlign           = TextAlignment.End,
                FontFamily       = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                FontSize         = 14,
                Text             = String.IsNullOrEmpty(perfil.firstName)?String.Empty: perfil.firstName
            };

            apellidos = new ExtendedEntry
            {
                TextColor        = Color.FromHex("3F3F3F"),
                HasBorder        = false,
                Placeholder      = "Toca para ingresar",
                PlaceholderColor = Color.FromHex("B2B2B2"),
                XAlign           = TextAlignment.End,
                FontFamily       = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                FontSize         = 14,
                Text             = String.IsNullOrEmpty(perfil.lastName) ? String.Empty : perfil.lastName
            };


            genero = new ExtendedPicker
            {
                Title     = "Seleccione",
                TextColor = Color.FromHex("3F3F3F"),
                HasBorder = false,
                XAlign    = TextAlignment.End,
                Margin    = new Thickness(0, 0, 35, 0),
                Font      = Device.OnPlatform <Font>(Font.OfSize("OpenSans-Bold", 14), Font.OfSize("OpenSans-Bold", 14), Font.Default)
            };

            IconView generoDropdown = new IconView
            {
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.End,
                Source            = Images.Estado,
                WidthRequest      = 25,
                HeightRequest     = 25,
            };

            genero.SelectedIndexChanged += (sender, e) =>
            {
                if (genero.SelectedIndex == 1)
                {
                    generoDropdown.Foreground = Color.FromHex("E91B5C");
                }
                else
                {
                    generoDropdown.Foreground = Color.FromHex("0C55A2");
                }
            };

            foreach (string generos in Constants.genero.Keys)
            {
                genero.Items.Add(generos);
            }

            if (!String.IsNullOrEmpty(perfil.genero) && perfil.genero.Equals("1"))
            {
                genero.SelectedIndex = 1;
            }
            else
            {
                genero.SelectedIndex = 0;
            }

            correo = new ExtendedEntry
            {
                Placeholder      = "Toca para ingresar",
                PlaceholderColor = Color.FromHex("B2B2B2"),
                TextColor        = Color.FromHex("B2B2B2"),
                HasBorder        = false,
                IsEnabled        = false,
                Keyboard         = Keyboard.Email,
                XAlign           = TextAlignment.End,
                FontFamily       = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null),
                FontSize         = 14,
                Text             = String.IsNullOrEmpty(perfil.email) ? String.Empty : perfil.email
            };

            Grid Genero = new Grid();

            Genero.Children.Add(genero);
            Genero.Children.Add(generoDropdown);
            genero.SelectedIndex = 0;

            puesto = new ExtendedPicker
            {
                Title     = "Seleccione",
                TextColor = Color.FromHex("3F3F3F"),
                HasBorder = false,
                XAlign    = TextAlignment.End,
                Margin    = new Thickness(0, 0, 35, 0),
                Font      = Device.OnPlatform <Font>(Font.OfSize("OpenSans-Bold", 14), Font.OfSize("OpenSans-Bold", 14), Font.Default)
            };

            puestos = App.Database.GetPuestos().ToList();
            if (puestos.Count != 0)
            {
                puesto.Items.Clear();
                foreach (var puestoT in puestos)
                {
                    puesto.Items.Add(puestoT.nombre);
                }
            }
            try
            {
                puesto.SelectedIndex = perfil.idPuesto;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }

            IconView puestoDropdown = new IconView
            {
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.End,
                Source            = "idropdown.png",
                WidthRequest      = 10,
                HeightRequest     = 10,
                Foreground        = Color.FromHex("373152")
            };

            Grid Puesto = new Grid();

            Puesto.Children.Add(puesto);
            Puesto.Children.Add(puestoDropdown);

            Grid generoPuesto = new Grid
            {
                RowSpacing     = 0,
                ColumnSpacing  = 15,
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(5, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(5, GridUnitType.Absolute)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            generoPuesto.Children.Add(new Label
            {
                Text           = "PUESTO:",
                FontSize       = 13,
                TextColor      = Color.FromHex("373152"),
                FontAttributes = FontAttributes.Bold,
                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
            }, 0, 0);
            generoPuesto.Children.Add(new Label
            {
                Text           = "GÉNERO:",
                FontSize       = 13,
                TextColor      = Color.FromHex("373152"),
                FontAttributes = FontAttributes.Bold,
                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
            }, 1, 0);
            generoPuesto.Children.Add(Puesto, 0, 2);
            generoPuesto.Children.Add(Genero, 1, 2);
            generoPuesto.Children.Add(
                new BoxView {
                BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
            }
                , 0, 4);
            generoPuesto.Children.Add(
                new BoxView {
                BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
            }
                , 1, 4);

            StackLayout datosGenerales = new StackLayout
            {
                Padding         = new Thickness(15, 15, 15, 20),
                Spacing         = 15,
                BackgroundColor = Color.FromHex("E5E5E5"),
                Children        =
                {
                    new StackLayout
                    {
                        Orientation       = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        Children          =
                        {
                            new IconView
                            {
                                Source          = "iNPadmin.png",
                                WidthRequest    = 15,
                                Foreground      = Color.FromHex("373152"),
                                VerticalOptions = LayoutOptions.Center
                            },
                            new Label
                            {
                                Text            = "Datos de Usuario",
                                TextColor       = Color.FromHex("373152"),
                                VerticalOptions = LayoutOptions.Center,
                                FontFamily      = Device.OnPlatform("OpenSans-ExtraBold", "OpenSans-ExtraBold", null),
                                FontSize        = 18
                            }
                        }
                    },
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new Label
                            {
                                Text           = "NOMBRES:*",
                                FontSize       = 13,
                                TextColor      = Color.FromHex("373152"),
                                FontAttributes = FontAttributes.Bold,
                                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                            },
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    new Grid
                                    {
                                        Children =
                                        {
                                            nombres,
                                        }
                                    },
                                    new BoxView {
                                        BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
                                    },
                                    new BoxView {
                                        HeightRequest = 0
                                    }
                                }
                            }
                        }
                    },
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new Label
                            {
                                Text           = "APELLIDOS:*",
                                FontSize       = 13,
                                TextColor      = Color.FromHex("373152"),
                                FontAttributes = FontAttributes.Bold,
                                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                            },
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    new Grid
                                    {
                                        Children =
                                        {
                                            apellidos,
                                        }
                                    },
                                    new BoxView {
                                        BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
                                    },
                                    new BoxView {
                                        HeightRequest = 0
                                    }
                                }
                            }
                        }
                    },
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    generoPuesto,
                                }
                            }
                        }
                    },
                    new StackLayout
                    {
                        Spacing  = 0,
                        Children =
                        {
                            new Label
                            {
                                Text           = "CORREO ELECTRÓNICO:*",
                                FontSize       = 13,
                                TextColor      = Color.FromHex("373152"),
                                FontAttributes = FontAttributes.Bold,
                                FontFamily     = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
                            },
                            new StackLayout
                            {
                                Spacing  = 1,
                                Children =
                                {
                                    new Grid
                                    {
                                        Children =
                                        {
                                            correo
                                        }
                                    },
                                    new BoxView {
                                        BackgroundColor = Color.FromHex("373152"), HeightRequest = 2
                                    },
                                    new BoxView {
                                        HeightRequest = 0
                                    }
                                }
                            }
                        }
                    }
                }
            };



            ContenidoVista = new ScrollView
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Padding         = 0,
                Content         = new StackLayout
                {
                    Spacing  = 10,
                    Children =
                    {
                        new StackLayout
                        {
                            Spacing  = 0,
                            Children =
                            {
                                datosGenerales,
                                new BoxView {
                                    VerticalOptions = LayoutOptions.FillAndExpand,BackgroundColor                                     = Color.FromHex("B3B3B3"), HeightRequest = 4
                                },
                            }
                        }
                    }
                }
            };



            Contenido = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Padding         = new Thickness(0, 15),
                Children        = { ContenidoVista, gridBoton }
            };

            Content = Contenido;
        }