buscando logs na api e exibindo na nova tela logs
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
import 'package:gainer_crypto/crypto.dart';
|
import 'package:gainer_crypto/crypto.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
class MainControllers{
|
class MainControllers{
|
||||||
encrypt(String senhaDigitada,String senhaUsuario) {
|
encrypt(String senhaDigitada,String senhaUsuario) {
|
||||||
@@ -39,4 +41,25 @@ class MainControllers{
|
|||||||
// Retorna a senha criptografada
|
// Retorna a senha criptografada
|
||||||
return senhaCriptogradafa;
|
return senhaCriptogradafa;
|
||||||
}
|
}
|
||||||
|
salvarLog(String TELA,List dados)async{
|
||||||
|
final url = '${dados[2]}/log';
|
||||||
|
print('dados');
|
||||||
|
print(dados);
|
||||||
|
// print(widget.estudanteModelo.dados);
|
||||||
|
final response = await http.post(
|
||||||
|
Uri.parse(url),
|
||||||
|
body:{
|
||||||
|
'DATA' : DateFormat('dd/MM/yyyy HH:mm').format(DateTime.now()),
|
||||||
|
'TELA' : TELA,
|
||||||
|
'CD_USUARIO' : dados[4].toString(),
|
||||||
|
'NO_USUARIO': dados[1].toString(),
|
||||||
|
'CD_ALUNO': dados[5].toString(),
|
||||||
|
'NO_ALUNO': '',
|
||||||
|
'CIDADE' : dados[0],
|
||||||
|
'SISTEMA' : 'CONTROLE'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
print('response : ${response.body}');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:educa_controle_acesso/screens/home_screen.dart';
|
import 'package:educa_controle_acesso/screens/home_screen.dart';
|
||||||
|
import 'package:educa_controle_acesso/screens/log_screen.dart';
|
||||||
import 'package:educa_controle_acesso/screens/login_screen.dart';
|
import 'package:educa_controle_acesso/screens/login_screen.dart';
|
||||||
import 'package:educa_controle_acesso/screens/responsible_register_screen.dart';
|
import 'package:educa_controle_acesso/screens/responsible_register_screen.dart';
|
||||||
import 'package:educa_controle_acesso/widgets/text_custom.dart';
|
import 'package:educa_controle_acesso/widgets/text_custom.dart';
|
||||||
@@ -62,6 +63,7 @@ class MyApp extends StatelessWidget {
|
|||||||
'/$cidade': (_)=> LoginScreen(cidade: cidade),
|
'/$cidade': (_)=> LoginScreen(cidade: cidade),
|
||||||
'/home':(context)=> HomeScreen(dados: ModalRoute.of(context)!.settings.arguments as List),
|
'/home':(context)=> HomeScreen(dados: ModalRoute.of(context)!.settings.arguments as List),
|
||||||
'/cadastro':(context)=>ResponsibleRegisterScreen(ModalRoute.of(context)!.settings.arguments as AlunoModel),
|
'/cadastro':(context)=>ResponsibleRegisterScreen(ModalRoute.of(context)!.settings.arguments as AlunoModel),
|
||||||
|
'/log':(context)=> LogScreen(dados:ModalRoute.of(context)!.settings.arguments as List)
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ class AlunoModel{
|
|||||||
String login;
|
String login;
|
||||||
String URL;
|
String URL;
|
||||||
var dados;
|
var dados;
|
||||||
|
String CD_USUARIO;
|
||||||
|
String USER_USUARIO;
|
||||||
|
|
||||||
AlunoModel({
|
AlunoModel({
|
||||||
required this.nome,
|
required this.nome,
|
||||||
@@ -20,6 +22,8 @@ class AlunoModel{
|
|||||||
required this.dados,
|
required this.dados,
|
||||||
required this.cidade,
|
required this.cidade,
|
||||||
required this.login,
|
required this.login,
|
||||||
required this.URL
|
required this.URL,
|
||||||
|
required this.CD_USUARIO,
|
||||||
|
required this.USER_USUARIO,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
19
lib/models/log_model.dart
Normal file
19
lib/models/log_model.dart
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
class LogModel{
|
||||||
|
int NRO_LOG;
|
||||||
|
String DATA;
|
||||||
|
String TELA;
|
||||||
|
String CD_USUARIO;
|
||||||
|
String NO_USUARIO;
|
||||||
|
String CIDADE;
|
||||||
|
String SISTEMA;
|
||||||
|
|
||||||
|
LogModel({
|
||||||
|
required this.NRO_LOG,
|
||||||
|
required this.DATA,
|
||||||
|
required this.TELA,
|
||||||
|
required this.CD_USUARIO,
|
||||||
|
required this.NO_USUARIO,
|
||||||
|
required this.CIDADE,
|
||||||
|
required this.SISTEMA,
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import 'package:educa_controle_acesso/widgets/input_text.dart';
|
|||||||
import 'package:educa_controle_acesso/widgets/item_acesso.dart';
|
import 'package:educa_controle_acesso/widgets/item_acesso.dart';
|
||||||
import 'package:educa_controle_acesso/widgets/text_custom.dart';
|
import 'package:educa_controle_acesso/widgets/text_custom.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import '../controllers/main_controllers.dart';
|
||||||
import '../models/aluno_model.dart';
|
import '../models/aluno_model.dart';
|
||||||
import '../models/login_model.dart';
|
import '../models/login_model.dart';
|
||||||
import '../widgets/buttom_custom.dart';
|
import '../widgets/buttom_custom.dart';
|
||||||
@@ -79,6 +80,8 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
cidade: widget.dados[0],
|
cidade: widget.dados[0],
|
||||||
login: widget.dados[1],
|
login: widget.dados[1],
|
||||||
URL: widget.dados[2],
|
URL: widget.dados[2],
|
||||||
|
CD_USUARIO: widget.dados[4].toString(),
|
||||||
|
USER_USUARIO: widget.dados[5].toString()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
resultadoPesquisa.add(alunos[i]);
|
resultadoPesquisa.add(alunos[i]);
|
||||||
@@ -170,12 +173,19 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
// print(response.body);
|
// print(response.body);
|
||||||
|
MainControllers().salvarLog( logins[index].CHECK? 'LIBERADO ACESSO PARA ${logins[index].ID_USUARIO}':'BLOQUEADO ACESSO PARA ${logins[index].ID_USUARIO}',widget.dados);
|
||||||
showSnackBar(context, '${response.body.toUpperCase()}!', Colors.green);
|
showSnackBar(context, '${response.body.toUpperCase()}!', Colors.green);
|
||||||
logins[index].STATUS == 'NAO';
|
logins[index].STATUS == 'NAO';
|
||||||
buscandoDados = false;
|
buscandoDados = false;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
MainControllers().salvarLog('PESQUISAR ESTUDANTES/USUARIOS',widget.dados);
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
@@ -191,6 +201,19 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
),
|
),
|
||||||
TextCustom(text: showEscola?'- PESQUISAR USUÁRIOS':'- PESQUISAR ESTUDANTES',color: Colors.white,),
|
TextCustom(text: showEscola?'- PESQUISAR USUÁRIOS':'- PESQUISAR ESTUDANTES',color: Colors.white,),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
|
widget.dados[1].toString().toUpperCase()=='ADMINISTRADOR'?ButtonCustom(
|
||||||
|
onPressed: (){
|
||||||
|
inputPesquisa.clear();
|
||||||
|
Navigator.pushNamed(context, '/log',arguments: widget.dados);
|
||||||
|
},
|
||||||
|
text: 'Exibir Logs',
|
||||||
|
fontSize: 15,
|
||||||
|
widthCustom: 0.1,
|
||||||
|
colorButton: PaletteColors.primaryColor,
|
||||||
|
colorText: PaletteColors.white,
|
||||||
|
colorBorder: PaletteColors.white
|
||||||
|
):Container(),
|
||||||
|
SizedBox(width: 50),
|
||||||
widget.dados[1].toString().toUpperCase()=='ADMINISTRADOR'?ButtonCustom(
|
widget.dados[1].toString().toUpperCase()=='ADMINISTRADOR'?ButtonCustom(
|
||||||
onPressed: (){
|
onPressed: (){
|
||||||
inputPesquisa.clear();
|
inputPesquisa.clear();
|
||||||
|
|||||||
253
lib/screens/log_screen.dart
Normal file
253
lib/screens/log_screen.dart
Normal file
@@ -0,0 +1,253 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:educa_controle_acesso/models/log_model.dart';
|
||||||
|
import 'package:educa_controle_acesso/utils/fixos.dart';
|
||||||
|
import 'package:educa_controle_acesso/widgets/item_log.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../controllers/main_controllers.dart';
|
||||||
|
import '../utils/colors.dart';
|
||||||
|
import '../widgets/buttom_custom.dart';
|
||||||
|
import '../widgets/input_text.dart';
|
||||||
|
import '../widgets/snackBars.dart';
|
||||||
|
import '../widgets/text_custom.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
|
class LogScreen extends StatefulWidget {
|
||||||
|
List dados;
|
||||||
|
|
||||||
|
LogScreen({
|
||||||
|
required this.dados
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<LogScreen> createState() => _LogScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LogScreenState extends State<LogScreen> {
|
||||||
|
|
||||||
|
var inputPesquisa = TextEditingController();
|
||||||
|
bool buscandoDados = false;
|
||||||
|
List <LogModel> logs = [];
|
||||||
|
String? selectApp;
|
||||||
|
|
||||||
|
getLogsDB()async{
|
||||||
|
logs.clear();
|
||||||
|
if(selectApp!=null){
|
||||||
|
String nome = inputPesquisa.text.replaceAll(' ', '%20').toUpperCase();
|
||||||
|
final url = '${widget.dados[2]}/buscarlogs?USUARIO=$nome&CIDADE=${widget.dados[0]}&SISTEMA=${selectApp}';
|
||||||
|
print(url);
|
||||||
|
final response = await http.get(Uri.parse(url));
|
||||||
|
var map = json.decode(response.body);
|
||||||
|
// print(map);
|
||||||
|
List list = map;
|
||||||
|
if(list.length!=0){
|
||||||
|
for(int i=0;list.length>i;i++){
|
||||||
|
// if(list[i]['NO_USERNAME']!='ADMIN'){
|
||||||
|
logs.add(
|
||||||
|
LogModel(
|
||||||
|
NRO_LOG: list[i]['NRO_LOG'],
|
||||||
|
DATA:list[i]['DATA'],
|
||||||
|
TELA: list[i]['TELA'],
|
||||||
|
CD_USUARIO: list[i]['CD_USUARIO'],
|
||||||
|
NO_USUARIO: list[i]['NO_USUARIO'],
|
||||||
|
SISTEMA: list[i]['SISTEMA'],
|
||||||
|
CIDADE: list[i]['CIDADE'],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
showSnackBar(context, 'NENHUM DADO ENCONTRADO!', Colors.red);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
showSnackBar(context, 'SELECIONE QUAL APP DESEJA PESQUISAR!', Colors.red);
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
buscandoDados = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
MainControllers().salvarLog('DADOS LOG',widget.dados);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
|
double width = MediaQuery.of(context).size.width;
|
||||||
|
double height = MediaQuery.of(context).size.height;
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Image.asset("assets/images/logoEduca.png",width:width * 0.08,height: height * 0.12)
|
||||||
|
),
|
||||||
|
TextCustom(text: ' - LOGS',color: Colors.white,),
|
||||||
|
Spacer(),
|
||||||
|
SizedBox(width: width * 0.02),
|
||||||
|
Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
TextCustom(text: widget.dados[0]==null?'':widget.dados[0],color: Colors.white,),
|
||||||
|
TextCustom(text:widget.dados[1]==null?'':widget.dados[1].toString().toUpperCase(),color: Colors.white,),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
backgroundColor: PaletteColors.grey,
|
||||||
|
),
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.symmetric(horizontal: width*0.08),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: 35,
|
||||||
|
width: 70,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: TextCustom(text: 'BUSCAR',color: Colors.black,size: 12.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.only(topLeft: Radius.circular(3.0),bottomLeft: Radius.circular(3.0),),
|
||||||
|
color: PaletteColors.greySearch,
|
||||||
|
border: Border.all(color: PaletteColors.grey)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
InputText(
|
||||||
|
borderRadius: 0,
|
||||||
|
hint: 'Pesquisar por login do usuário'.toUpperCase(),
|
||||||
|
controller: inputPesquisa,
|
||||||
|
width: width*0.71,
|
||||||
|
inputFormatters: [],
|
||||||
|
fontSize: 14,
|
||||||
|
colorBackground: Colors.white,
|
||||||
|
),
|
||||||
|
ButtonCustom(
|
||||||
|
borderRadiusbottomLeft: 0,
|
||||||
|
borderRadiustopLeft: 0,
|
||||||
|
borderRadiusbottomRight: 0,
|
||||||
|
borderRadiustopRight: 0,
|
||||||
|
widthCustom: 0.05,
|
||||||
|
text: "PESQUISAR",
|
||||||
|
fontSize: 10.0,
|
||||||
|
colorText: PaletteColors.white,
|
||||||
|
colorButton: PaletteColors.green,
|
||||||
|
colorBorder: PaletteColors.green,
|
||||||
|
onPressed: (){
|
||||||
|
if(inputPesquisa.text.isNotEmpty){
|
||||||
|
setState(() {
|
||||||
|
buscandoDados = true;
|
||||||
|
});
|
||||||
|
getLogsDB();
|
||||||
|
}else{
|
||||||
|
showSnackBar(context, 'Digite alguma informação para pesquisar', Colors.red);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
ButtonCustom(
|
||||||
|
borderRadiusbottomLeft: 0,
|
||||||
|
borderRadiustopLeft: 0,
|
||||||
|
widthCustom: 0.05,
|
||||||
|
text: "LIMPAR",
|
||||||
|
fontSize: 10.0,
|
||||||
|
colorText: PaletteColors.white,
|
||||||
|
colorButton: PaletteColors.grey,
|
||||||
|
colorBorder: PaletteColors.grey,
|
||||||
|
onPressed: ()=>setState((){
|
||||||
|
inputPesquisa.clear();
|
||||||
|
// resultadoPesquisa.clear();
|
||||||
|
// alunos.clear();
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.symmetric(horizontal: width>900?width*0.08:width*0.05,vertical: 5),
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 5,vertical: 1),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: width*0.05,
|
||||||
|
child: TextCustom(text: 'NRO LOG')
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: width*0.08,
|
||||||
|
child: TextCustom(text: 'DATA')
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: width*0.1,
|
||||||
|
child: TextCustom(text: 'CÓDIGO USUARIO'),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: width*0.15,
|
||||||
|
child:
|
||||||
|
TextCustom(text: 'NOME USUÁRIO'),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: width*0.1,
|
||||||
|
child:
|
||||||
|
TextCustom(text: 'APP/WEB'),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: width*0.1,
|
||||||
|
child:
|
||||||
|
TextCustom(text: 'CIDADE'),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: width*0.07,
|
||||||
|
child:
|
||||||
|
TextCustom(text: 'TELA/AÇÃO'),
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 5),
|
||||||
|
color: PaletteColors.lightGrey,
|
||||||
|
child: DropdownButtonHideUnderline(
|
||||||
|
child: DropdownButton(
|
||||||
|
hint: TextCustom(text: 'QUAL APP DESEJA EXIBIR?'),
|
||||||
|
value: selectApp,
|
||||||
|
items: Fixos().itensApp.map((value) => DropdownMenuItem(
|
||||||
|
value: value,
|
||||||
|
child: TextCustom(
|
||||||
|
text: value,
|
||||||
|
color: Colors.black54,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
).toList(),
|
||||||
|
onChanged: (value){
|
||||||
|
setState(() {
|
||||||
|
selectApp = value.toString();
|
||||||
|
logs.clear();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: logs.length==0?Colors.white:PaletteColors.grey)
|
||||||
|
),
|
||||||
|
margin: EdgeInsets.symmetric(horizontal: width>900?width*0.08:width*0.05),
|
||||||
|
height: height*0.7,
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: logs.length,
|
||||||
|
itemBuilder: (context,index){
|
||||||
|
return ItemLog(logs: logs[index]);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -107,7 +107,14 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
if(map['NO_USERNAME']==map['SENHA']){
|
if(map['NO_USERNAME']==map['SENHA']){
|
||||||
if(map['NO_USERNAME']==inputLogin.text.toUpperCase() && map['SENHA']==inputSenha.text.toUpperCase()){
|
if(map['NO_USERNAME']==inputLogin.text.toUpperCase() && map['SENHA']==inputSenha.text.toUpperCase()){
|
||||||
showSnackBar(context, 'Acesso validado', Colors.green);
|
showSnackBar(context, 'Acesso validado', Colors.green);
|
||||||
List dados = [widget.cidade.toUpperCase(),map['NO_USUARIO_SISTEMA']??'',urlAPI,map['NO_FANTASIA']??'',map['CD_UNIDADE']??0];
|
List dados = [
|
||||||
|
widget.cidade.toUpperCase(),
|
||||||
|
map['NO_USUARIO_SISTEMA']??'',
|
||||||
|
urlAPI,map['NO_FANTASIA']??'',
|
||||||
|
map['CD_UNIDADE']??0,
|
||||||
|
map['NO_USERNAME'],
|
||||||
|
map['CD_USUARIO_SISTEMA'].toString()
|
||||||
|
];
|
||||||
Navigator.pushNamed(context, '/home',arguments: dados);
|
Navigator.pushNamed(context, '/home',arguments: dados);
|
||||||
}else{
|
}else{
|
||||||
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta e/ou Código incorreto', Colors.red);
|
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta e/ou Código incorreto', Colors.red);
|
||||||
@@ -117,7 +124,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
print(map);
|
print(map);
|
||||||
print(map['NO_USUARIO_SISTEMA']);
|
print(map['NO_USUARIO_SISTEMA']);
|
||||||
showSnackBar(context, 'Acesso validado', Colors.green);
|
showSnackBar(context, 'Acesso validado', Colors.green);
|
||||||
List dados = [widget.cidade.toUpperCase(),map['NO_USUARIO_SISTEMA']??'',urlAPI,map['NO_FANTASIA']??'',map['CD_UNIDADE']??0];
|
List dados = [widget.cidade.toUpperCase(),map['NO_USUARIO_SISTEMA']??'',urlAPI,map['NO_FANTASIA']??'',map['CD_UNIDADE']??0,map['NO_USERNAME'],map['CD_USUARIO_SISTEMA'].toString()];
|
||||||
Navigator.pushNamed(context, '/home',arguments: dados);
|
Navigator.pushNamed(context, '/home',arguments: dados);
|
||||||
}else{
|
}else{
|
||||||
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta e/ou Código incorreto', Colors.red);
|
showSnackBar(context, 'Login não cadastrado e/ou senha incorreta e/ou Código incorreto', Colors.red);
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
import '../controllers/main_controllers.dart';
|
||||||
import '../utils/colors.dart';
|
import '../utils/colors.dart';
|
||||||
import '../utils/fixos.dart';
|
|
||||||
import '../widgets/buttom_custom.dart';
|
import '../widgets/buttom_custom.dart';
|
||||||
import '../widgets/caixa_texto_container.dart';
|
import '../widgets/caixa_texto_container.dart';
|
||||||
import '../widgets/input_text.dart';
|
import '../widgets/input_text.dart';
|
||||||
@@ -37,6 +37,7 @@ class _ResponsibleRegisterScreenState extends State<ResponsibleRegisterScreen> {
|
|||||||
// var inputSenha = TextEditingController();
|
// var inputSenha = TextEditingController();
|
||||||
var inputData = TextEditingController();
|
var inputData = TextEditingController();
|
||||||
bool carregando = true;
|
bool carregando = true;
|
||||||
|
List dados = [];
|
||||||
|
|
||||||
bloquearResponsavel(int index,String CONDICAO)async{
|
bloquearResponsavel(int index,String CONDICAO)async{
|
||||||
final url = '${widget.alunoModel.URL}/inserirpais';
|
final url = '${widget.alunoModel.URL}/inserirpais';
|
||||||
@@ -56,6 +57,9 @@ class _ResponsibleRegisterScreenState extends State<ResponsibleRegisterScreen> {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
if(response.body == 'cadastrado com sucesso' || response.body == 'editado com sucesso'){
|
if(response.body == 'cadastrado com sucesso' || response.body == 'editado com sucesso'){
|
||||||
|
CONDICAO=='BLOQUEADO'
|
||||||
|
?MainControllers().salvarLog('LIBERADO O ACESSO DO USUARIO ${responsaveis[index].CPF}',dados)
|
||||||
|
:MainControllers().salvarLog('BLOQUEADO O ACESSO DO USUARIO ${responsaveis[index].CPF}',dados);
|
||||||
editando?
|
editando?
|
||||||
showSnackBar(context, 'Responsável alterado!', Colors.green):
|
showSnackBar(context, 'Responsável alterado!', Colors.green):
|
||||||
showSnackBar(context, 'Responsável adicionado!', Colors.green);
|
showSnackBar(context, 'Responsável adicionado!', Colors.green);
|
||||||
@@ -204,6 +208,17 @@ class _ResponsibleRegisterScreenState extends State<ResponsibleRegisterScreen> {
|
|||||||
}
|
}
|
||||||
carregando = false;
|
carregando = false;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
dadosLog();
|
||||||
|
}
|
||||||
|
dadosLog(){
|
||||||
|
dados = [
|
||||||
|
widget.alunoModel.cidade,
|
||||||
|
widget.alunoModel.login,
|
||||||
|
widget.alunoModel.URL,
|
||||||
|
'',
|
||||||
|
widget.alunoModel.CD_USUARIO,
|
||||||
|
widget.alunoModel.USER_USUARIO
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
paisBanco()async{
|
paisBanco()async{
|
||||||
@@ -225,6 +240,7 @@ class _ResponsibleRegisterScreenState extends State<ResponsibleRegisterScreen> {
|
|||||||
final response = await http.get(Uri.parse(url));
|
final response = await http.get(Uri.parse(url));
|
||||||
// print(response.body);
|
// print(response.body);
|
||||||
if(response.body == 'deletado com sucesso'){
|
if(response.body == 'deletado com sucesso'){
|
||||||
|
MainControllers().salvarLog('DELETADO OS DADOS DO USUARIO ${responsaveis[index].CPF}',dados);
|
||||||
responsaveis[index].CPF = '';
|
responsaveis[index].CPF = '';
|
||||||
responsaveis[index].SENHA='';
|
responsaveis[index].SENHA='';
|
||||||
responsaveis[index].CONDICAO='';
|
responsaveis[index].CONDICAO='';
|
||||||
|
|||||||
@@ -2,4 +2,9 @@ class Fixos{
|
|||||||
// static const String AMB_PROD = 'https://controle-educa-api.rkmsistemas.com.br';
|
// static const String AMB_PROD = 'https://controle-educa-api.rkmsistemas.com.br';
|
||||||
static const String AMB_HOMO = 'https://homol-controle-educa-api.rkmsistemas.com.br';
|
static const String AMB_HOMO = 'https://homol-controle-educa-api.rkmsistemas.com.br';
|
||||||
static const String AMB_DEV = 'http://192.168.18.2:8000';
|
static const String AMB_DEV = 'http://192.168.18.2:8000';
|
||||||
|
List<String> itensApp = [
|
||||||
|
'CONTROLE',
|
||||||
|
'PAIS',
|
||||||
|
'PROFESSORES'
|
||||||
|
];
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
import 'package:educa_controle_acesso/models/aluno_model.dart';
|
import 'package:educa_controle_acesso/models/aluno_model.dart';
|
||||||
import 'package:educa_controle_acesso/screens/responsible_register_screen.dart';
|
|
||||||
import 'package:educa_controle_acesso/widgets/text_custom.dart';
|
import 'package:educa_controle_acesso/widgets/text_custom.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../utils/colors.dart';
|
import '../utils/colors.dart';
|
||||||
import 'caixa_texto_container.dart';
|
|
||||||
|
|
||||||
class DadosAlunosContainer extends StatelessWidget {
|
class DadosAlunosContainer extends StatelessWidget {
|
||||||
|
|
||||||
|
|||||||
60
lib/widgets/item_log.dart
Normal file
60
lib/widgets/item_log.dart
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
import 'package:educa_controle_acesso/models/log_model.dart';
|
||||||
|
import 'package:educa_controle_acesso/widgets/text_custom.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class ItemLog extends StatelessWidget {
|
||||||
|
|
||||||
|
LogModel logs;
|
||||||
|
|
||||||
|
ItemLog({
|
||||||
|
required this.logs
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
|
|
||||||
|
double width = MediaQuery.of(context).size.width;
|
||||||
|
double height = MediaQuery.of(context).size.height;
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 5,vertical: 1),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: width*0.05,
|
||||||
|
child: TextCustom(text: logs.NRO_LOG.toString())
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: width*0.08,
|
||||||
|
child: TextCustom(text: logs.DATA)
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: width*0.1,
|
||||||
|
child: TextCustom(text: logs.CD_USUARIO),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: width*0.15,
|
||||||
|
child:
|
||||||
|
TextCustom(text: logs.NO_USUARIO),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: width*0.1,
|
||||||
|
child:
|
||||||
|
TextCustom(text: logs.SISTEMA),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: width*0.1,
|
||||||
|
child:
|
||||||
|
TextCustom(text: logs.CIDADE),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: width*0.25,
|
||||||
|
child:
|
||||||
|
TextCustom(text: logs.TELA),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user