salvas novas notas no banco na tela_notas.dart e ajustado a tela_faltas.dart
This commit is contained in:
@@ -57,6 +57,7 @@ class _TelaFaltasState extends State<TelaFaltas> {
|
||||
String SIGLA_TIPO_ENSINO = '';
|
||||
List<int> DIARIO_CLASSE = [];
|
||||
bool SALVANDO = false;
|
||||
|
||||
EventList<Event> _markedDateMap = new EventList<Event>(
|
||||
events: {},
|
||||
);
|
||||
@@ -98,11 +99,12 @@ class _TelaFaltasState extends State<TelaFaltas> {
|
||||
TURMA: list[i]['TURMA'].toString().trim(),
|
||||
DESC_SERIE: list[i]['DESC_SERIE'].toString().trim(),
|
||||
GRAU: list[i]['GRAU'].toString().trim(),
|
||||
HR_INICIO: list[i]['GRAU'].toString().trim()
|
||||
HR_INICIO: list[i]['HR_INICIO'].toString().trim()
|
||||
)
|
||||
);
|
||||
|
||||
turmas.add(
|
||||
'${disciplinas[i].GRAU} - ${disciplinas[i].DESC_SERIE} - ${disciplinas[i].TURMA} - ${disciplinas[i].HR_INICIO=='07:00:00'?'MANHA':'TARDE'}'
|
||||
'${disciplinas[i].GRAU} - ${disciplinas[i].DESC_SERIE} - ${disciplinas[i].TURMA} - ${disciplinas[i].HR_INICIO.toString().trim().toUpperCase()=='07:00:00'?'MANHA':'TARDE'}'
|
||||
);
|
||||
if(SIGLA_TIPO_ENSINO != disciplinas[i].GRAU.toString().trim().toUpperCase()){
|
||||
SIGLA_TIPO_ENSINO = disciplinas[i].GRAU.toString().trim().toUpperCase();
|
||||
@@ -128,6 +130,7 @@ class _TelaFaltasState extends State<TelaFaltas> {
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
buscarPediodoDatas(String id)async{
|
||||
final url = '${widget.dados[2]}/buscarintervalodatas?ID_TIPO_ENSINO=${ID_TIPO_ENSINO}&ANO=${DateTime.now().year}-01-01&NR_SEQUENCIA=${id}&CIDADE=${widget.dados[0]}';
|
||||
print(url);
|
||||
@@ -188,7 +191,7 @@ class _TelaFaltasState extends State<TelaFaltas> {
|
||||
// print(diasSemana);
|
||||
// print('aulas');
|
||||
// print(AULAS);
|
||||
buscarchamadasrealizadas();
|
||||
buscarChamadasRealizadas();
|
||||
}else{
|
||||
showSnackBar(context, 'Selecione uma data!', Colors.red);
|
||||
}
|
||||
@@ -197,7 +200,7 @@ class _TelaFaltasState extends State<TelaFaltas> {
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
buscarchamadasrealizadas()async{
|
||||
buscarChamadasRealizadas()async{
|
||||
String dia = _dataSelecionada!.day.toString();
|
||||
String mes = _dataSelecionada!.month.toString();
|
||||
String ano = _dataSelecionada!.year.toString();
|
||||
@@ -210,7 +213,6 @@ class _TelaFaltasState extends State<TelaFaltas> {
|
||||
// print(map);
|
||||
if(map.isNotEmpty){
|
||||
alunos.clear();
|
||||
ModeloPresencaAluno? modeloPresencaAluno;
|
||||
for(int i = 0; map.length > i; i++){
|
||||
|
||||
int indexAluno = alunos.indexWhere((aluno) => aluno.CD_MATRICULA == map[i]['CD_MATRICULA']);
|
||||
@@ -324,6 +326,7 @@ class _TelaFaltasState extends State<TelaFaltas> {
|
||||
|
||||
buscarDiarioClasse(dia, mes, ano, map[0]['CD_CALENDARIO']);
|
||||
}
|
||||
|
||||
buscarDiarioClasse(String dia, String mes, String ano,int CD_CALENDARIO)async{
|
||||
List<int> buscaAulas = [];
|
||||
for(int i = 0; AULAS.length > i; i++){
|
||||
@@ -357,7 +360,7 @@ class _TelaFaltasState extends State<TelaFaltas> {
|
||||
bool SALVAMENTO_BANCO = await MainControllers().verificarDadosNovaChamada(alunos,widget.dados);
|
||||
if(SALVAMENTO_BANCO){
|
||||
showSnackBar(context, 'CHAMADA FOI SALVA', Colors.green);
|
||||
buscarchamadasrealizadas();
|
||||
buscarChamadasRealizadas();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -450,54 +453,65 @@ class _TelaFaltasState extends State<TelaFaltas> {
|
||||
return Scaffold(
|
||||
appBar: AppBarCustom().appbar(context, 'LANÇAMENTO DE FALTAS'),
|
||||
drawer: DrawerCustom(dados: widget.dados,),
|
||||
floatingActionButton: exibirCalendario?Container():edit?Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SALVANDO?Container():CircleAvatar(
|
||||
backgroundColor: Colors.red,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.clear,color: Colors.white,),
|
||||
onPressed: (){
|
||||
setState(()=>edit=false);
|
||||
buscarGrade(CD_SALA,CD_DISCIPLINA);
|
||||
}
|
||||
bottomNavigationBar: SALVANDO?Container(width: 0,height: 0,):exibirCalendario?Container(height: 0,width: 0,):edit?Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SALVANDO?Container():CircleAvatar(
|
||||
backgroundColor: Colors.red,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.clear,color: Colors.white,),
|
||||
onPressed: (){
|
||||
setState(()=>edit=false);
|
||||
buscarGrade(CD_SALA,CD_DISCIPLINA);
|
||||
}
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10,),
|
||||
SALVANDO?Container():CircleAvatar(
|
||||
backgroundColor: PaletaCores.verdeCalendario,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.check,color: Colors.white,),
|
||||
onPressed: ()async{
|
||||
if(novaChamada){
|
||||
setState(()=>SALVANDO = true);
|
||||
buscarCodigoCalendario();
|
||||
}else{
|
||||
setState(()=>SALVANDO = true);
|
||||
bool aguardandoAlteracao = await MainControllers().atualizarChamada(alunos,widget.dados);
|
||||
if(aguardandoAlteracao){
|
||||
buscarchamadasrealizadas();
|
||||
setState(()=>SALVANDO = false);
|
||||
setState(()=>edit=false);
|
||||
showSnackBar(context, 'DADOS SALVOS COM SUCESSO', Colors.green);
|
||||
SizedBox(width: 10,),
|
||||
SALVANDO?Container():CircleAvatar(
|
||||
backgroundColor: PaletaCores.verdeCalendario,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.check,color: Colors.white,),
|
||||
onPressed: ()async{
|
||||
if(novaChamada){
|
||||
setState(()=>SALVANDO = true);
|
||||
buscarCodigoCalendario();
|
||||
}else{
|
||||
setState(()=>SALVANDO = false);
|
||||
showSnackBar(context, 'DADOS NÃO FORAM SALVOS', Colors.red);
|
||||
setState(()=>SALVANDO = true);
|
||||
bool aguardandoAlteracao = await MainControllers().atualizarChamada(alunos,widget.dados);
|
||||
if(aguardandoAlteracao){
|
||||
buscarChamadasRealizadas();
|
||||
setState(()=>SALVANDO = false);
|
||||
setState(()=>edit=false);
|
||||
showSnackBar(context, 'DADOS SALVOS COM SUCESSO', Colors.green);
|
||||
}else{
|
||||
setState(()=>SALVANDO = false);
|
||||
showSnackBar(context, 'DADOS NÃO FORAM SALVOS', Colors.red);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
),
|
||||
],
|
||||
):CircleAvatar(
|
||||
backgroundColor: Colors.deepOrangeAccent,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.edit, color: Colors.white),
|
||||
onPressed: ()=> setState(()=>edit=true)
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
):Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
backgroundColor: Colors.deepOrangeAccent,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.edit, color: Colors.white),
|
||||
onPressed: ()=> setState(()=>edit=true)
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: exibirCalendario?Container(
|
||||
child: ListView(
|
||||
children: [
|
||||
@@ -630,7 +644,7 @@ class _TelaFaltasState extends State<TelaFaltas> {
|
||||
children: [
|
||||
CircularProgressIndicator(color: Colors.deepOrangeAccent),
|
||||
SizedBox(height: 50),
|
||||
TextCustom(text: 'Salvando dados dos estudantes.\nAguarde...', fontWeight: FontWeight.bold,)
|
||||
TextCustom(text: 'Salvando dados dos estudantes.\nAguarde...', fontWeight: FontWeight.bold,maxLines: 2,)
|
||||
],
|
||||
),
|
||||
):Container(),
|
||||
|
||||
@@ -75,7 +75,8 @@ class _TelaLoginState extends State<TelaLogin> {
|
||||
inputLogin.text,//5
|
||||
usuario,//6
|
||||
inputSenha.text,//7
|
||||
map['CD_USUARIO_SISTEMA'].toString()//8
|
||||
map['CD_USUARIO_SISTEMA'].toString(),//8
|
||||
map['CD_LOGIN'].toString(),//9
|
||||
];
|
||||
_prefService.createCacheLogin(dados).then((value){
|
||||
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => TelaHome(dados: dados) ));
|
||||
@@ -99,7 +100,8 @@ class _TelaLoginState extends State<TelaLogin> {
|
||||
inputLogin.text,//5
|
||||
usuario,//6
|
||||
inputSenha.text,//7
|
||||
map['CD_USUARIO_SISTEMA'].toString()//8
|
||||
map['CD_USUARIO_SISTEMA'].toString(),//8
|
||||
map['CD_LOGIN'].toString(),//9
|
||||
];
|
||||
_prefService.createCacheLogin(dados).then((value) =>
|
||||
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => TelaHome(dados: dados) )));
|
||||
|
||||
@@ -1,6 +1,23 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:rkm_educa_prof_app/componentes/item_aluno_nota.dart';
|
||||
import '../componentes/appbar_custom.dart';
|
||||
import '../componentes/drawer_custom.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../componentes/dropdown_disciplina.dart';
|
||||
import '../componentes/dropdown_periodo.dart';
|
||||
import '../componentes/dropdown_turma.dart';
|
||||
import '../componentes/item_subtitulo_texto.dart';
|
||||
import '../componentes/snackBars.dart';
|
||||
import '../componentes/text_custom.dart';
|
||||
import '../controllers/main_controllers.dart';
|
||||
import '../modelos/modelo_disciplina.dart';
|
||||
import '../modelos/modelo_nota_aluno.dart';
|
||||
import '../modelos/modelo_periodo.dart';
|
||||
import '../utils/cores.dart';
|
||||
import '../utils/dimensoes.dart';
|
||||
|
||||
class TelaNotas extends StatefulWidget {
|
||||
List dados;
|
||||
@@ -14,12 +31,358 @@ class TelaNotas extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _TelaNotasState extends State<TelaNotas> {
|
||||
|
||||
List<ModeloDisciplina> disciplinas = [];
|
||||
List<ModeloPeriodo> periodos = [];
|
||||
List tipoEnsino = [];
|
||||
List turmas = [];
|
||||
String SIGLA_TIPO_ENSINO = '';
|
||||
String? selecionaTurma;
|
||||
double hightLine = 40;
|
||||
bool edit = false;
|
||||
ModeloDisciplina? selecionaDisciplina;
|
||||
ModeloPeriodo? selecionaPeriodo;
|
||||
int ID_TIPO_ENSINO = 0;
|
||||
int CD_DISCIPLINA = 0;
|
||||
int CD_SALA = 0;
|
||||
String CD_PERIODO = '';
|
||||
List<ModeloNotaAluno> alunos = [];
|
||||
bool novaNota = false;
|
||||
bool SALVANDO = false;
|
||||
|
||||
buscarDisciplinas()async{
|
||||
// print('dados');
|
||||
// print(widget.dados);
|
||||
final url = '${widget.dados[2]}/buscardisciplinasprof?USUARIO_SISTEMA=${widget.dados[8]}&CIDADE=${widget.dados[0]}&ANO=${DateTime.now().year}';
|
||||
// print(url);
|
||||
final response = await http.get(Uri.parse(url));
|
||||
var map = json.decode(response.body);
|
||||
// print(map);
|
||||
List list = map;
|
||||
for(int i = 0; list.length > i; i++){
|
||||
tipoEnsino.add(list[i]['CD_TIPO_ENSINO']);
|
||||
disciplinas.add(
|
||||
ModeloDisciplina(
|
||||
CD_ANO_DISCIPLINA: list[i]['CD_ANO_DISCIPLINA'],
|
||||
CD_CAD_DIVERSO: list[i]['CD_CAD_DIVERSO'],
|
||||
CD_SALA: list[i]['CD_SALA'],
|
||||
CD_SERIE: list[i]['CD_SERIE'],
|
||||
ANO_ATRIBUICAO: list[i]['ANO_ATRIBUICAO'],
|
||||
CD_DISCIPLINA: list[i]['CD_DISCIPLINA'],
|
||||
CD_TIPO_ENSINO: list[i]['CD_TIPO_ENSINO'],
|
||||
DESCRICAO: list[i]['DESCRICAO'],
|
||||
ABREVIATURA: list[i]['ABREVIATURA'],
|
||||
TURMA: list[i]['TURMA'].toString().trim(),
|
||||
DESC_SERIE: list[i]['DESC_SERIE'].toString().trim(),
|
||||
GRAU: list[i]['GRAU'].toString().trim(),
|
||||
HR_INICIO: list[i]['HR_INICIO'].toString().trim()
|
||||
)
|
||||
);
|
||||
|
||||
turmas.add(
|
||||
'${disciplinas[i].GRAU} - ${disciplinas[i].DESC_SERIE} - ${disciplinas[i].TURMA} - ${disciplinas[i].HR_INICIO.toString().trim().toUpperCase()=='07:00:00'?'MANHA':'TARDE'}'
|
||||
);
|
||||
if(SIGLA_TIPO_ENSINO != disciplinas[i].GRAU.toString().trim().toUpperCase()){
|
||||
SIGLA_TIPO_ENSINO = disciplinas[i].GRAU.toString().trim().toUpperCase();
|
||||
}
|
||||
if(turmas.isNotEmpty){
|
||||
List duplicada = turmas.toSet().toList();
|
||||
turmas = duplicada;
|
||||
}
|
||||
}
|
||||
setState(() {});
|
||||
// print(disciplinas);
|
||||
}
|
||||
|
||||
buscarPediodoNotas()async{
|
||||
final url = '${widget.dados[2]}/buscarperiodonotas?CIDADE=${widget.dados[0]}';
|
||||
// print(url);
|
||||
final response = await http.get(Uri.parse(url));
|
||||
var map = json.decode(response.body);
|
||||
// print(map);
|
||||
List list = map;
|
||||
for(int i = 0; list.length > i; i++){
|
||||
periodos.add(ModeloPeriodo(PERIODO: list[i]['PERIODO'], NO_PERIODO: list[i]['NO_PERIODO']));
|
||||
// print(periodos[i].PERIODO);
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
buscarNotasRealizadas()async{
|
||||
|
||||
final url = '${widget.dados[2]}/buscarnotasrealizadas?CD_SALA=$CD_SALA&CD_DISCIPLINA=$CD_DISCIPLINA&PERIODO=$CD_PERIODO&CIDADE=${widget.dados[0]}';
|
||||
print(url);
|
||||
final response = await http.get(Uri.parse(url));
|
||||
List map = json.decode(response.body);
|
||||
// print(map);
|
||||
if(map.isNotEmpty){
|
||||
alunos.clear();
|
||||
for(int i = 0; map.length > i; i++){
|
||||
TextEditingController nota = TextEditingController(text: map[i]['NOTA']=='' || map[i]['NOTA'] == null?'0':map[i]['NOTA']);
|
||||
|
||||
alunos.add(
|
||||
ModeloNotaAluno(
|
||||
CD_MATRICULA: map[i]['CD_MATRICULA'],
|
||||
CD_DISCIPLINA: CD_DISCIPLINA,
|
||||
CD_SALA: CD_SALA,
|
||||
PERIODO: CD_PERIODO,
|
||||
NOTA: nota,
|
||||
CD_ALUNO: map[i]['CD_ALUNO'],
|
||||
CD_NOTA: map[i]['CD_NOTA'],
|
||||
NR_TURMA: map[i]['NR_TURMA'],
|
||||
NO_ALUNO: map[i]['NO_ALUNO'],
|
||||
STATUS: map[i]['STATUS'],
|
||||
)
|
||||
);
|
||||
}
|
||||
novaNota = false;
|
||||
SALVANDO = false;
|
||||
edit = false;
|
||||
print('alunos : ${alunos.length}');
|
||||
}else{
|
||||
novaNota = true;
|
||||
buscarNovaChamada();
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
|
||||
buscarNovaChamada()async{
|
||||
int ano = DateTime.now().year;
|
||||
final url = '${widget.dados[2]}/buscarnovachamada?''CD_SALA=${CD_SALA}&ANO=${ano}&CIDADE=${widget.dados[0]}';
|
||||
print(url);
|
||||
final response = await http.get(Uri.parse(url));
|
||||
List map = json.decode(response.body);
|
||||
print(map);
|
||||
if(map.isNotEmpty){
|
||||
alunos.clear();
|
||||
for(int i = 0; map.length > i; i++){
|
||||
TextEditingController nota = TextEditingController(text: map[i]['STATUS']!='MATRICULADO'?'0':'');
|
||||
alunos.add(
|
||||
ModeloNotaAluno(
|
||||
CD_MATRICULA: map[i]['CD_MATRICULA'],
|
||||
CD_DISCIPLINA: CD_DISCIPLINA,
|
||||
CD_SALA: CD_SALA,
|
||||
PERIODO: CD_PERIODO,
|
||||
NOTA: nota,
|
||||
CD_ALUNO: map[i]['CD_ALUNO'],
|
||||
CD_NOTA: 0,
|
||||
NR_TURMA: map[i]['NR_TURMA'],
|
||||
NO_ALUNO: map[i]['NO_ALUNO'],
|
||||
STATUS: map[i]['STATUS'],
|
||||
)
|
||||
);
|
||||
}
|
||||
}else{
|
||||
showSnackBar(context, 'NÃO FOI POSSÍVEL CRIAR UMA NOVA CHAMADA', Colors.red);
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
buscarDisciplinas();
|
||||
buscarPediodoNotas();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBarCustom().appbar(context, 'LANÇAMENTO DE NOTAS'),
|
||||
drawer: DrawerCustom(dados: widget.dados,),
|
||||
body: Center(child: Text('notas'),),
|
||||
bottomNavigationBar: SALVANDO?Container(width: 0,height: 0,):edit?Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SALVANDO?Container():CircleAvatar(
|
||||
backgroundColor: Colors.red,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.clear,color: Colors.white,),
|
||||
onPressed: (){
|
||||
setState(()=>edit=false);
|
||||
buscarNotasRealizadas();
|
||||
}
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10,),
|
||||
SALVANDO?Container():CircleAvatar(
|
||||
backgroundColor: PaletaCores.verdeCalendario,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.check,color: Colors.white,),
|
||||
onPressed: ()async{
|
||||
bool aguardandoAlteracao = false;
|
||||
int indexAluno = alunos.indexWhere((aluno) => aluno.AVISO != '');
|
||||
int indexNota = alunos.indexWhere((aluno) => aluno.NOTA.text == '');
|
||||
|
||||
print('indexNota');
|
||||
print(indexNota);
|
||||
print('indexAluno');
|
||||
print(indexAluno);
|
||||
|
||||
if(indexAluno==-1 && indexNota ==-1){
|
||||
|
||||
setState(()=>SALVANDO = true);
|
||||
|
||||
if(novaNota){
|
||||
aguardandoAlteracao = await MainControllers().salvarNovaNota(alunos, widget.dados);
|
||||
}else{
|
||||
aguardandoAlteracao = await MainControllers().atualizarNota(alunos, widget.dados);
|
||||
}
|
||||
|
||||
if(aguardandoAlteracao){
|
||||
buscarNotasRealizadas();
|
||||
showSnackBar(context, 'DADOS SALVOS COM SUCESSO', Colors.green);
|
||||
setState(()=>SALVANDO = false);
|
||||
setState(()=>edit=false);
|
||||
}else{
|
||||
setState(()=>SALVANDO = false);
|
||||
showSnackBar(context, 'DADOS NÃO FORAM SALVOS', Colors.red);
|
||||
}
|
||||
}else{
|
||||
showSnackBar(context, 'VERIFIQUE SE TODAS AS NOTAS FORAM INSERIDAS CORRETAMENTE!', Colors.red);
|
||||
}
|
||||
}
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
):Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
backgroundColor: Colors.deepOrangeAccent,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.edit, color: Colors.white),
|
||||
onPressed: ()=> setState(()=>edit=true)
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: ListView(
|
||||
padding: EdgeInsets.all(20),
|
||||
children: [
|
||||
ItemSubtituloTexto(titulo:'Escola: ',subtitulo: widget.dados[3]),
|
||||
DropdownTurma(
|
||||
titulo: 'Turma: ',
|
||||
seleciona: selecionaTurma,
|
||||
itens: turmas,
|
||||
hightLine: hightLine,
|
||||
onChanged:edit?null: (value){
|
||||
selecionaTurma = value!.toString();
|
||||
selecionaDisciplina = null;
|
||||
selecionaPeriodo = null;
|
||||
int index = turmas.indexOf(selecionaTurma);
|
||||
ID_TIPO_ENSINO = tipoEnsino[index];
|
||||
alunos.clear();
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
selecionaTurma==null?Container():DropdownPeriodo(
|
||||
titulo: 'Período: ',
|
||||
seleciona: selecionaPeriodo,
|
||||
hightLine: hightLine,
|
||||
itens: periodos.map((value) => DropdownMenuItem<ModeloPeriodo>(
|
||||
value: value,
|
||||
child: TextCustom(
|
||||
text: value.NO_PERIODO,
|
||||
size: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
)
|
||||
).toList(),
|
||||
onChanged:edit?null: (ModeloPeriodo? value){
|
||||
selecionaPeriodo = value;
|
||||
selecionaDisciplina = null;
|
||||
CD_PERIODO = selecionaPeriodo!.PERIODO.toString().trim();
|
||||
alunos.clear();
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
selecionaTurma==null || selecionaPeriodo== null?Container():
|
||||
DropdownDisciplina(
|
||||
titulo: 'Disciplina: ',
|
||||
seleciona: selecionaDisciplina,
|
||||
hightLine: hightLine,
|
||||
listDropDown: disciplinas.map((value) => DropdownMenuItem<ModeloDisciplina>(
|
||||
value: value,
|
||||
child: TextCustom(
|
||||
text: value.DESCRICAO,
|
||||
size: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
)
|
||||
).toList(),
|
||||
onChanged:edit?null: (ModeloDisciplina? value){
|
||||
alunos.clear();
|
||||
selecionaDisciplina = value;
|
||||
print('CD_DISCIPLINA : '+ value!.CD_DISCIPLINA.toString());
|
||||
print('CD_SALA : '+ value!.CD_SALA.toString());
|
||||
CD_DISCIPLINA = value!.CD_DISCIPLINA;
|
||||
CD_SALA = value!.CD_SALA;
|
||||
buscarNotasRealizadas();
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
SALVANDO || alunos.isEmpty?Container():Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 30,
|
||||
child: TextCustom(text: 'N°',size: 12.0, fontWeight: FontWeight.bold)),
|
||||
TextCustom(text: 'ESTUDANTE',size: 12.0, fontWeight: FontWeight.bold),
|
||||
Spacer(),
|
||||
TextCustom(text: 'NOTAS',size: 12.0, fontWeight: FontWeight.bold),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (SALVANDO || alunos.isEmpty) Container() else Container(
|
||||
height: Dimensoes.height*0.6,
|
||||
child: ListView.builder(
|
||||
itemCount: alunos.length,
|
||||
itemBuilder: (context, index){
|
||||
return ItemAlunoNota(
|
||||
edit: edit,
|
||||
aluno: alunos[index],
|
||||
onChanged: (value){
|
||||
if (value!.isEmpty) {
|
||||
alunos[index].AVISO = 'Por favor, digite um valor';
|
||||
}else{
|
||||
double? nota = double.tryParse(value);
|
||||
if (nota == null || nota < 0 || nota > 10) {
|
||||
alunos[index].AVISO = 'A nota deve ser um número entre 0 e 10';
|
||||
}else{
|
||||
alunos[index].AVISO = '';
|
||||
alunos[index].STATUS_DADOS = 'ALTERADO';
|
||||
}
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
);
|
||||
}
|
||||
)
|
||||
),
|
||||
SALVANDO?Container(
|
||||
height: Dimensoes.height*0.55,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
CircularProgressIndicator(color: Colors.deepOrangeAccent),
|
||||
SizedBox(height: 50),
|
||||
TextCustom(text: 'Salvando dados dos estudantes.\nAguarde...', fontWeight: FontWeight.bold,maxLines: 2,)
|
||||
],
|
||||
),
|
||||
):Container(),
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user