exibido dados do Passe e frequencia dos alunos

This commit is contained in:
Reginaldo
2023-07-17 17:51:44 -03:00
parent 373ba0f498
commit 8ab2a8461d
9 changed files with 220 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 KiB

View File

@@ -4,7 +4,7 @@ import 'package:rkm_educa_app/utils/dimensoes.dart';
class ButtonCustom extends StatelessWidget{
final VoidCallback onPressed;
final String text;
final double size;
final double fontsize;
final Color colorButton;
final Color colorText;
final Color colorBorder;
@@ -14,7 +14,7 @@ class ButtonCustom extends StatelessWidget{
ButtonCustom({
required this.onPressed,
required this.text,
required this.size,
required this.fontsize,
required this.colorButton,
required this.colorText,
required this.colorBorder,
@@ -34,7 +34,7 @@ ButtonCustom({
child: Text(text,
style: TextStyle(
color: colorText,
fontSize: size,
fontSize: fontsize,
fontWeight: FontWeight.bold
),
) ,

View File

@@ -47,7 +47,7 @@ class _TelaDetalhesAvisosState extends State<TelaDetalhesAvisos> {
padding: EdgeInsets.symmetric(horizontal: Dimensoes.width*0.2),
child: ButtonCustom(
text: 'Marcar como lido',
size: 14,
fontsize: 14,
heightCustom: 0.05,
widthCustom: 0.3,
colorButton: PaletaCores.cinzaClaro,

View File

@@ -271,7 +271,7 @@ class _TelaLoginState extends State<TelaLogin> {
widthCustom: 0.7,
heightCustom: 0.07,
text: alterarSenha?'Alterar Senha':"Entrar",
size: 14.0,
fontsize: 14.0,
colorText: PaletaCores.branco,
colorButton: PaletaCores.corPrimaria,
colorBorder: PaletaCores.corPrimaria,

View File

@@ -1,9 +1,15 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:rkm_educa_app/componentes/appbar_custom.dart';
import 'package:rkm_educa_app/componentes/drawer_custom.dart';
import 'package:rkm_educa_app/componentes/snackBars.dart';
import 'package:rkm_educa_app/componentes/text_custom.dart';
import 'package:rkm_educa_app/modelos/estudante_modelo.dart';
import 'package:http/http.dart' as http;
import 'package:rkm_educa_app/utils/dimensoes.dart';
import '../componentes/buttom_custom.dart';
import '../controllers/main_controllers.dart';
import '../utils/cores.dart';
class TelaPasse extends StatefulWidget {
EstudanteModelo estudanteModelo;
@@ -18,10 +24,109 @@ class TelaPasse extends StatefulWidget {
class _TelaPasseState extends State<TelaPasse> {
List dadosPasse=[];
List dadosFrequncia = [];
bool carregando = true;
String dataNasc = '';
String dataEmissao = '';
getPasse()async{
String teste_passe = '4E275A169EA2432E949FF90DF8D2CF10';
String passe = widget.estudanteModelo.dados[widget.estudanteModelo.nroAluno]['CD_ALUNO'];
final url = 'http://192.168.18.2:8000/passe?CD_ALUNO=${teste_passe}&CIDADE=${widget.estudanteModelo.cidade}';
print(url);
final response = await http.get(Uri.parse(url));
var map = json.decode(response.body);
dadosPasse = map;
print(dadosPasse);
String dataBD = dadosPasse[0]['DT_NASCIMENTO']??'';
if(dataBD!=''){
dataNasc = '${dataBD.substring(6,8)} / ${dataBD.substring(4,6)} / ${dataBD.substring(0,4)}';
}
String dataDBEmissao = dadosPasse[0]['VALIDADE_CARTEIRINHA']??'';
if(dataDBEmissao!=''){
List list = dataDBEmissao.toString().split('-');
dataEmissao = '${list[2]} / ${list[1]} / ${list[0]}';
}
if(dadosPasse.length==0){
showSnackBar(context, 'Nenhum passe disponível', Colors.red);
carregando = false;
setState(() {});
}else{
getFrequencia(teste_passe);
}
}
getFrequencia(String CD_ALUNO)async{
dadosFrequncia.clear();
final url = 'http://192.168.18.2:8000/frequencia?CD_ALUNO=${CD_ALUNO}&CIDADE=${widget.estudanteModelo.cidade}';
print(url);
final response = await http.get(Uri.parse(url));
var map = json.decode(response.body);
dadosFrequncia = map;
print(dadosFrequncia);
if(dadosPasse.length==0){
showSnackBar(context, 'Nenhuma frequência registrada', Colors.red);
}else{
dadosFrequncia = [
{'DIA':1,'PRESENTE':0},
{'DIA':2,'PRESENTE':0},
{'DIA':3,'PRESENTE':1},
{'DIA':4,'PRESENTE':1},
{'DIA':5,'PRESENTE':1},
{'DIA':6,'PRESENTE':0},
{'DIA':7,'PRESENTE':0},
{'DIA':8,'PRESENTE':1},
{'DIA':9,'PRESENTE':1},
{'DIA':10,'PRESENTE':1},
{'DIA':11,'PRESENTE':1},
{'DIA':12,'PRESENTE':1},
{'DIA':13,'PRESENTE':1},
{'DIA':14,'PRESENTE':1},
{'DIA':15,'PRESENTE':1},
{'DIA':16,'PRESENTE':1},
{'DIA':17,'PRESENTE':1},
{'DIA':18,'PRESENTE':0},
{'DIA':19,'PRESENTE':0},
{'DIA':20,'PRESENTE':0},
{'DIA':21,'PRESENTE':0},
{'DIA':22,'PRESENTE':0},
{'DIA':23,'PRESENTE':0},
{'DIA':24,'PRESENTE':0},
{'DIA':25,'PRESENTE':0},
{'DIA':26,'PRESENTE':0},
{'DIA':27,'PRESENTE':0},
{'DIA':28,'PRESENTE':0},
{'DIA':29,'PRESENTE':0},
{'DIA':30,'PRESENTE':0},
{'DIA':31,'PRESENTE':0},
];
}
carregando = false;
setState(() {});
// print(dadosFrequncia);
}
getCarteira()async{
carregando = true;
setState(() {});
String teste_passe = '4E275A169EA2432E949FF90DF8D2CF10';
String CD_ALUNO = widget.estudanteModelo.dados[widget.estudanteModelo.nroAluno]['CD_ALUNO'];
final url = 'http://192.168.18.2:8000/carteira?CD_ALUNO=${teste_passe}&CIDADE=${widget.estudanteModelo.cidade}';
print(url);
final response = await http.get(Uri.parse(url));
var map = json.decode(response.body);
List list = map;
print(list);
carregando = false;
setState(() {});
}
@override
void initState() {
super.initState();
MainControllers().salvarLog(widget.estudanteModelo, 'PASSE');
getPasse();
}
@override
@@ -29,6 +134,113 @@ class _TelaPasseState extends State<TelaPasse> {
return Scaffold(
appBar: AppBarCustom().appbar(context, 'PASSE ESCOLAR'),
drawer: DrawerCustom(estudanteModelo: widget.estudanteModelo),
bottomSheet: carregando?SizedBox(width: 0,height: 0,): Container(
width: Dimensoes.width,
height: 70,
alignment: Alignment.center,
child: ButtonCustom(
text: 'Exibir Carteira',
fontsize: 14.0,
colorBorder: PaletaCores.cinzaClaro,
colorButton: PaletaCores.cinzaClaro,
colorText: Colors.white,
widthCustom: 0.8,
heightCustom: 0.05,
onPressed: ()=>getCarteira(),
),
),
body: carregando?Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircularProgressIndicator(color: PaletaCores.cinzaClaro,),
SizedBox(width: 20,),
TextCustom(text: 'Buscando dados ...')
],
),
):Container(
alignment: Alignment.center,
margin: EdgeInsets.all(10),
height: Dimensoes.height,
child: ListView(
children: [
Container(
color: Colors.black,
child: TextCustom(text: widget.estudanteModelo.NO_ALUNO,fontWeight: FontWeight.bold,color: Colors.white,textAlign: TextAlign.center),
),
Row(
children: [
Column(
children: [
Container(
width: Dimensoes.width*0.55,
child: TextCustom(text: 'RA: ${dadosPasse[0]['NR_RA']}',size: 14.0, fontWeight: FontWeight.bold)
),
Container(
width: Dimensoes.width*0.55,
child: TextCustom(text: 'DATA NASC: $dataNasc',size: 14.0, fontWeight: FontWeight.bold,)
),
],
),
Container(
width: Dimensoes.width*0.4,
alignment: Alignment.center,
child: TextCustom(text: 'CARTEIRA N°: ${dadosPasse[0]['NR_CARTEIRA']}',size: 16.0, fontWeight: FontWeight.bold,)
),
],
),
TextCustom(text: 'DATA EMISSÃO: $dataEmissao',size: 14.0, fontWeight: FontWeight.bold,),
TextCustom(text: 'LINHA: ${dadosPasse[0]['NR_TRANSPORTE']}',size: 14.0, fontWeight: FontWeight.bold,),
TextCustom(text: 'SÉRIE: ${dadosPasse[0]['DESC_SERIE']} - ${dadosPasse[0]['GRAU']}'
' TURNO: ${dadosPasse[0]['TURNO'].toString().trim()=='1'?'MANHÃ':dadosPasse[0]['GRAU'].toString().trim()=='2'?'TARDE':''}',size: 14.0, fontWeight: FontWeight.bold,),
TextCustom(text: 'ESCOLA: ${widget.estudanteModelo.ESCOLA}',size: 14.0, fontWeight: FontWeight.bold,),
Container(
margin: EdgeInsets.symmetric(vertical: 20),
color: Colors.black,
alignment: Alignment.center,
child: TextCustom(text: 'FREQUÊNCIA USO DO PASSE MÊS ${DateTime.now().month}',fontWeight: FontWeight.bold,color: Colors.white,),
),
Container(
width: Dimensoes.width*0.9,
height: Dimensoes.height*0.5,
child: GridView.builder(
physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 7,
mainAxisSpacing: 25,
crossAxisSpacing: 0
),
itemCount: dadosFrequncia.length,
itemBuilder: (context,index){
return Container(
height: 40,
width: 40,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
alignment: Alignment.center,
width: 20,
height: 15,
child: TextCustom(text: dadosFrequncia[index]['DIA'].toString(),size: 15.0,)),
Container(
width: 30,
height: 30,
child: Checkbox(
value: dadosFrequncia[index]['PRESENTE'].toString()=='1'?true:false,
onChanged: (v){},
activeColor: PaletaCores.cinzaClaro,
),
)
],
),
);
}
),
),
],
)
),
);
}
}

View File

@@ -83,7 +83,7 @@ class _TelaPerfilState extends State<TelaPerfil> {
text: 'Fechar',
widthCustom: 0.2,
heightCustom: 0.05,
size: 14,
fontsize: 14,
colorText: Colors.white,
colorBorder: PaletaCores.cinza,
colorButton: PaletaCores.cinza,

View File

@@ -137,7 +137,7 @@ class _TelaSelecionaFilhoState extends State<TelaSelecionaFilho> {
widthCustom: 0.7,
heightCustom: 0.07,
text: "Avançar",
size:14,
fontsize:14,
colorText: PaletaCores.branco,
colorButton: PaletaCores.corPrimaria,
colorBorder: PaletaCores.corPrimaria,