- VERSION 4.10.09.EP_d

- Se corrige el error de que a veces cuando se mete producto, no lo agrega al pedido (normalmente para Chong), basicamente si se buscaba un producto y se escribia muy rapido, duplicaba los resultados y al agregar el producto, se agregaba en blanco.
- Se hicieron cambios en la clase del cuestionario para que no se amontonen las preguntas y se vean mejor en algunas pantallas.
This commit is contained in:
Jose Alberto Guerra Ugalde
2024-10-10 19:41:44 -06:00
parent 0692b7cb25
commit b7c9be5201
8 changed files with 55 additions and 101 deletions

View File

@@ -18,6 +18,7 @@ Sub Class_Globals
Dim panelSombra As Panel 'Panel de sombra.
Dim cb_respuestas As String = ""
Dim panelActual As Panel
Dim bringToFrontCont As Int = 0
End Sub
'You can add more parameters here.
@@ -172,7 +173,6 @@ Sub agregaPreguntaAbierta(id As String, pregunta As String, ids As List, respues
encuestaIniciada = True
vPreguntaActual = id
bAceptarPregunta.Initialize("bAceptarPregunta")
bAceptarPregunta.Enabled = False
Private su As StringUtils
panelSombra.Initialize("pSombra")
Private cd As ColorDrawable
@@ -202,31 +202,38 @@ Sub agregaPreguntaAbierta(id As String, pregunta As String, ids As List, respues
For p = 0 To respuestas.Size - 1
et(p).Initialize("et")
labelX(p).Initialize("labelX")
labelX(p).Height = 60dip
' et(p).Color = Colors.red
' labelX(p).Color = Colors.Blue
et(p).As(B4XView).SetTextAlignment("CENTER", "CENTER")
labelX(p).As(B4XView).SetTextAlignment("CENTER", "CENTER")
et(p).SetTextSizeAnimated(0, 14)
et(p).SetTextSizeAnimated(0, 10)
et(p).Tag = CreateMap("id":id, "pregunta":pregunta, "panel":panelSombra, "idRespuesta":ids.Get(p))
labelX(p).Text = respuestas.Get(p)
Private lx As Label = labelX(p)
et(p).Text = ""
Log($"Agregamos ET ${labelX(p).text} - ${(70*p)}"$)
' Private labelXHeight As String =
Log(labelX(p).Height)
sv_cuest.panel.AddView(labelX(p), 0, (70 * p), (panelX.Width * 0.72), 60) 'Agregamos la etiqueta al panel.
sv_cuest.panel.AddView(et(p), (labelX(p).Width + 5), (70 * p), (panelX.Width * 0.2), 60) 'Agregamos el edittext al panel.
sv_cuest.panel.AddView(et(p), (labelX(p).Width + 5), (70 * p), (panelX.Width * 0.2), 85) 'Agregamos el edittext al panel.
Private newTop As Int = 0 'lbl.top + lbl.Height + 20 'Si es el primer radio, lo ponemos en top = alto de la "pregunta" + 10.
If p <> 0 Then newTop = et(p - 1).Top + et(p - 1).Height + 5 'Calculamos el Top del radio de acuerdo al top y alto del radio anterior.
et(p).Top = newTop
labelX(p).Top = newTop
Next
bAceptarPregunta.Text = "Continuar"
panelX.AddView(sv_cuest, 10, lbl.top + 45dip, (panelX.Width * 0.95), 300dip)
panelX.AddView(sv_cuest, 10, lbl.top + lbl.Height + 20, (panelX.Width * 0.95), 300dip)
sv_cuest.panel.Height = newTop + 40dip
panelX.Height = newTop + 80dip + 35dip 'Calculamos el alto del panel de acuerdo al Top del boton.
panelX.Height = 150dip + (respuestas.Size * 80) 'Calculamos el alto del panel de acuerdo al Top del boton.
If panelX.Height > (Root2.Height * 0.7) Then ' Si el panel es mayor al 70%, lo regresamos al 70%.
panelX.Height = Root2.Height * 0.7
End If
panelX.AddView(bAceptarPregunta, 10, (panelX.Height - 55dip), 150dip, 50dip) 'Ponemos el boton de continuar despues del ultimo radio.
bAceptarPregunta.Left = (panelX.Width / 2) - (bAceptarPregunta.Width / 2)
bAceptarPregunta.Enabled = False
sv_cuest.Height = panelX.Height - (lbl.Top + lbl.Height) - 55dip
panelX.left = (Root2.Width / 2) - (panelX.Width / 2)
panelX.top = (Root2.Height / 2) - (panelX.Height / 2) 'Centramos verticalmente el panel.
@@ -235,6 +242,7 @@ Sub agregaPreguntaAbierta(id As String, pregunta As String, ids As List, respues
panelSombra.Height = Root2.Height
panelSombra.Elevation = 100dip
panelSombra.BringToFront
bringToFrontCont = 0
End Sub
private Sub preguntaContestada(Success As Map) 'ignore
@@ -305,7 +313,7 @@ private Sub cb_CheckedChange(Checked As Boolean)
End Sub
Private Sub et_TextChanged(Old As String, New As String)
' Log($"${Old}, ${New}"$)
Log($"${Old}, ${New}"$)
Private etTotales As Int = 0
Private etCont As Int = 0
Private etResps As String = ""
@@ -328,6 +336,7 @@ Private Sub et_TextChanged(Old As String, New As String)
End If
Next
' Log($"${etResps}, ${etIdResps}"$)
Log($"${etCont}, ${etTotales}"$)
bAceptarPregunta.Tag = CreateMap("idPregunta":Sender.As(EditText).tag.As(Map).Get("id").As(String), "pregunta":Sender.As(EditText).tag.As(Map).Get("pregunta"), "idRespuesta":etIdResps, "respuesta":etResps, "panel":Sender.As(EditText).tag.As(Map).Get("panel"))
If etCont = etTotales Then bAceptarPregunta.Enabled = True Else bAceptarPregunta.Enabled = False
End Sub