From ad183d0f185c19b95e37f1b26a237b7a5135b74a Mon Sep 17 00:00:00 2001 From: Reginaldo Date: Fri, 15 Sep 2023 11:42:30 -0300 Subject: [PATCH] ajustes do historico escolar e carteirinha --- lib/componentes/drawer_custom.dart | 17 ++++++++--- lib/main.dart | 3 ++ lib/telas/tela_botetim.dart | 29 +++++++++++++++++-- lib/telas/tela_cadastro.dart | 5 ++-- lib/telas/tela_historico.dart | 2 +- lib/telas/tela_passe.dart | 46 ++++++++++++++++-------------- 6 files changed, 72 insertions(+), 30 deletions(-) diff --git a/lib/componentes/drawer_custom.dart b/lib/componentes/drawer_custom.dart index 82b8e2b..d2017bd 100644 --- a/lib/componentes/drawer_custom.dart +++ b/lib/componentes/drawer_custom.dart @@ -72,12 +72,12 @@ class DrawerCustom extends StatelessWidget { Container(height: 1,color: PaletaCores.divider,margin: EdgeInsets.symmetric(horizontal: 20),), ItemDrawer( icone: LineIcons.clipboardList, - texto: 'Boletim Escolar', + texto: 'Boletim Escolar ${DateTime.now().year}', onPressed: ()=>Navigator.push(context, MaterialPageRoute( builder: (context)=> TelaBoletim( estudanteModelo: alunos[indiceFilhos], - ano: '2023', + ano: '${DateTime.now().year}', turma: "${alunos[indiceFilhos].dados[alunos[indiceFilhos].nroAluno]['DESC_SERIE']} ${alunos[indiceFilhos].dados[alunos[indiceFilhos].nroAluno]['TURMA']}", matricula: alunos[indiceFilhos].dados[alunos[indiceFilhos].nroAluno]['CD_MATRICULA'].toString() ) @@ -87,8 +87,17 @@ class DrawerCustom extends StatelessWidget { Container(height: 1,color: PaletaCores.divider,margin: EdgeInsets.symmetric(horizontal: 20),), ItemDrawer( icone: LineIcons.fileContract, - texto: 'Histórico Escolar', - onPressed: ()=>Navigator.push(context, MaterialPageRoute(builder: (context)=>TelaHistorico(alunos: alunos,indiceAluno: indiceFilhos))), + texto: 'Boletim Escolar ${DateTime.now().year-1}', + onPressed: ()=> Navigator.push(context, + MaterialPageRoute(builder: (context)=> + TelaBoletim( + estudanteModelo: alunos[indiceFilhos], + ano: '${DateTime.now().year-1}', + turma: "${alunos[indiceFilhos].dados[alunos[indiceFilhos].nroAluno]['DESC_SERIE']} ${alunos[indiceFilhos].dados[alunos[indiceFilhos].nroAluno]['TURMA']}", + matricula: alunos[indiceFilhos].dados[alunos[indiceFilhos].nroAluno]['CD_MATRICULA'].toString() + ) + ) + ), ), Container(height: 1,color: PaletaCores.divider,margin: EdgeInsets.symmetric(horizontal: 20),), ItemDrawer( diff --git a/lib/main.dart b/lib/main.dart index 3023d66..b48e0cf 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,6 @@ import 'dart:io'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:rkm_educa_app/telas/tela_splash.dart'; @@ -12,6 +13,8 @@ class PostHttpOverrides extends HttpOverrides{ } void main() { + WidgetsFlutterBinding.ensureInitialized(); + SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); HttpOverrides.global = new PostHttpOverrides(); runApp(MyApp()); } diff --git a/lib/telas/tela_botetim.dart b/lib/telas/tela_botetim.dart index 2e51602..5497648 100644 --- a/lib/telas/tela_botetim.dart +++ b/lib/telas/tela_botetim.dart @@ -38,6 +38,31 @@ class _TelaBoletimState extends State { List listDisciplinas3 = []; List listDisciplinas4 = []; bool carregando = true; + String matricula = ''; + + getMatriculas()async{ + String cd = widget.estudanteModelo.dados[widget.estudanteModelo.nroAluno]['CD_ALUNO']; + final url = '${widget.estudanteModelo.URL}/matriculas_aluno?CD_ALUNO=$cd&CIDADE=${widget.estudanteModelo.cidade}'; + print(url); + final response = await http.get(Uri.parse(url)); + var map = json.decode(response.body); + List list0 = map; + List list = list0.reversed.toList(); + print(map); + if(list.length!=0){ + for(int i=0; list.length>i;i++){ + if('${list[i]['ANO_FREQ']}'.toString().trim() == widget.ano){ + widget.matricula = list[i]['CD_MATRICULA'].toString(); + widget.turma = '${list[i]['DESC_SERIE']} ${list[i]['TURMA']}'; + } + } + buscarNotas(); + }else{ + showSnackBar(context, 'Notas não encontradas!', Colors.red); + carregando = false; + setState((){}); + } + } buscarNotas()async{ @@ -146,14 +171,14 @@ class _TelaBoletimState extends State { @override void initState() { super.initState(); - buscarNotas(); + getMatriculas(); MainControllers().salvarLog(widget.estudanteModelo, 'BOLETIM'); } @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBarCustom().appbar(context, 'BOLETIM ESCOLAR'), + appBar: AppBarCustom().appbar(context, 'BOLETIM ESCOLAR ${widget.ano}'), // drawer: DrawerCustom(estudanteModelo: widget.estudanteModelo), body: carregando?Center( child: Row( diff --git a/lib/telas/tela_cadastro.dart b/lib/telas/tela_cadastro.dart index 1124f5a..a59f345 100644 --- a/lib/telas/tela_cadastro.dart +++ b/lib/telas/tela_cadastro.dart @@ -107,7 +107,7 @@ class _TelaCadastroState extends State { criarNumero(){ var random = Random(); - nroSMS = (random.nextInt(9000) + 1000).toString(); + nroSMS = (random.nextInt(900000) + 100000).toString(); apiSMS(); } @@ -116,7 +116,8 @@ class _TelaCadastroState extends State { final String authToken = '6nPV7rkTncLaugyoEBHQklHrvD5-GzDVMCeI'; final headers = { 'Content-Type': 'application/json', - 'Authorization':'Y2FicmV1dmEucmVzdDo0U0lmYktjUTgy', + 'Authorization':'cmttc2lzdGVtYXMucmVzdDp5Nkc5TnNlNDVV', + // 'Authorization':'Y2FicmV1dmEucmVzdDo0U0lmYktjUTgy', 'Cache-Control': 'no-cache' }; diff --git a/lib/telas/tela_historico.dart b/lib/telas/tela_historico.dart index e53e682..36b8803 100644 --- a/lib/telas/tela_historico.dart +++ b/lib/telas/tela_historico.dart @@ -77,7 +77,7 @@ class _TelaHistoricoState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBarCustom().appbar(context, 'HISTÓRICO ESCOLAR'), + appBar: AppBarCustom().appbar(context, 'BOLETIM ESCOLAR ${DateTime.now().year-1}'), drawer: DrawerCustom(alunos:widget.alunos,indiceFilhos: widget.indiceAluno), body: carregando?Center( child: Row( diff --git a/lib/telas/tela_passe.dart b/lib/telas/tela_passe.dart index 06a38fb..216fcf4 100644 --- a/lib/telas/tela_passe.dart +++ b/lib/telas/tela_passe.dart @@ -33,11 +33,13 @@ class _TelaPasseState extends State { bool carregando = true; String dataNasc = ''; String dataEmissao = ''; + double borda = 1.0; getPasse()async{ String teste_passe = '4E275A169EA2432E949FF90DF8D2CF10'; - String passe = widget.alunos[widget.indiceAluno].dados[widget.indiceAluno]['CD_ALUNO']; - final url = '${widget.alunos[widget.indiceAluno].URL}/passe?CD_ALUNO=${passe}&CIDADE=${widget.alunos[widget.indiceAluno].cidade}'; + //aqui + // String passe = widget.alunos[widget.indiceAluno].dados[widget.indiceAluno]['CD_ALUNO']; + final url = '${widget.alunos[widget.indiceAluno].URL}/passe?CD_ALUNO=${teste_passe}&CIDADE=${widget.alunos[widget.indiceAluno].cidade}'; print(url); final response = await http.get(Uri.parse(url)); var map = json.decode(response.body); @@ -63,7 +65,8 @@ class _TelaPasseState extends State { carregando = false; setState(() {}); }else{ - getFrequencia(passe); + //aqui + getFrequencia(teste_passe); } } } @@ -122,8 +125,9 @@ class _TelaPasseState extends State { carregando = true; setState(() {}); String teste_passe = '4E275A169EA2432E949FF90DF8D2CF10'; - String CD_ALUNO = widget.alunos[widget.indiceAluno].dados[widget.indiceAluno]['CD_ALUNO']; - final url = '${widget.alunos[widget.indiceAluno].URL}/carteira?CD_ALUNO=${CD_ALUNO}&CIDADE=${widget.alunos[widget.indiceAluno].cidade}'; + //aqui + // String CD_ALUNO = widget.alunos[widget.indiceAluno].dados[widget.indiceAluno]['CD_ALUNO']; + final url = '${widget.alunos[widget.indiceAluno].URL}/carteira?CD_ALUNO=${teste_passe}&CIDADE=${widget.alunos[widget.indiceAluno].cidade}'; print(url); final response = await http.get(Uri.parse(url)); var map = json.decode(response.body); @@ -146,9 +150,9 @@ class _TelaPasseState extends State { Container( alignment: Alignment.topCenter, width: 378, - height: 270, + height: 268, decoration: BoxDecoration( - border: Border.all(width: 2.0) + border: Border.all(width: borda) ), child: Column( children: [ @@ -160,18 +164,18 @@ class _TelaPasseState extends State { height: 159, alignment: Alignment.center, decoration: BoxDecoration( - border: Border.all(width: 2.0) + border: Border.all(width: borda) ), child: TextCustom(text: '3x4',size: 12.0,fontWeight: FontWeight.bold,color: Colors.black,), ), Column( children: [ Container( - width: 235, + width: 237, height: 65, alignment: Alignment.center, decoration: BoxDecoration( - border: Border.all(width: 2.0) + border: Border.all(width: borda) ), child: Row( children: [ @@ -185,26 +189,26 @@ class _TelaPasseState extends State { ), ), Container( - width: 235, + width: 237, height: 20, decoration: BoxDecoration( - border: Border.all(width: 2.0) + border: Border.all(width: borda) ), child: TextCustom(text: '1ª Via - Transporte Escolar',size: 12.0,fontWeight: FontWeight.bold,color: Colors.black,), ), Container( - width: 235, + width: 237, height: 20, decoration: BoxDecoration( - border: Border.all(width: 2.0) + border: Border.all(width: borda) ), child: TextCustom(text: 'RA: ${dadosCarteira[0]['NR_RA']}',size: 12.0,fontWeight: FontWeight.bold,color: Colors.black,), ), Container( - width: 235, + width: 237, height: 54, decoration: BoxDecoration( - border: Border.all(width: 2.0) + border: Border.all(width: borda) ), child: TextCustom(text: 'Nome: ${dadosCarteira[0]['NO_ALUNO']}',size: 12.0,fontWeight: FontWeight.bold,color: Colors.black), ), @@ -216,7 +220,7 @@ class _TelaPasseState extends State { width: 373, height: 27.5, decoration: BoxDecoration( - border: Border.all(width: 2.0) + border: Border.all(width: borda) ), child: TextCustom(text: ' Endereço: ${dadosCarteira[0]['NO_LOGRADOURO']}, ${dadosCarteira[0]['NR_LOGRADOURO']}, ${dadosCarteira[0]['DESC_BAIRRO']}',size: 12.0,fontWeight: FontWeight.bold,color: Colors.black,), ), @@ -224,7 +228,7 @@ class _TelaPasseState extends State { width: 373, height: 26.5, decoration: BoxDecoration( - border: Border.all(width: 2.0) + border: Border.all(width: borda) ), child: TextCustom( text: ' Fone: (${dadosCarteira[0]['NR_DDD_TELEFONE']}) ${dadosCarteira[0]['NR_TELEFONE']} Escola: ${dadosCarteira[0]['NO_FANTASIA']}', @@ -234,7 +238,7 @@ class _TelaPasseState extends State { width: 373, height: 26.5, decoration: BoxDecoration( - border: Border.all(width: 2.0) + border: Border.all(width: borda) ), child: TextCustom( text: ' Celular: (${dadosCarteira[0]['NR_DDD_CELULAR']}) ${dadosCarteira[0]['NR_CELULAR']} Validade: ${dadosCarteira[0]['VALIDADE_CARTEIRINHA']} CEAC: ${dadosCarteira[0]['CEAC'].toString().trim()=='N'?'NÃO':'SIM'}', @@ -244,7 +248,7 @@ class _TelaPasseState extends State { width: 373, height: 26.5, decoration: BoxDecoration( - border: Border.all(width: 2.0) + border: Border.all(width: borda) ), child: TextCustom(text: ' Tipo Transp.: ${dadosCarteira[0]['FL_TIPO_TRANSPORTE'].toString().trim()=='R'?'TRANSPORTE MUNICIPAL':'TRANSPORTE INTERMUNICIPAL'}',size: 12.0,fontWeight: FontWeight.bold,color: Colors.black,), ), @@ -255,7 +259,7 @@ class _TelaPasseState extends State { width: 378, height: 270, decoration: BoxDecoration( - border: Border.all(width: 4.0) + border: Border.all(width: borda*2) ), child: Row( children: [