salvas novas notas no banco na tela_notas.dart e ajustado a tela_faltas.dart
This commit is contained in:
@@ -1 +1 @@
|
||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"package_info","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\package_info-2.0.2\\\\","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.3.4\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"package_info","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\package_info-2.0.2\\\\","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_android-2.2.1\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"package_info","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\package_info-2.0.2\\\\","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.3.4\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_linux-2.3.2\\\\","native_build":false,"dependencies":["path_provider_linux"]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.2.1\\\\","native_build":false,"dependencies":[]},{"name":"shared_preferences_windows","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_windows-2.3.2\\\\","native_build":false,"dependencies":["path_provider_windows"]}],"web":[{"name":"shared_preferences_web","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_web-2.2.1\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"package_info","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2023-12-07 09:13:43.135866","version":"3.13.9"}
|
||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"package_info","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\package_info-2.0.2\\\\","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.3.4\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"package_info","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\package_info-2.0.2\\\\","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_android-2.2.1\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"package_info","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\package_info-2.0.2\\\\","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.3.4\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_linux-2.3.2\\\\","native_build":false,"dependencies":["path_provider_linux"]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.2.1\\\\","native_build":false,"dependencies":[]},{"name":"shared_preferences_windows","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_windows-2.3.2\\\\","native_build":false,"dependencies":["path_provider_windows"]}],"web":[{"name":"shared_preferences_web","path":"C:\\\\Users\\\\Reginaldo\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_web-2.2.1\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"package_info","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2023-12-08 10:53:15.783680","version":"3.13.9"}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
#Thu Dec 07 09:14:43 BRT 2023
|
||||
#Fri Dec 08 10:54:25 BRT 2023
|
||||
base.0=D\:\\PROJETOS\\clientes\\rkm\\rkm_educa_prof_app\\build\\app\\intermediates\\dex\\debug\\mergeDexDebug\\classes.dex
|
||||
path.0=classes.dex
|
||||
renamed.0=classes.dex
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
5d83a7fc267472f956633891656b122c82d145d0
|
||||
02bf6a91c21b0d4d04ad3753846d7e9337d1b7ec
|
||||
64
lib/componentes/item_aluno_nota.dart
Normal file
64
lib/componentes/item_aluno_nota.dart
Normal file
@@ -0,0 +1,64 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:rkm_educa_prof_app/componentes/text_custom.dart';
|
||||
import 'package:rkm_educa_prof_app/modelos/modelo_nota_aluno.dart';
|
||||
import '../modelos/modelo_presenca_aluno.dart';
|
||||
import '../utils/cores.dart';
|
||||
import '../utils/dimensoes.dart';
|
||||
|
||||
class ItemAlunoNota extends StatelessWidget {
|
||||
|
||||
bool edit;
|
||||
var onChanged;
|
||||
ModeloNotaAluno aluno;
|
||||
|
||||
ItemAlunoNota({
|
||||
required this.edit,
|
||||
required this.onChanged,
|
||||
required this.aluno
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 30,
|
||||
child: TextCustom(text: aluno.NR_TURMA,size: 12.0, fontWeight: FontWeight.bold)),
|
||||
TextCustom(text: aluno.NO_ALUNO,size: 12.0, fontWeight: FontWeight.bold),
|
||||
Spacer(),
|
||||
aluno.STATUS!='MATRICULADO'?
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 5),
|
||||
child: TextCustom(text: 'TRANSFERIDO', size: 12.0, fontWeight: FontWeight.bold,color: Colors.red,)):
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 5),
|
||||
color: PaletaCores.cinzaInput,
|
||||
width: 50,
|
||||
height: 25,
|
||||
child: TextFormField(
|
||||
enabled: edit,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly,
|
||||
],
|
||||
controller: aluno.NOTA,
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(width: 1, color: Colors.black12),
|
||||
),
|
||||
),
|
||||
onChanged: onChanged,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
aluno.AVISO==''?Container()
|
||||
:TextCustom(text: aluno.AVISO,fontWeight: FontWeight.bold, color: Colors.red,textAlign: TextAlign.start,)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import 'dart:convert';
|
||||
import 'package:gainer_crypto/crypto.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:rkm_educa_prof_app/modelos/modelo_nota_aluno.dart';
|
||||
import 'package:rkm_educa_prof_app/modelos/modelo_presenca_aluno.dart';
|
||||
|
||||
class MainControllers{
|
||||
@@ -82,6 +83,7 @@ class MainControllers{
|
||||
}
|
||||
}
|
||||
|
||||
//CHAMADAS
|
||||
atualizarChamada(List<ModeloPresencaAluno> dados, List usuario)async{
|
||||
List<bool> response = [];
|
||||
for(int i = 0; dados.length > i; i++){
|
||||
@@ -149,7 +151,6 @@ class MainControllers{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Future <int> salvarDiarioClasse(List usuario, List dados,int CD_AULA)async{
|
||||
final url = '${usuario[2]}/salvardiarioclasse';
|
||||
final response = await http.post(
|
||||
@@ -229,4 +230,108 @@ class MainControllers{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//NOTAS
|
||||
atualizarNota(List<ModeloNotaAluno> dados, List usuario)async{
|
||||
List<bool> response = [];
|
||||
for(int i = 0; dados.length > i; i++){
|
||||
if(dados[i].STATUS_DADOS!='NOVO'){
|
||||
response.add(await atualizarNotaAluno(dados[i],usuario));
|
||||
print(dados[i].NOTA.text);
|
||||
print('foi alterado os dados ${dados[i].NO_ALUNO}');
|
||||
}else{
|
||||
print('nada foi alterado');
|
||||
}
|
||||
}
|
||||
if(!response.contains(false)){
|
||||
print('TODOS FORAM EDITADOS');
|
||||
return true;
|
||||
}else{
|
||||
print('ALGUM DADOS NÃO ALTERADO');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Future<bool> atualizarNotaAluno(ModeloNotaAluno dados,List usuario)async{
|
||||
final url = '${usuario[2]}/editarnota';
|
||||
print(dados.NOTA.text);
|
||||
print(dados.CD_MATRICULA);
|
||||
print(dados.CD_ALUNO);
|
||||
print(dados.CD_DISCIPLINA);
|
||||
print(dados.CD_SALA);
|
||||
print(dados.PERIODO);
|
||||
print(usuario[0]);
|
||||
print(usuario[2]);
|
||||
final response = await http.post(
|
||||
Uri.parse(url),
|
||||
body:{
|
||||
'NOTA' : dados.NOTA.text,
|
||||
'CD_MATRICULA' : dados.CD_MATRICULA.toString(),
|
||||
'CD_DISCIPLINA' : dados.CD_DISCIPLINA.toString(),
|
||||
'CD_SALA' : dados.CD_SALA.toString(),
|
||||
'PERIODO' : dados.PERIODO.toString(),
|
||||
'CIDADE' : usuario[0].toString(),
|
||||
}
|
||||
);
|
||||
print('response : ${response.body}');
|
||||
if(response.body=='editado com sucesso'){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
salvarNovaNota(List<ModeloNotaAluno> dados, List usuario)async{
|
||||
List<bool> response = [];
|
||||
for(int i = 0; dados.length > i; i++){
|
||||
response.add(await salvarNotaAluno(dados[i],usuario));
|
||||
print(dados[i].NOTA.text);
|
||||
print('foi salvo nota do ${dados[i].NO_ALUNO}');
|
||||
}
|
||||
if(!response.contains(false)){
|
||||
print('TODOS FORAM SALVOS');
|
||||
return true;
|
||||
}else{
|
||||
print('NENHUM DADO NOVO FOI SALVO');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> salvarNotaAluno(ModeloNotaAluno dados,List usuario)async{
|
||||
final url = '${usuario[2]}/salvarnota';
|
||||
print(dados.NOTA.text);
|
||||
print(dados.CD_MATRICULA);
|
||||
print(dados.CD_ALUNO);
|
||||
print(dados.CD_DISCIPLINA);
|
||||
print(dados.CD_SALA);
|
||||
print(dados.PERIODO);
|
||||
print(usuario[0]);
|
||||
print(usuario[2]);
|
||||
|
||||
DateTime DT_INSERT = DateTime.now();
|
||||
String mes = DT_INSERT.month<10?'0${DT_INSERT.month}':DT_INSERT.month.toString();
|
||||
String dia = DT_INSERT.day<10?'0${DT_INSERT.day}':DT_INSERT.day.toString();
|
||||
|
||||
final response = await http.post(
|
||||
Uri.parse(url),
|
||||
body:{
|
||||
'CD_MATRICULA' : dados.CD_MATRICULA.toString(),
|
||||
'CD_DISCIPLINA' : dados.CD_DISCIPLINA.toString(),
|
||||
'CD_PROFESSOR' : usuario[8].toString(),
|
||||
'PERIODO' : dados.PERIODO.toString(),
|
||||
'NOTA' : dados.NOTA.text,
|
||||
'CD_LOGIN' : usuario[9].toString(),
|
||||
'DT_INSERT' : '${DT_INSERT.year}$mes$dia',
|
||||
'CD_ALUNO' : dados.CD_ALUNO.toString(),
|
||||
'CD_SALA' : dados.CD_SALA.toString(),
|
||||
'CIDADE' : usuario[0].toString(),
|
||||
}
|
||||
);
|
||||
print('response : ${response.body}');
|
||||
if(response.body=='sucesso'){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
31
lib/modelos/modelo_nota_aluno.dart
Normal file
31
lib/modelos/modelo_nota_aluno.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class ModeloNotaAluno{
|
||||
int CD_MATRICULA;
|
||||
int CD_DISCIPLINA;
|
||||
int CD_SALA;
|
||||
String PERIODO;
|
||||
TextEditingController NOTA;
|
||||
String CD_ALUNO;
|
||||
int CD_NOTA;
|
||||
String NR_TURMA;
|
||||
String NO_ALUNO;
|
||||
String STATUS;
|
||||
String STATUS_DADOS;
|
||||
String AVISO;
|
||||
|
||||
ModeloNotaAluno({
|
||||
required this.CD_MATRICULA,
|
||||
required this.CD_DISCIPLINA,
|
||||
required this.CD_SALA,
|
||||
required this.PERIODO,
|
||||
required this.NOTA,
|
||||
required this.CD_ALUNO,
|
||||
required this.CD_NOTA,
|
||||
required this.NR_TURMA,
|
||||
required this.NO_ALUNO,
|
||||
required this.STATUS,
|
||||
this.STATUS_DADOS = 'NOVO',
|
||||
this.AVISO = ''
|
||||
});
|
||||
}
|
||||
@@ -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