exibindo faltas na tela_faltas.dart
This commit is contained in:
40
lib/componentes/dropdown_disciplina.dart
Normal file
40
lib/componentes/dropdown_disciplina.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm_educa_prof_app/componentes/text_custom.dart';
|
||||
|
||||
import '../modelos/modelo_disciplina.dart';
|
||||
class DropdownDisciplina extends StatelessWidget {
|
||||
String titulo;
|
||||
ModeloDisciplina? seleciona;
|
||||
void Function(ModeloDisciplina?)? onChanged;
|
||||
List<DropdownMenuItem<ModeloDisciplina>> listDropDown;
|
||||
double hightLine;
|
||||
|
||||
DropdownDisciplina({
|
||||
required this.titulo,
|
||||
required this.seleciona,
|
||||
required this.onChanged,
|
||||
required this.listDropDown,
|
||||
required this.hightLine,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: hightLine,
|
||||
child: Row(
|
||||
children: [
|
||||
TextCustom(text: titulo,fontWeight: FontWeight.bold),
|
||||
SizedBox(width: 10,),
|
||||
DropdownButtonHideUnderline(
|
||||
child: DropdownButton<ModeloDisciplina>(
|
||||
hint: TextCustom(text: 'SELECIONE',size: 12.0,),
|
||||
value: seleciona,
|
||||
items: listDropDown,
|
||||
onChanged: onChanged,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
39
lib/componentes/dropdown_periodo.dart
Normal file
39
lib/componentes/dropdown_periodo.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm_educa_prof_app/componentes/text_custom.dart';
|
||||
import 'package:rkm_educa_prof_app/modelos/modelo_periodo.dart';
|
||||
class DropdownPeriodo extends StatelessWidget {
|
||||
String titulo;
|
||||
ModeloPeriodo? seleciona;
|
||||
void Function(ModeloPeriodo?)? onChanged;
|
||||
List<DropdownMenuItem<ModeloPeriodo>> itens;
|
||||
double hightLine;
|
||||
|
||||
DropdownPeriodo({
|
||||
required this.titulo,
|
||||
required this.seleciona,
|
||||
required this.itens,
|
||||
required this.onChanged,
|
||||
required this.hightLine,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: hightLine,
|
||||
child: Row(
|
||||
children: [
|
||||
TextCustom(text: titulo,fontWeight: FontWeight.bold),
|
||||
SizedBox(width: 10,),
|
||||
DropdownButtonHideUnderline(
|
||||
child: DropdownButton(
|
||||
hint: TextCustom(text: 'SELECIONE',size: 12.0,),
|
||||
value: seleciona,
|
||||
items: itens,
|
||||
onChanged: onChanged,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
46
lib/componentes/dropdown_turma.dart
Normal file
46
lib/componentes/dropdown_turma.dart
Normal file
@@ -0,0 +1,46 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm_educa_prof_app/componentes/text_custom.dart';
|
||||
class DropdownTurma extends StatelessWidget {
|
||||
String titulo;
|
||||
String? seleciona;
|
||||
List itens;
|
||||
var onChanged;
|
||||
double hightLine;
|
||||
|
||||
DropdownTurma({
|
||||
required this.titulo,
|
||||
required this.seleciona,
|
||||
required this.itens,
|
||||
required this.onChanged,
|
||||
required this.hightLine,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: hightLine,
|
||||
child: Row(
|
||||
children: [
|
||||
TextCustom(text: titulo,fontWeight: FontWeight.bold),
|
||||
SizedBox(width: 10,),
|
||||
DropdownButtonHideUnderline(
|
||||
child: DropdownButton(
|
||||
hint: TextCustom(text: 'SELECIONE',size: 12.0,),
|
||||
value: seleciona,
|
||||
items: itens.map((value) => DropdownMenuItem(
|
||||
value: value,
|
||||
child: TextCustom(
|
||||
text: value,
|
||||
size: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
)
|
||||
).toList(),
|
||||
onChanged: onChanged,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
106
lib/componentes/item_aluno_presenca.dart
Normal file
106
lib/componentes/item_aluno_presenca.dart
Normal file
@@ -0,0 +1,106 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm_educa_prof_app/componentes/text_custom.dart';
|
||||
import '../utils/cores.dart';
|
||||
import '../utils/dimensoes.dart';
|
||||
|
||||
class ItemAlunoPresenca extends StatelessWidget {
|
||||
|
||||
String NO_ALUNO;
|
||||
bool edit;
|
||||
int CD_AULA1;
|
||||
int CD_AULA2;
|
||||
int CD_AULA3;
|
||||
int CD_AULA4;
|
||||
int CD_AULA5;
|
||||
bool FL_PRESENTE_AUSENTE1;
|
||||
bool FL_PRESENTE_AUSENTE2;
|
||||
bool FL_PRESENTE_AUSENTE3;
|
||||
bool FL_PRESENTE_AUSENTE4;
|
||||
bool FL_PRESENTE_AUSENTE5;
|
||||
var onChanged1;
|
||||
var onChanged2;
|
||||
var onChanged3;
|
||||
var onChanged4;
|
||||
var onChanged5;
|
||||
|
||||
ItemAlunoPresenca({
|
||||
required this.NO_ALUNO,
|
||||
required this.edit,
|
||||
required this.CD_AULA1,
|
||||
required this.CD_AULA2,
|
||||
required this.CD_AULA3,
|
||||
required this.CD_AULA4,
|
||||
required this.CD_AULA5,
|
||||
required this.FL_PRESENTE_AUSENTE1,
|
||||
required this.FL_PRESENTE_AUSENTE2,
|
||||
required this.FL_PRESENTE_AUSENTE3,
|
||||
required this.FL_PRESENTE_AUSENTE4,
|
||||
required this.FL_PRESENTE_AUSENTE5,
|
||||
required this.onChanged1,
|
||||
required this.onChanged2,
|
||||
required this.onChanged3,
|
||||
required this.onChanged4,
|
||||
required this.onChanged5,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 40,
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: Dimensoes.width*0.6,
|
||||
child: TextCustom(text: NO_ALUNO,size: 12.0)
|
||||
),
|
||||
Spacer(),
|
||||
CD_AULA1==0?Container():TextCustom(text: '${CD_AULA1}ª',size: 15.0),
|
||||
CD_AULA1==0?Container():Container(
|
||||
width: 25,
|
||||
child: Checkbox(
|
||||
value: FL_PRESENTE_AUSENTE1,
|
||||
activeColor: PaletaCores.cinzaEscuro,
|
||||
onChanged:!edit?null:onChanged1
|
||||
),
|
||||
),
|
||||
CD_AULA2==0?Container():TextCustom(text: '${CD_AULA2}ª',size: 15.0),
|
||||
CD_AULA2==0?Container():Container(
|
||||
width: 25,
|
||||
child: Checkbox(
|
||||
value: FL_PRESENTE_AUSENTE2,
|
||||
activeColor: PaletaCores.cinzaEscuro,
|
||||
onChanged:!edit?null: onChanged2
|
||||
),
|
||||
),
|
||||
CD_AULA3==0?Container():TextCustom(text: '${CD_AULA3}ª',size: 15.0),
|
||||
CD_AULA3==0?Container():Container(
|
||||
width: 25,
|
||||
child: Checkbox(
|
||||
value: FL_PRESENTE_AUSENTE3,
|
||||
activeColor: PaletaCores.cinzaEscuro,
|
||||
onChanged:!edit?null:onChanged3
|
||||
),
|
||||
),
|
||||
CD_AULA4==0?Container():TextCustom(text: '${CD_AULA4}ª',size: 15.0),
|
||||
CD_AULA4==0?Container():Container(
|
||||
width: 25,
|
||||
child: Checkbox(
|
||||
value: FL_PRESENTE_AUSENTE4,
|
||||
activeColor: PaletaCores.cinzaEscuro,
|
||||
onChanged:!edit?null:onChanged4
|
||||
),
|
||||
),
|
||||
CD_AULA5==0?Container():TextCustom(text: '${CD_AULA5}ª',size: 15.0),
|
||||
CD_AULA5==0?Container():Container(
|
||||
width: 25,
|
||||
child: Checkbox(
|
||||
value: FL_PRESENTE_AUSENTE5,
|
||||
activeColor: PaletaCores.cinzaEscuro,
|
||||
onChanged:!edit?null:onChanged5
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
25
lib/componentes/item_subtitulo_texto.dart
Normal file
25
lib/componentes/item_subtitulo_texto.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rkm_educa_prof_app/componentes/text_custom.dart';
|
||||
|
||||
class ItemSubtituloTexto extends StatelessWidget {
|
||||
String titulo;
|
||||
String subtitulo;
|
||||
|
||||
ItemSubtituloTexto({
|
||||
required this.titulo,
|
||||
required this.subtitulo
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 30,
|
||||
child: Row(
|
||||
children: [
|
||||
TextCustom(text: titulo,fontWeight: FontWeight.bold),
|
||||
TextCustom(text: subtitulo,size: 12.0,),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
33
lib/modelos/modelo_disciplina.dart
Normal file
33
lib/modelos/modelo_disciplina.dart
Normal file
@@ -0,0 +1,33 @@
|
||||
class ModeloDisciplina{
|
||||
// CD_ANO_DISCIPLINA: 30, CD_CAD_DIVERSO: 6, CD_SALA: 256, CD_SERIE: 98, ANO_ATRIBUICAO: 2023, CD_DISCIPLINA: 13,
|
||||
// DESCRICAO: CIENCIAS, ABREVIATURA: CIE , TURMA: A , DESC_SERIE: 1º ANO, GRAU: EF , HR_INICIO: 07:00:00
|
||||
int CD_ANO_DISCIPLINA;
|
||||
int CD_CAD_DIVERSO;
|
||||
int CD_SALA;
|
||||
int CD_SERIE;
|
||||
int ANO_ATRIBUICAO;
|
||||
int CD_DISCIPLINA;
|
||||
int CD_TIPO_ENSINO;
|
||||
String DESCRICAO;
|
||||
String ABREVIATURA;
|
||||
String TURMA;
|
||||
String DESC_SERIE;
|
||||
String GRAU;
|
||||
String HR_INICIO;
|
||||
|
||||
ModeloDisciplina({
|
||||
required this.CD_ANO_DISCIPLINA,
|
||||
required this.CD_CAD_DIVERSO,
|
||||
required this.CD_SALA,
|
||||
required this.CD_SERIE,
|
||||
required this.ANO_ATRIBUICAO,
|
||||
required this.CD_DISCIPLINA,
|
||||
required this.CD_TIPO_ENSINO,
|
||||
required this.DESCRICAO,
|
||||
required this.ABREVIATURA,
|
||||
required this.TURMA,
|
||||
required this.DESC_SERIE,
|
||||
required this.GRAU,
|
||||
required this.HR_INICIO,
|
||||
});
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
class EventoModelo{
|
||||
class ModeloEvento{
|
||||
String titulo;
|
||||
String data;
|
||||
int cor;
|
||||
|
||||
EventoModelo({
|
||||
ModeloEvento({
|
||||
required this.titulo,
|
||||
required this.data,
|
||||
this.cor = 0
|
||||
9
lib/modelos/modelo_periodo.dart
Normal file
9
lib/modelos/modelo_periodo.dart
Normal file
@@ -0,0 +1,9 @@
|
||||
class ModeloPeriodo{
|
||||
String PERIODO;
|
||||
String NO_PERIODO;
|
||||
|
||||
ModeloPeriodo({
|
||||
required this.PERIODO,
|
||||
required this.NO_PERIODO,
|
||||
});
|
||||
}
|
||||
37
lib/modelos/modelo_presenca_aluno.dart
Normal file
37
lib/modelos/modelo_presenca_aluno.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
class ModeloPresencaAluno{
|
||||
String DT_DIARIO_CLASSE;
|
||||
int CD_AULA1;
|
||||
int CD_AULA2;
|
||||
int CD_AULA3;
|
||||
int CD_AULA4;
|
||||
int CD_AULA5;
|
||||
int CD_MATRICULA;
|
||||
bool FL_PRESENTE_AUSENTE1;
|
||||
bool FL_PRESENTE_AUSENTE2;
|
||||
bool FL_PRESENTE_AUSENTE3;
|
||||
bool FL_PRESENTE_AUSENTE4;
|
||||
bool FL_PRESENTE_AUSENTE5;
|
||||
String CD_ALUNO;
|
||||
String NO_ALUNO;
|
||||
String NR_TURMA;
|
||||
int CD_DISCIPLINA;
|
||||
|
||||
ModeloPresencaAluno({
|
||||
required this.DT_DIARIO_CLASSE,
|
||||
required this.CD_MATRICULA,
|
||||
required this.CD_ALUNO,
|
||||
required this.NO_ALUNO,
|
||||
required this.NR_TURMA,
|
||||
required this.CD_DISCIPLINA,
|
||||
this.CD_AULA1 = 0,
|
||||
this.CD_AULA2 = 0,
|
||||
this.CD_AULA3 = 0,
|
||||
this.CD_AULA4 = 0,
|
||||
this.CD_AULA5 = 0,
|
||||
this.FL_PRESENTE_AUSENTE1 = false,
|
||||
this.FL_PRESENTE_AUSENTE2 = false,
|
||||
this.FL_PRESENTE_AUSENTE3 = false,
|
||||
this.FL_PRESENTE_AUSENTE4 = false,
|
||||
this.FL_PRESENTE_AUSENTE5 = false,
|
||||
});
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import '../componentes/drawer_custom.dart';
|
||||
import '../componentes/item_agenda.dart';
|
||||
import '../componentes/text_custom.dart';
|
||||
import '../controllers/main_controllers.dart';
|
||||
import '../modelos/evento_modelo.dart';
|
||||
import '../modelos/modelo_evento.dart';
|
||||
import '../utils/cores.dart';
|
||||
import '../utils/dimensoes.dart';
|
||||
|
||||
@@ -28,7 +28,7 @@ class TelaCalendario extends StatefulWidget {
|
||||
|
||||
class _TelaCalendarioState extends State<TelaCalendario> {
|
||||
|
||||
List<EventoModelo> listDatas = [];
|
||||
List<ModeloEvento> listDatas = [];
|
||||
bool carregandoEventos = true;
|
||||
DateTime _currentDate = DateTime.now();
|
||||
DateTime dataAtual = DateTime.now();
|
||||
@@ -82,12 +82,12 @@ class _TelaCalendarioState extends State<TelaCalendario> {
|
||||
if(map!=false){
|
||||
List list = map;
|
||||
List titulo = [];
|
||||
List<EventoModelo> listD = [];
|
||||
List<ModeloEvento> listD = [];
|
||||
for(int i = 0; list.length>i;i++){
|
||||
List data = list[i]['DT_CALENDARIO'].toString().split('-');
|
||||
titulo.add(list[i]['NO_EVENTO'].toString().trim());
|
||||
|
||||
listD.add(EventoModelo(
|
||||
listD.add(ModeloEvento(
|
||||
titulo: list[i]['NO_EVENTO'].toString().trim(),
|
||||
data: '${data[2]}/${data[1]}/${data[0]}',
|
||||
cor: int.parse(list[i]['NO_COR'].toString().trim()=='#0ff'?'0xffe1e1a1':'0xff'+list[i]['NO_COR'].toString().replaceAll("#", ''))));
|
||||
|
||||
@@ -1,8 +1,23 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter_calendar_carousel/classes/event.dart';
|
||||
import 'package:flutter_calendar_carousel/flutter_calendar_carousel.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:rkm_educa_prof_app/componentes/dropdown_turma.dart';
|
||||
import 'package:rkm_educa_prof_app/componentes/dropdown_disciplina.dart';
|
||||
import 'package:rkm_educa_prof_app/componentes/dropdown_periodo.dart';
|
||||
import 'package:rkm_educa_prof_app/componentes/item_aluno_presenca.dart';
|
||||
import 'package:rkm_educa_prof_app/componentes/snackBars.dart';
|
||||
import 'package:rkm_educa_prof_app/componentes/text_custom.dart';
|
||||
import 'package:rkm_educa_prof_app/modelos/modelo_periodo.dart';
|
||||
import 'package:rkm_educa_prof_app/modelos/modelo_presenca_aluno.dart';
|
||||
import '../componentes/appbar_custom.dart';
|
||||
import '../componentes/drawer_custom.dart';
|
||||
import '../componentes/item_subtitulo_texto.dart';
|
||||
import '../modelos/modelo_disciplina.dart';
|
||||
import '../utils/cores.dart';
|
||||
import '../utils/dimensoes.dart';
|
||||
|
||||
class TelaFaltas extends StatefulWidget {
|
||||
List dados;
|
||||
@@ -17,28 +32,479 @@ class TelaFaltas extends StatefulWidget {
|
||||
|
||||
class _TelaFaltasState extends State<TelaFaltas> {
|
||||
|
||||
List<ModeloDisciplina> disciplinas = [];
|
||||
List<ModeloPeriodo> periodos = [];
|
||||
List<ModeloPresencaAluno> alunos = [];
|
||||
List turmas = [];
|
||||
List tipoEnsino = [];
|
||||
ModeloDisciplina? selecionaDisciplina;
|
||||
String? selecionaTurma;
|
||||
ModeloPeriodo? selecionaPeriodo;
|
||||
int ID_TIPO_ENSINO = 0;
|
||||
int CD_DISCIPLINA = 0;
|
||||
int CD_SALA = 0;
|
||||
DateTime? DT_INICIAL;
|
||||
DateTime? DT_FINAL;
|
||||
bool exibirCalendario = false;
|
||||
DateTime dataAtual = DateTime.now();
|
||||
DateTime? _dataSelecionada;
|
||||
double hightLine = 40;
|
||||
int DIA_SEMANA = 0;
|
||||
bool edit = false;
|
||||
EventList<Event> _markedDateMap = new EventList<Event>(
|
||||
events: {},
|
||||
);
|
||||
|
||||
Widget _eventIcon(String dia,Color cor) => Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
color: cor,
|
||||
),
|
||||
width: 40,
|
||||
height: 40,
|
||||
child: Center(
|
||||
child: TextCustom(text: dia,fontWeight: FontWeight.bold,size: 14.0,color: cor==Color(0xffee1d24)?Colors.white:PaletaCores.cinza),
|
||||
),
|
||||
);
|
||||
|
||||
buscarDisciplinas()async{
|
||||
print('ususario');
|
||||
print(widget.dados[8]);
|
||||
int ano = DateTime.now().year;
|
||||
final url = '${widget.dados[2]}/buscardisciplinasprof?USUARIO_SISTEMA=${widget.dados[8]}&CIDADE=${widget.dados[0]}&ANO=$ano';
|
||||
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]['GRAU'].toString().trim()
|
||||
)
|
||||
);
|
||||
turmas.add(
|
||||
'${disciplinas[i].GRAU} - ${disciplinas[i].DESC_SERIE} - ${disciplinas[i].TURMA} - ${disciplinas[i].HR_INICIO=='07:00:00'?'MANHA':'TARDE'}'
|
||||
);
|
||||
if(turmas.isNotEmpty){
|
||||
List duplicada = turmas.toSet().toList();
|
||||
turmas = duplicada;
|
||||
}
|
||||
}
|
||||
setState(() {});
|
||||
// print(disciplinas);
|
||||
}
|
||||
|
||||
buscarPediodoBimestral()async{
|
||||
final url = '${widget.dados[2]}/buscarperiodobimestral?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']));
|
||||
}
|
||||
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);
|
||||
final response = await http.get(Uri.parse(url));
|
||||
var map = json.decode(response.body);
|
||||
print(map);
|
||||
List list = map;
|
||||
if(list.isNotEmpty){
|
||||
for(int i = 0; list.length > i; i ++){
|
||||
if(list[i]['NO_TITULO'].toString().toUpperCase().trim() == 'BIMESTRE'){
|
||||
List dataListInicial = list[i]['DT_INICIAL'].toString().split('-');
|
||||
List dataListFinal = list[i]['DT_FINAL'].toString().split('-');
|
||||
int diaInicial = int.parse(dataListInicial[2]);
|
||||
int mesInicial = int.parse(dataListInicial[1]);
|
||||
int anoInicial = int.parse(dataListInicial[0]);
|
||||
|
||||
int diaFinal = int.parse(dataListFinal[2]);
|
||||
int mesFinal = int.parse(dataListFinal[1]);
|
||||
int anoFinal = int.parse(dataListFinal[0]);
|
||||
DT_INICIAL = DateTime(anoInicial,mesInicial,diaInicial);
|
||||
DT_FINAL = DateTime(anoFinal,mesFinal,diaFinal);
|
||||
dataAtual = DT_INICIAL!;
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
print('INICIAL ${DT_INICIAL}');
|
||||
print('FINAL ${DT_FINAL}');
|
||||
}
|
||||
}
|
||||
|
||||
buscarGrade(int CD_SALA, int CD_DISCIPLINA)async{
|
||||
final url = '${widget.dados[2]}/buscargrade?CD_SALA=${CD_SALA}&CD_DISCIPLINA=${CD_DISCIPLINA}&CIDADE=${widget.dados[0]}';
|
||||
print(url);
|
||||
final response = await http.get(Uri.parse(url));
|
||||
List map = json.decode(response.body);
|
||||
if(map.isNotEmpty){
|
||||
print(map);
|
||||
List diasSemana = [];
|
||||
List semana = ['DOMINGO', 'SEGUNDAS', 'TERÇAS', 'QUARTAS', 'QUINTAS', 'SEXTAS', 'SÁBADOS'];
|
||||
for(int i = 0; map.length > i; i ++){
|
||||
diasSemana.add(map[i]['DIA_SEMANA']);
|
||||
}
|
||||
if(!diasSemana.contains(DIA_SEMANA)){
|
||||
_dataSelecionada = null;
|
||||
_markedDateMap.clear();
|
||||
showSnackBar(context, 'ESSA AULA É AS ${semana[diasSemana[0]]}!', Colors.red);
|
||||
}else{
|
||||
if(_dataSelecionada!=null){
|
||||
buscarchamadasrealizadas(CD_SALA,CD_DISCIPLINA);
|
||||
}else{
|
||||
showSnackBar(context, 'Selecione uma data!', Colors.red);
|
||||
}
|
||||
}
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
buscarchamadasrealizadas(int CD_SALA,int CD_DISCIPLINA)async{
|
||||
String dia = _dataSelecionada!.day.toString();
|
||||
String mes = _dataSelecionada!.month.toString();
|
||||
String ano = _dataSelecionada!.year.toString();
|
||||
|
||||
final url = '${widget.dados[2]}/buscarchamadasrealizadas?CD_SALA=${CD_SALA}&CD_DISCIPLINA=${CD_DISCIPLINA}&DATA=$ano-$mes-$dia&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++){
|
||||
|
||||
int indexAluno = alunos.indexWhere((aluno) => aluno.CD_MATRICULA == map[i]['CD_MATRICULA']);
|
||||
|
||||
if(indexAluno == -1){
|
||||
alunos.add(
|
||||
ModeloPresencaAluno(
|
||||
DT_DIARIO_CLASSE: map[i]['DT_DIARIO_CLASSE'],
|
||||
CD_MATRICULA: map[i]['CD_MATRICULA'],
|
||||
CD_ALUNO: map[i]['CD_ALUNO'],
|
||||
NO_ALUNO: map[i]['NO_ALUNO'],
|
||||
NR_TURMA: map[i]['NR_TURMA'],
|
||||
CD_DISCIPLINA: map[i]['CD_DISCIPLINA'],
|
||||
CD_AULA1: map[i]['CD_AULA'] == 1?1:0,
|
||||
CD_AULA2: map[i]['CD_AULA'] == 2?2:0,
|
||||
CD_AULA3: map[i]['CD_AULA'] == 3?3:0,
|
||||
CD_AULA4: map[i]['CD_AULA'] == 4?4:0,
|
||||
CD_AULA5: map[i]['CD_AULA'] == 5?5:0,
|
||||
FL_PRESENTE_AUSENTE1: map[i]['FL_PRESENTE_AUSENTE'].toString().toUpperCase()=='A' && map[i]['CD_AULA'] == 1?true:false,
|
||||
FL_PRESENTE_AUSENTE2: map[i]['FL_PRESENTE_AUSENTE'].toString().toUpperCase()=='A' && map[i]['CD_AULA'] == 2?true:false,
|
||||
FL_PRESENTE_AUSENTE3: map[i]['FL_PRESENTE_AUSENTE'].toString().toUpperCase()=='A' && map[i]['CD_AULA'] == 3?true:false,
|
||||
FL_PRESENTE_AUSENTE4: map[i]['FL_PRESENTE_AUSENTE'].toString().toUpperCase()=='A' && map[i]['CD_AULA'] == 4?true:false,
|
||||
FL_PRESENTE_AUSENTE5: map[i]['FL_PRESENTE_AUSENTE'].toString().toUpperCase()=='A' && map[i]['CD_AULA'] == 5?true:false,
|
||||
)
|
||||
);
|
||||
}else{
|
||||
if(map[i]['CD_AULA'] == 1){
|
||||
alunos[indexAluno].CD_AULA1 = 1;
|
||||
alunos[indexAluno].FL_PRESENTE_AUSENTE1 = map[i]['FL_PRESENTE_AUSENTE'].toString().toUpperCase()=='A'?true:false;
|
||||
}else if(map[i]['CD_AULA'] == 2){
|
||||
alunos[indexAluno].CD_AULA2 = 2;
|
||||
alunos[indexAluno].FL_PRESENTE_AUSENTE2 = map[i]['FL_PRESENTE_AUSENTE'].toString().toUpperCase()=='A'?true:false;
|
||||
}else if(map[i]['CD_AULA'] == 3){
|
||||
alunos[indexAluno].CD_AULA3 = 3;
|
||||
alunos[indexAluno].FL_PRESENTE_AUSENTE3 = map[i]['FL_PRESENTE_AUSENTE'].toString().toUpperCase()=='A'?true:false;
|
||||
}else if(map[i]['CD_AULA'] == 4){
|
||||
alunos[indexAluno].CD_AULA4 = 4;
|
||||
alunos[indexAluno].FL_PRESENTE_AUSENTE4 = map[i]['FL_PRESENTE_AUSENTE'].toString().toUpperCase()=='A'?true:false;
|
||||
}else if(map[i]['CD_AULA'] == 5){
|
||||
alunos[indexAluno].CD_AULA5 = 5;
|
||||
alunos[indexAluno].FL_PRESENTE_AUSENTE5 = map[i]['FL_PRESENTE_AUSENTE'].toString().toUpperCase()=='A'?true:false;
|
||||
}
|
||||
}
|
||||
}
|
||||
print('alunos : ${alunos.length}');
|
||||
}else{
|
||||
print('chamada não realizada');
|
||||
showSnackBar(context, 'Chamada não foi realizada nesta data!', Colors.red);
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
atualizarData(DateTime date, List<Event> events){
|
||||
_markedDateMap.clear();
|
||||
_markedDateMap.add(
|
||||
date,
|
||||
Event(
|
||||
date: date,
|
||||
icon: _eventIcon(date.day.toString(),Colors.indigo)
|
||||
)
|
||||
);
|
||||
|
||||
alunos.clear();
|
||||
selecionaDisciplina = null;
|
||||
_dataSelecionada = date;
|
||||
DIA_SEMANA = date.weekday;
|
||||
setState(() {});
|
||||
events.forEach((event) => print(event.title));
|
||||
print(_dataSelecionada);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
buscarDisciplinas();
|
||||
buscarPediodoBimestral();
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
TextStyle textStyle = TextStyle(
|
||||
color: PaletaCores.cinza,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 14
|
||||
);
|
||||
|
||||
TextStyle textStyleFDS = TextStyle(
|
||||
color: Colors.red,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 14
|
||||
);
|
||||
|
||||
final _calendario = CalendarCarousel<Event>(
|
||||
locale: 'pt',
|
||||
weekdayTextStyle: TextStyle(color: PaletaCores.cinza,fontSize: 14,fontFamily: 'Nunito',),
|
||||
daysTextStyle: textStyle,
|
||||
selectedDayButtonColor: Colors.indigo,
|
||||
weekendTextStyle: textStyleFDS,
|
||||
markedDatesMap: _markedDateMap,
|
||||
height: Dimensoes.height*0.45,
|
||||
targetDateTime: dataAtual,
|
||||
markedDateCustomTextStyle: textStyle,
|
||||
markedDateMoreShowTotal: null,
|
||||
showHeader: false,
|
||||
todayTextStyle: textStyle,
|
||||
isScrollable: false,
|
||||
todayButtonColor: Colors.green,
|
||||
selectedDayTextStyle: textStyle,
|
||||
minSelectedDate: DT_INICIAL,
|
||||
maxSelectedDate: DT_FINAL,
|
||||
markedDateIconBuilder: (event){
|
||||
return event.icon;
|
||||
},
|
||||
selectedDateTime: _dataSelecionada,
|
||||
onDayPressed: (DateTime date, List<Event> events) {
|
||||
atualizarData(date!,events);
|
||||
},
|
||||
);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBarCustom().appbar(context, 'LANÇAMENTO DE FALTAS'),
|
||||
drawer: DrawerCustom(dados: widget.dados,),
|
||||
body: Center(child: Text('faltas'),),
|
||||
floatingActionButton: edit?Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
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,),
|
||||
CircleAvatar(
|
||||
backgroundColor: PaletaCores.verdeCalendario,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.check,color: Colors.white,),
|
||||
onPressed: ()=> setState(()=>edit=false)
|
||||
)
|
||||
),
|
||||
],
|
||||
):CircleAvatar(
|
||||
backgroundColor: Colors.deepOrangeAccent,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.edit, color: Colors.white),
|
||||
onPressed: ()=> setState(()=>edit=true)
|
||||
),
|
||||
),
|
||||
body: exibirCalendario?Container(
|
||||
child: ListView(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: (){
|
||||
if(DT_INICIAL!.month < dataAtual.month){
|
||||
dataAtual = DateTime(dataAtual.year, dataAtual.month -1);
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
icon: Icon(Icons.arrow_left,size: 30,color: PaletaCores.cinzaClaro,)
|
||||
),
|
||||
TextCustom(text: DateFormat('MMMM / yyyy','pt_Br').format(dataAtual),fontWeight: FontWeight.bold),
|
||||
IconButton(
|
||||
onPressed: (){
|
||||
if(DT_FINAL!.month > dataAtual.month){
|
||||
dataAtual = DateTime(dataAtual.year, dataAtual.month +1);
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
icon: Icon(Icons.arrow_right,size: 30,color: PaletaCores.cinzaClaro,)
|
||||
),
|
||||
],
|
||||
),
|
||||
_calendario,
|
||||
Center(child: TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: PaletaCores.verdeCalendario,
|
||||
),
|
||||
onPressed: ()=>setState(()=>exibirCalendario = false),
|
||||
child: TextCustom(text: 'SELECIONAR', color: Colors.white, size: 10.0),
|
||||
),)
|
||||
],
|
||||
),
|
||||
):ListView(
|
||||
padding: EdgeInsets.all(20),
|
||||
children: [
|
||||
ItemSubtituloTexto(titulo:'Escola: ',subtitulo: widget.dados[3]),
|
||||
ItemSubtituloTexto(titulo:'Tipo Falta: ',subtitulo: 'AULA'),
|
||||
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];
|
||||
_dataSelecionada = null;
|
||||
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;
|
||||
_dataSelecionada = null;
|
||||
alunos.clear();
|
||||
buscarPediodoDatas(value!.PERIODO);
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
selecionaTurma ==null || selecionaPeriodo== null?Container(): Container(
|
||||
height: hightLine,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
TextCustom(text: 'Data: ',fontWeight: FontWeight.bold),
|
||||
SizedBox(width: 10,),
|
||||
_dataSelecionada!= null?GestureDetector(
|
||||
onTap:edit?null: ()=>setState(()=>exibirCalendario = true),
|
||||
child: Container(
|
||||
child: TextCustom(text: DateFormat('dd/MM/yyyy', 'pt_BR').format(_dataSelecionada!),size: 12.0,),
|
||||
),
|
||||
):Container(),
|
||||
IconButton(
|
||||
onPressed:edit?null: ()=>setState(()=>exibirCalendario = true),
|
||||
icon: Icon(Icons.calendar_month,size: 25)
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
selecionaTurma==null || selecionaPeriodo== null || _dataSelecionada== 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;
|
||||
buscarGrade(value!.CD_SALA,value!.CD_DISCIPLINA);
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
alunos.isEmpty?Container():Container(
|
||||
child: Row(
|
||||
children: [
|
||||
TextCustom(text: 'ESTUDANTE',size: 12.0, fontWeight: FontWeight.bold),
|
||||
Spacer(),
|
||||
TextCustom(text: 'FALTAS AULA',size: 12.0, fontWeight: FontWeight.bold),
|
||||
],
|
||||
),
|
||||
),
|
||||
alunos.isEmpty?Container():Container(
|
||||
height: Dimensoes.height*0.55,
|
||||
child: ListView.builder(
|
||||
itemCount: alunos.length,
|
||||
itemBuilder: (context, index){
|
||||
return ItemAlunoPresenca(
|
||||
NO_ALUNO: alunos[index].NO_ALUNO,
|
||||
edit: edit,
|
||||
CD_AULA1: alunos[index].CD_AULA1,
|
||||
CD_AULA2: alunos[index].CD_AULA2,
|
||||
CD_AULA3: alunos[index].CD_AULA3,
|
||||
CD_AULA4: alunos[index].CD_AULA4,
|
||||
CD_AULA5: alunos[index].CD_AULA5,
|
||||
FL_PRESENTE_AUSENTE1: alunos[index].FL_PRESENTE_AUSENTE1,
|
||||
FL_PRESENTE_AUSENTE2: alunos[index].FL_PRESENTE_AUSENTE2,
|
||||
FL_PRESENTE_AUSENTE3: alunos[index].FL_PRESENTE_AUSENTE3,
|
||||
FL_PRESENTE_AUSENTE4: alunos[index].FL_PRESENTE_AUSENTE4,
|
||||
FL_PRESENTE_AUSENTE5: alunos[index].FL_PRESENTE_AUSENTE5,
|
||||
onChanged1: (value)=>setState(()=>alunos[index].FL_PRESENTE_AUSENTE1 = value!),
|
||||
onChanged2: (value)=>setState(()=>alunos[index].FL_PRESENTE_AUSENTE2 = value!),
|
||||
onChanged3: (value)=>setState(()=>alunos[index].FL_PRESENTE_AUSENTE3 = value!),
|
||||
onChanged4: (value)=>setState(()=>alunos[index].FL_PRESENTE_AUSENTE4 = value!),
|
||||
onChanged5: (value)=>setState(()=>alunos[index].FL_PRESENTE_AUSENTE5 = value!)
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user