ajuste no cbo, pesquisa e validação do home_visit_screen.dart
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:line_icons/line_icons.dart';
|
||||
import 'package:rkm/screens/home_screen.dart';
|
||||
import 'package:sqflite/sqflite.dart';
|
||||
import '../../config/color_palette.dart';
|
||||
import '../../config/const_variable.dart';
|
||||
import '../../models/check_model.dart';
|
||||
@@ -124,14 +125,25 @@ class _HomeVisitScreenState extends State<HomeVisitScreen> {
|
||||
CNES_UNIDADE.text = value[1];
|
||||
}
|
||||
});
|
||||
await DBQuerys().buscaCBOProfissional(idUsuario).then((list){
|
||||
if(list.length!=0){
|
||||
for(int i = 0; list.length>i;i++){
|
||||
listCBO.add(list[i]['CODIGO_CBO'].toString());
|
||||
}
|
||||
Database dbcbo = await DbSqliteLoad().intialDB();
|
||||
var query = 'SELECT * FROM PROFISSIONAIS_CBOS WHERE ID_PROFISSIONAL = $idUsuario';
|
||||
List listcbo = await dbcbo.rawQuery(query);
|
||||
|
||||
if(listcbo.length!=0){
|
||||
for(int i = 0; listcbo.length>i;i++){
|
||||
await DBQuerys().buscaCBOSProfissional(listcbo[i]['CODIGO_CBO']).then((cbo)async{
|
||||
if(cbo.length!=0){
|
||||
listCBO.add(cbo[0]['DESCRICAO_CBO']+' - '+listcbo[i]['CODIGO_CBO'].toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
var querycbo = 'SELECT * FROM CBOS WHERE CODIGO_CBO = 223208';
|
||||
// var query = 'SELECT * FROM PROFISSIONAIS_CBOS';
|
||||
List listcbocompleta = await dbcbo.rawQuery(querycbo);
|
||||
print(listcbocompleta);
|
||||
|
||||
List list = await DBQuerys().buscaDadosProfissional(idUnidade,idUsuario);
|
||||
for(int i=0; list.length > i;i++){
|
||||
INE_RESP_CADASTRO = 'INE: ${list[i]['INE']} / Área: ${list[i]['AREA']} - Microárea : ${list[i]['MICROAREA']}';
|
||||
@@ -150,7 +162,7 @@ class _HomeVisitScreenState extends State<HomeVisitScreen> {
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
loadLists() {
|
||||
loadLists()async {
|
||||
for (int i = 0; ConstVariable().typeTurnService.length > i; i++) {
|
||||
typeTurnService.add(ConstVariable().typeTurnService[i].title);
|
||||
}
|
||||
@@ -181,7 +193,7 @@ class _HomeVisitScreenState extends State<HomeVisitScreen> {
|
||||
// adicionar depois e usar um usuário real
|
||||
// CBO_RESP_CADASTRO
|
||||
//ok
|
||||
if(date.isEmpty || dateDB.isEmpty || TIPO_IMOVEL_COD==0 || DESFECHO_COD ==0 || TURNO_COD == 0
|
||||
if(date.isEmpty || dateDB.isEmpty || TIPO_IMOVEL_COD==0 || DESFECHO_COD ==0 || TURNO_COD == 0 || CBO_PROFISSIONAL == null
|
||||
){
|
||||
print('erro');
|
||||
setState(() {
|
||||
@@ -818,23 +830,27 @@ class _HomeVisitScreenState extends State<HomeVisitScreen> {
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Container(
|
||||
width: width*0.7,
|
||||
child: Row(
|
||||
children: [
|
||||
TextDefault(text: 'Procedimento',color: Colors.black,),
|
||||
Spacer(),
|
||||
IconButton(
|
||||
icon: Icon(Icons.add_circle,color: ColorPalette.blackButton),
|
||||
onPressed: (){
|
||||
AlertDialogDefault().otherProc(context, 'Outros Procedimentos', 'Adicionar Procedimento', CBO_PROFISSIONAL, CBO_PROFISSIONAL, 'add',PROCEDIMENTOS_SIGTAP,listProc);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
GestureDetector(
|
||||
onTap: ()=>AlertDialogDefault().otherProc(context, 'Outros Procedimentos', 'Adicionar Procedimento', CBO_PROFISSIONAL, CBO_PROFISSIONAL, 'add',PROCEDIMENTOS_SIGTAP,listProc),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Container(
|
||||
height: 200,
|
||||
width: width*0.7,
|
||||
child: Row(
|
||||
children: [
|
||||
TextDefault(text: 'Procedimento',color: Colors.black,),
|
||||
Spacer(),
|
||||
IconButton(
|
||||
icon: Icon(Icons.add_circle,color: ColorPalette.blackButton),
|
||||
onPressed: (){
|
||||
AlertDialogDefault().otherProc(context, 'Outros Procedimentos', 'Adicionar Procedimento', CBO_PROFISSIONAL, CBO_PROFISSIONAL, 'add',PROCEDIMENTOS_SIGTAP,listProc);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:rkm/screens/select_service/service_dental_screen.dart';
|
||||
import 'package:rkm/screens/select_service/service_home_screen.dart';
|
||||
import 'package:rkm/screens/select_service/service_individual_screen.dart';
|
||||
import 'package:rkm/widgets/button_default.dart';
|
||||
import 'package:rkm/widgets/dropdown_button_com_pesquisa.dart';
|
||||
import 'package:rkm/widgets/switch_with_subtitle.dart';
|
||||
import 'package:rkm/widgets/text_default.dart';
|
||||
import 'package:rkm/widgets/title_containers.dart';
|
||||
@@ -462,7 +463,6 @@ class AlertDialogDefault {
|
||||
) {
|
||||
|
||||
double width = MediaQuery.of(context).size.width;
|
||||
double height = MediaQuery.of(context).size.height;
|
||||
|
||||
return showDialog(
|
||||
context: context,
|
||||
@@ -490,14 +490,17 @@ class AlertDialogDefault {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TitleContainers(title: subtitle),
|
||||
DropDownButtonDefault(
|
||||
DropDownButtonComPesquisa(
|
||||
onChanged: (value)=>setState((){
|
||||
selectProfessionals=value;
|
||||
listProc.add(selectProfessionals);
|
||||
setState((){});
|
||||
}),
|
||||
select: selectProfessionals,
|
||||
title: 'Procedimento',
|
||||
title: '',
|
||||
list: list,
|
||||
width: width
|
||||
width: width*0.8,
|
||||
widthContainer: width*0.75,
|
||||
),
|
||||
ButtonDefault(
|
||||
onPressed:(){
|
||||
@@ -522,10 +525,11 @@ class AlertDialogDefault {
|
||||
list.length!=0
|
||||
?Container(
|
||||
width: width*0.8,
|
||||
height: height*0.4,
|
||||
height: listProc.length*70,
|
||||
child: ListView.builder(
|
||||
itemCount: listProc.length,
|
||||
itemBuilder: (context,index) {
|
||||
print(listProc.length);
|
||||
return Container(
|
||||
width: width * 0.8,
|
||||
padding: EdgeInsets.all(10),
|
||||
|
||||
70
lib/widgets/dropdown_button_com_pesquisa.dart
Normal file
70
lib/widgets/dropdown_button_com_pesquisa.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||
import 'package:rkm/widgets/text_default.dart';
|
||||
import '../config/color_palette.dart';
|
||||
import '../config/const_variable.dart';
|
||||
import 'input_search_text.dart';
|
||||
|
||||
class DropDownButtonComPesquisa extends StatelessWidget {
|
||||
var onChanged;
|
||||
String? select;
|
||||
String title;
|
||||
double fontSize;
|
||||
List list;
|
||||
double width;
|
||||
double heightDinamic;
|
||||
double widthContainer;
|
||||
|
||||
DropDownButtonComPesquisa({
|
||||
required this.onChanged,
|
||||
required this.select,
|
||||
required this.title,
|
||||
required this.list,
|
||||
required this.width,
|
||||
this.heightDinamic = 0.2,
|
||||
this.fontSize = 15,
|
||||
this.widthContainer = 300,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
double height = MediaQuery.of(context).size.height;
|
||||
|
||||
return
|
||||
Container(
|
||||
width: width,
|
||||
height: height*heightDinamic,
|
||||
margin: ConstVariable().marginHightInput,
|
||||
color: ColorPalette.white,
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
TypeAheadField(
|
||||
controller: TextEditingController(),
|
||||
hideOnEmpty: false,
|
||||
suggestionsCallback: (pattern) {
|
||||
if (list != null) {
|
||||
// Use toList() para converter o resultado do where em uma lista
|
||||
return list.where((value) => value.toLowerCase().contains(pattern.toLowerCase())).toList();
|
||||
} else {
|
||||
return Future.value([]); // Retorna uma lista vazia como um Future
|
||||
}
|
||||
},
|
||||
emptyBuilder: (context) {
|
||||
return ListTile(
|
||||
title: Text('Nenhum resultado encontrado'),
|
||||
);
|
||||
},
|
||||
itemBuilder: (context, dynamic suggestion) {
|
||||
return ListTile(
|
||||
title: Text(suggestion),
|
||||
);
|
||||
},
|
||||
onSelected: onChanged,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ class DropDownButtonDefault extends StatelessWidget {
|
||||
required this.width,
|
||||
this.fontSize = 15,
|
||||
this.widthContainer = 300
|
||||
});
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -61,4 +61,4 @@ class DropDownButtonDefault extends StatelessWidget {
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user