Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Fechadura_Inteligente
Mobile
Commits
ffe83289
Commit
ffe83289
authored
6 months ago
by
Vinicius Monteiro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cadastro grupo porta e editar funcionando corretamente agora
parent
338b6e77
develop
41-patch-usuario-vinicius
56-corringindo-bugs-apos-revisao
master
2 merge requests
!34
Resolve "Corringindo bugs após revisão"
,
!32
Draft: Resolve "Patch: Usuário"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
74 deletions
+70
-74
app/src/main/java/com/br/fechadura/mobile/ui/screens/LoginScreen.kt
...in/java/com/br/fechadura/mobile/ui/screens/LoginScreen.kt
+1
-1
app/src/main/java/com/br/fechadura/mobile/ui/screens/grupoPortas/CadastrarGrupoPortaScreen.kt
...obile/ui/screens/grupoPortas/CadastrarGrupoPortaScreen.kt
+35
-33
app/src/main/java/com/br/fechadura/mobile/ui/screens/grupoPortas/EditarGrupoPortaScreen.kt
...a/mobile/ui/screens/grupoPortas/EditarGrupoPortaScreen.kt
+34
-40
No files found.
app/src/main/java/com/br/fechadura/mobile/ui/screens/LoginScreen.kt
View file @
ffe83289
...
...
@@ -56,7 +56,7 @@ fun LoginScreen(navController: NavController) {
val
autenticado
by
authViewModel
.
autenticado
var
email
by
remember
{
mutableStateOf
(
"dev@gmail.com"
)
}
var
senha
by
remember
{
mutableStateOf
(
"123"
)
}
var
senha
by
remember
{
mutableStateOf
(
"
ABCD@abcd
123
4
"
)
}
var
passwordVisibility
by
remember
{
mutableStateOf
(
false
)
}
Surface
(
...
...
This diff is collapsed.
Click to expand it.
app/src/main/java/com/br/fechadura/mobile/ui/screens/grupoPortas/CadastrarGrupoPortaScreen.kt
View file @
ffe83289
...
...
@@ -266,10 +266,45 @@ fun CadastrarGrupoPorta(
color
=
Color
.
White
)
}
if
(
showBottomSheetPortas
)
{
when
(
portasState
)
{
is
ApiState
.
Error
->
{
// Exibir uma mensagem de erro ou uma tela de falha
Text
(
"Erro ao carregar as portas."
)
}
is
ApiState
.
Created
->
{}
is
ApiState
.
Loading
->
{
// Exibir uma tela de carregamento
LoadingScreen
()
}
is
ApiState
.
Success
->
{
portasState
.
data
?.
let
{
responseData
->
ModalBottomSheetDados
(
title
=
"Portas"
,
searchLabel
=
searchQueryPortas
,
itemList
=
responseData
.
data
,
selectedItems
=
selectedPortas
.
map
{
it
.
toString
()
},
onSelectItem
=
{
selectedPortas
+=
it
},
onRemoveItem
=
{
selectedPortas
-=
it
},
onDismissRequest
=
{
showBottomSheetPortas
=
false
},
itemLabel
=
{
it
.
descricao
},
IdItem
=
{
it
.
_id
},
itemDescription
=
{
it
.
ambiente
}
)
}
}
}
}
}
}
}
LaunchedEffect
(
Unit
)
{
portaViewModel
.
getAllPortas
()
}
LaunchedEffect
(
postState
)
{
when
(
postState
)
{
is
ApiState
.
Created
->
{
...
...
@@ -309,38 +344,5 @@ fun CadastrarGrupoPorta(
}
}
}
if
(
showBottomSheetPortas
)
{
when
(
portasState
)
{
is
ApiState
.
Error
->
{
// Exibir uma mensagem de erro ou uma tela de falha
Text
(
"Erro ao carregar as portas."
)
}
is
ApiState
.
Created
->
{}
is
ApiState
.
Loading
->
{
// Exibir uma tela de carregamento
LoadingScreen
()
}
is
ApiState
.
Success
->
{
portasState
.
data
?.
let
{
responseData
->
ModalBottomSheetDados
(
title
=
"Portas"
,
searchLabel
=
searchQueryPortas
,
itemList
=
responseData
.
data
,
selectedItems
=
selectedPortas
.
map
{
it
.
toString
()
},
onSelectItem
=
{
selectedPortas
+=
it
},
onRemoveItem
=
{
selectedPortas
-=
it
},
onDismissRequest
=
{
showBottomSheetPortas
=
false
},
itemLabel
=
{
it
.
descricao
},
IdItem
=
{
it
.
_id
},
itemDescription
=
{
it
.
ambiente
}
)
}
}
}
}
}
This diff is collapsed.
Click to expand it.
app/src/main/java/com/br/fechadura/mobile/ui/screens/grupoPortas/EditarGrupoPortaScreen.kt
View file @
ffe83289
...
...
@@ -231,10 +231,6 @@ fun EditarGrupoPorta(
Button
(
onClick
=
{
println
(
"Dado atualizado: ${nome}"
)
println
(
"Dado atualizado: ${descricao}"
)
println
(
"Dado atualizado: ${ativo}"
)
println
(
"Dado atualizado: ${selectedPortas.toList()}"
)
val
grupoEditaRequestBodyPatch
=
GrupoPortaRequestBodyPatch
()
grupoEditaRequestBodyPatch
.
nome
=
nome
grupoEditaRequestBodyPatch
.
descricao
=
descricao
...
...
@@ -258,6 +254,40 @@ fun EditarGrupoPorta(
color
=
Color
.
White
)
}
if
(
showBottomSheetPortas
)
{
when
(
portasState
)
{
is
ApiState
.
Error
->
{
// Exibir uma mensagem de erro ou uma tela de falha
Text
(
"Erro ao carregar as portas."
)
}
is
ApiState
.
Created
->
{}
is
ApiState
.
Loading
->
{
// Exibir uma tela de carregamento
LoadingScreen
()
}
is
ApiState
.
Success
->
{
portasState
.
data
?.
let
{
responseData
->
responseData
.
data
.
forEach
{
porta
->
println
(
"ID DA PORTA AQUI GRUPO: ${porta._id}"
)
}
ModalBottomSheetDados
(
title
=
"Portas"
,
searchLabel
=
searchQueryPortas
,
itemList
=
responseData
.
data
,
selectedItems
=
selectedPortas
.
map
{
it
.
toString
()
},
onSelectItem
=
{
selectedPortas
+=
it
},
onRemoveItem
=
{
selectedPortas
-=
it
},
onDismissRequest
=
{
showBottomSheetPortas
=
false
},
itemLabel
=
{
it
.
descricao
},
IdItem
=
{
it
.
_id
},
itemDescription
=
{
it
.
ambiente
}
)
}
}
}
}
LaunchedEffect
(
grupoEditaState
)
{
when
(
grupoEditaState
)
{
is
ApiState
.
Created
->
{}
...
...
@@ -304,7 +334,6 @@ fun EditarGrupoPorta(
is
ApiState
.
Loading
->
{}
is
ApiState
.
Success
->
{
grupoState
.
data
?.
let
{
println
(
"Dados que vieram: ${it.portas}"
)
nome
=
it
.
nome
descricao
=
it
.
descricao
ativo
=
it
.
ativo
...
...
@@ -322,40 +351,5 @@ fun EditarGrupoPorta(
}
}
}
if
(
showBottomSheetPortas
)
{
when
(
portasState
)
{
is
ApiState
.
Error
->
{
// Exibir uma mensagem de erro ou uma tela de falha
Text
(
"Erro ao carregar as portas."
)
}
is
ApiState
.
Created
->
{}
is
ApiState
.
Loading
->
{
// Exibir uma tela de carregamento
LoadingScreen
()
}
is
ApiState
.
Success
->
{
portasState
.
data
?.
let
{
responseData
->
responseData
.
data
.
forEach
{
porta
->
println
(
"ID DA PORTA AQUI GRUPO: ${porta._id}"
)
}
ModalBottomSheetDados
(
title
=
"Portas"
,
searchLabel
=
searchQueryPortas
,
itemList
=
responseData
.
data
,
selectedItems
=
selectedPortas
.
map
{
it
.
toString
()
},
onSelectItem
=
{
selectedPortas
+=
it
},
onRemoveItem
=
{
selectedPortas
-=
it
},
onDismissRequest
=
{
showBottomSheetPortas
=
false
},
itemLabel
=
{
it
.
descricao
},
IdItem
=
{
it
.
_id
},
itemDescription
=
{
it
.
ambiente
}
)
}
}
}
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment