inclusão dos paises no cadastro cidadão
This commit is contained in:
@@ -236,11 +236,11 @@ class _SyncDataScreenState extends State<SyncDataScreen> {
|
||||
// print(map['cidadaos'][0]['ANO_VEICULO']);
|
||||
// print(map['cidadaos'][0]['CD_USUARIO_SUS']);
|
||||
// print(map['cidadaos'][0]['RENDA_MENSAL']);
|
||||
print(map['cad_individuais'][0]['FIBROMIALGIA']);
|
||||
print(map['cad_individuais'][0]['TRANSTORNO_ESPECTRO_AUTISTA']);
|
||||
print(map['cad_individuais'][0]['CNES_RESP_CADASTRO']);
|
||||
print(map['cad_individuais'][0]['ID_AREA_CIDADAO']);
|
||||
print(map['cad_individuais'][0]['ID_MICROAREA_CIDADAO']);
|
||||
// print(map['cad_individuais'][0]['FIBROMIALGIA']);
|
||||
// print(map['cad_individuais'][0]['TRANSTORNO_ESPECTRO_AUTISTA']);
|
||||
// print(map['cad_individuais'][0]['CNES_RESP_CADASTRO']);
|
||||
// print(map['cad_individuais'][0]['ID_AREA_CIDADAO']);
|
||||
// print(map['cad_individuais'][0]['ID_MICROAREA_CIDADAO']);
|
||||
|
||||
await ApiDataPost().sincronizacao(urlAPI, mode, nameCityApi,map).then((response)async{
|
||||
if(response=='error'){
|
||||
|
||||
@@ -4,8 +4,11 @@ import 'package:flutter/services.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:rkm/config/color_palette.dart';
|
||||
import 'package:rkm/config/const_variable.dart';
|
||||
import 'package:rkm/models/pais_modelo.dart';
|
||||
import 'package:rkm/widgets/alert_dialog_default.dart';
|
||||
import 'package:rkm/widgets/button_default.dart';
|
||||
import 'package:rkm/widgets/dropdown_button_com_pesquisa.dart';
|
||||
import 'package:rkm/widgets/dropdown_button_com_pesquisa_paises.dart';
|
||||
import 'package:rkm/widgets/title_containers.dart';
|
||||
import 'package:sqflite/sqflite.dart';
|
||||
import '../../controllers/main_controllers.dart';
|
||||
@@ -22,6 +25,7 @@ import '../../widgets/onbackbutton.dart';
|
||||
import '../../widgets/subtitle_appbar_citizen.dart';
|
||||
import '../../widgets/switch_with_subtitle.dart';
|
||||
import '../../widgets/text_default.dart';
|
||||
import '../../widgets/title_input.dart';
|
||||
class RegisterCitizenScreen extends StatefulWidget {
|
||||
List listData;
|
||||
String username;
|
||||
@@ -94,7 +98,9 @@ class _RegisterCitizenScreenState extends State<RegisterCitizenScreen> {
|
||||
String? selectZone;
|
||||
int? selectZoneCod;
|
||||
String? selectVillage;
|
||||
String? selectCountry;
|
||||
PaisModelo? selectCountry;
|
||||
bool showSelectCountry = false;
|
||||
String? selectPaisResidencia;
|
||||
String? selectClassification;
|
||||
int? selectClassificationCOD;
|
||||
String? selectGender;
|
||||
@@ -383,6 +389,8 @@ class _RegisterCitizenScreenState extends State<RegisterCitizenScreen> {
|
||||
}
|
||||
|
||||
saveCitizen()async{
|
||||
print('NISController.text');
|
||||
print(NISController.text);
|
||||
Map<String, dynamic> row = {
|
||||
'ID_CIDADAO' : idCidadao,
|
||||
'CD_USUARIO_SUS' : codSus,
|
||||
@@ -409,10 +417,10 @@ class _RegisterCitizenScreenState extends State<RegisterCitizenScreen> {
|
||||
'CLASSIFICACAO' : selectClassificationCOD,
|
||||
'CLASSIFICACAO_SUB' : selectSubdivisionCOD,
|
||||
'NUM_FAMILIA' : numberFamilyController.text,
|
||||
'ID_PAIS_RESID' : selectCountry=='BRASIL'?33:0,
|
||||
'ID_MUNICIPIO_RESID' : resultListResid[0]['ID_MUNICIPIO'],
|
||||
'NO_MUNICIPIO_RESID' : resultListResid[0]['NO_MUNICIPIO'],
|
||||
'ESTADO_UF_RESID' : resultListResid[0]['UF_ESTADO'],
|
||||
'ID_PAIS_RESID' : selectCountry!.ID_PAIS_RESID,
|
||||
'ID_MUNICIPIO_RESID' : selectCountry!.ID_PAIS_RESID!=33?0:resultListResid[0]['ID_MUNICIPIO'],
|
||||
'NO_MUNICIPIO_RESID' : selectCountry!.ID_PAIS_RESID!=33?'':resultListResid[0]['NO_MUNICIPIO'],
|
||||
'ESTADO_UF_RESID' : selectCountry!.ID_PAIS_RESID!=33?'':resultListResid[0]['UF_ESTADO'],
|
||||
'CODIGO_IBGE_RESID' : codIBGEController.text,
|
||||
'NO_BAIRRO_LOGR' : selectVillage,
|
||||
'ID_LOGR_TIPO' : idTipo,
|
||||
@@ -451,7 +459,7 @@ class _RegisterCitizenScreenState extends State<RegisterCitizenScreen> {
|
||||
'ESTADO_UF_CTPS' : selectCTPSUF,
|
||||
'NUM_PIS_PASEP' : PISController.text.isNotEmpty?int.parse(PISController.text):0,
|
||||
'FL_RETIROU_CARTAO' : enableCityCard?'S':'N',
|
||||
'NUM_NIS' : NISController.text.isNotEmpty?int.parse(NISController.text):0,
|
||||
'NUM_NIS' : NISController.text.isNotEmpty && NISController.text!=null && NISController.text.toLowerCase().trim()!='null' ?int.parse(NISController.text):0,
|
||||
'NUM_PROT_CROSS' : '',
|
||||
'RENDA_MENSAL' : incomeController.text.isNotEmpty?double.parse(incomeController.text.replaceAll('R\$ ', '').replaceAll('.', '').replaceAll(',', '.')):0,
|
||||
'PROFISSAO' : professionalController.text,
|
||||
@@ -586,7 +594,15 @@ class _RegisterCitizenScreenState extends State<RegisterCitizenScreen> {
|
||||
selectSubdivisionCOD = widget.listData[0]['CLASSIFICACAO_SUB']=='null'?0:widget.listData[0]['CLASSIFICACAO_SUB'];
|
||||
}
|
||||
numberFamilyController.text = widget.listData[0]['NUM_FAMILIA'].toString();
|
||||
selectCountry = widget.listData[0]['ID_PAIS_RESID']==33?'BRASIL':'OUTRO';
|
||||
if(widget.listData[0]['ID_PAIS_RESID']!=0 && widget.listData[0]['ID_PAIS_RESID']!=null){
|
||||
for(int i = 0; ConstVariable().paises.length > i;i++){
|
||||
if(ConstVariable().paises[i].ID_PAIS_RESID == widget.listData[0]['ID_PAIS_RESID']){
|
||||
selectCountry = ConstVariable().paises[i];
|
||||
print(selectCountry!.ID_PAIS_RESID);
|
||||
print(selectCountry!.PAIS);
|
||||
}
|
||||
}
|
||||
}
|
||||
int codCity = widget.listData[0]['ID_MUNICIPIO_RESID'];
|
||||
List listCity = await DBQuerys().buscaMunicipioporId(codCity);
|
||||
cityController.text = listCity.length!=0?listCity[0]['NO_MUNICIPIO']+' - SP':'';
|
||||
@@ -888,6 +904,7 @@ class _RegisterCitizenScreenState extends State<RegisterCitizenScreen> {
|
||||
setState(() {
|
||||
selectNaturality = value!;
|
||||
if(selectNaturality!='BRASILEIRO'){
|
||||
selectCountry = null;
|
||||
if(selectNaturality=='ESTRANGEIRO'){
|
||||
selectNaturalityCod = 2;
|
||||
}else{
|
||||
@@ -897,11 +914,58 @@ class _RegisterCitizenScreenState extends State<RegisterCitizenScreen> {
|
||||
}else{
|
||||
cityBirthController.text = '';
|
||||
selectNaturalityCod = 1;
|
||||
selectCountry = PaisModelo(ID_PAIS_RESID: 33, PAIS: 'BRASIL');
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
selectNaturality==null&& mandatory?ErrorDefault():Container(),
|
||||
!showSelectCountry?GestureDetector(
|
||||
onTap: ()=>setState(()=>showSelectCountry=true),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: width*0.7,
|
||||
child: TitleInput(title:'País de Nascimento')
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
width: width*0.7,
|
||||
alignment: Alignment.centerLeft,
|
||||
height: 50,
|
||||
color: Colors.white,
|
||||
child: TextDefault(
|
||||
color: Colors.black,
|
||||
fontSize: 15,
|
||||
text:selectCountry==null?'SELECIONE UM PAÍS': selectCountry!.PAIS
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
):
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
width: width*0.7,
|
||||
child: TitleInput(title:'País de Nascimento')
|
||||
),
|
||||
DropDownButtonComPesquisaPaises(
|
||||
list: ConstVariable().paises,
|
||||
title: 'Pesquise o país',
|
||||
select: selectCountry,
|
||||
width: width*0.7,
|
||||
onChanged: ( dynamic value){
|
||||
setState(() {
|
||||
selectCountry = value;
|
||||
print(value.PAIS);
|
||||
print(value.ID_PAIS_RESID);
|
||||
showSelectCountry = false;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: cityBirthController.text == 'MUNICIPIO IGNORADO - SP' || edit?null:(){
|
||||
searchCityController.text = '';
|
||||
@@ -1190,7 +1254,7 @@ class _RegisterCitizenScreenState extends State<RegisterCitizenScreen> {
|
||||
selectClassificationCOD = 1;
|
||||
}
|
||||
changedCity();
|
||||
selectCountry = 'BRASIL';
|
||||
selectCountry = PaisModelo(ID_PAIS_RESID: 33, PAIS: 'BRASIL');
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
@@ -1239,7 +1303,7 @@ class _RegisterCitizenScreenState extends State<RegisterCitizenScreen> {
|
||||
children: [
|
||||
DropdownWithSubtitle(
|
||||
subtitle: 'Pais de Residência',
|
||||
select: selectCountry,
|
||||
select: selectPaisResidencia,
|
||||
widthSubtitle: width*0.6,
|
||||
widthDropdown: width*0.69,
|
||||
widthContainerDropdown: width*0.6,
|
||||
|
||||
80
lib/widgets/dropdown_button_com_pesquisa_paises.dart
Normal file
80
lib/widgets/dropdown_button_com_pesquisa_paises.dart
Normal file
@@ -0,0 +1,80 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||
import 'package:rkm/models/pais_modelo.dart';
|
||||
import 'package:rkm/widgets/text_default.dart';
|
||||
import '../config/color_palette.dart';
|
||||
import '../config/const_variable.dart';
|
||||
import 'input_search_text.dart';
|
||||
|
||||
class DropDownButtonComPesquisaPaises extends StatelessWidget {
|
||||
var onChanged;
|
||||
PaisModelo? select;
|
||||
String title;
|
||||
double fontSize;
|
||||
List<PaisModelo> list;
|
||||
double width;
|
||||
double heightDinamic;
|
||||
double widthContainer;
|
||||
|
||||
DropDownButtonComPesquisaPaises({
|
||||
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(),
|
||||
suggestionsCallback: (pattern) {
|
||||
if (list != null) {
|
||||
return list.where((value) => value.PAIS.toLowerCase().contains(pattern.toLowerCase())).toList();
|
||||
} else {
|
||||
return Future.value([]);
|
||||
}
|
||||
},
|
||||
emptyBuilder: (context) {
|
||||
return ListTile(
|
||||
title: Text('Nenhum resultado encontrado'),
|
||||
);
|
||||
},
|
||||
itemBuilder: (context, suggestion) {
|
||||
// Aqui, o tipo de 'suggestion' é dinâmico, pois a lista retornada
|
||||
// por suggestionsCallback pode conter diferentes tipos de objetos.
|
||||
// Você pode usar a notação de tipo dinâmico ou verificar o tipo do
|
||||
// objeto e fazer o cast para 'PaisModelo' antes de usar.
|
||||
if (suggestion is PaisModelo) {
|
||||
// Faz o cast para 'PaisModelo' se necessário
|
||||
final paisModelo = suggestion as PaisModelo;
|
||||
return ListTile(
|
||||
title: Text(paisModelo.PAIS),
|
||||
);
|
||||
}
|
||||
// Se o objeto não for do tipo 'PaisModelo', retorne um widget vazio
|
||||
return SizedBox.shrink();
|
||||
},
|
||||
onSelected: onChanged,
|
||||
)
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -221,14 +221,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.6.5"
|
||||
html_unescape:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: html_unescape
|
||||
sha256: "15362d7a18f19d7b742ef8dcb811f5fd2a2df98db9f80ea393c075189e0b61e3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
http:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
||||
@@ -21,7 +21,9 @@ dependencies:
|
||||
shared_preferences: ^2.0.15
|
||||
get:
|
||||
brasil_fields:
|
||||
# lista com pesquisa
|
||||
flutter_typeahead: ^5.2.0
|
||||
|
||||
flutter_localizations:
|
||||
sdk: flutter
|
||||
|
||||
|
||||
Reference in New Issue
Block a user