na tela visita_domiciliar_tela.dart não é mais obrigatório o campo procedimento.
This commit is contained in:
@@ -79,114 +79,110 @@ class _SyncInitScreenState extends State<SyncInitScreen> {
|
||||
initSync()async{
|
||||
await DbSqliteSync().deleteSync().then((_)async{
|
||||
await ApiDataSync().syncPerm(urlAPI,mode,nameCityApi,user).then((response)async{
|
||||
if(response['status'] == 0 || response['sync_perm'] != "S"){
|
||||
AlertDialogDefault().alert(context, 'Erro', 'Usuário sem permissão para Sincronização de Unidade!', 'Voltar');
|
||||
}else{
|
||||
countProg = 0.1;
|
||||
setState(()=> messageSteps = "Etapa 1 de 10 - Importando informações do CONECTASUS");
|
||||
await ApiDataSync().syncBairros(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Bairros - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 2 de 10 - Gravando os Bairros no Aplicativo");
|
||||
await DbSqliteSync().insertBairros(value).then((value)async{
|
||||
countProg = 0.2;
|
||||
setState(() {});
|
||||
await ApiDataSync().syncTiposLogradouros(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Tipos de Logradouros - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 3 de 10 - Gravando os Tipos de Logradouros no Aplicativo");
|
||||
await DbSqliteSync().insertTiposLogradouros(value).then((value)async{
|
||||
countProg =0.3;
|
||||
setState(() {});
|
||||
await ApiDataSync().syncLogradouros(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Logradouros - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 4 de 10 - Gravando os Logradouros no Aplicativo");
|
||||
await DbSqliteSync().insertLogradouros(value).then((value)async{
|
||||
countProg = 0.4;
|
||||
setState(() {});
|
||||
await ApiDataSync().syncLoteamentos(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Loteamentos - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 5 de 10 - Gravando os Loteamentos no Aplicativo");
|
||||
await DbSqliteSync().insertLoteamentos(value).then((value)async{
|
||||
countProg = 0.5;
|
||||
setState(() {});
|
||||
await ApiDataSync().syncProfissionais(urlAPI,mode,nameCityApi,user,idUnidade).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Profissionais - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 6 de 10 - Gravando os Profissionais no Aplicativo");
|
||||
await DbSqliteSync().insertProfissionais(value).then((value)async{
|
||||
countProg = 0.6;
|
||||
setState(() {});
|
||||
await ApiDataSync().syncProfissionaisCBOs(urlAPI,mode,nameCityApi,user,idUnidade).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os CBOs dos Profissionais - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 7 de 10 - Gravando os CBO´s dos Profissionais no Aplicativo");
|
||||
}
|
||||
await DbSqliteSync().insertProfissionaisCBOs(value).then((value)async{
|
||||
countProg = 0.7;
|
||||
setState(() {});
|
||||
await ApiDataSync().syncCidadaos(urlAPI,mode,nameCityApi,user,idUnidade,idArea,idMicroarea,foraArea).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Cadastros dos Cidadãos - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 8 de 10 - Gravando os Cidadãos no Aplicativo");
|
||||
await DbSqliteSync().insertCidadaos(value,'sync','').then((value)async{
|
||||
countProg = 0.8;
|
||||
setState(() {});
|
||||
await ApiDataSync().syncCadastrosDomiciliares(urlAPI,mode,nameCityApi,user,idUnidade,idArea,idMicroarea,foraArea).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Cadastros Domiciliares - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 9 de 10 - Gravando os Cadastros Domiciliares no Aplicativo");
|
||||
await DbSqliteSync().insertCadastrosDomiciliares(value,'sync',0,0,'').then((value)async{
|
||||
countProg = 0.9;
|
||||
setState(() {});
|
||||
await ApiDataSync().syncCadastrosIndividuais(urlAPI,mode,nameCityApi,user,idUnidade,idArea,idMicroarea,foraArea).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Cadastros Individuais - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 10 de 10 - Gravando os Cadastros Individuais no Aplicativo");
|
||||
await DbSqliteSync().insertCadastrosIndividuais(value,'sync',0).then((value)async{
|
||||
await DbSqliteSync().saveSync(codCity,codState,urlAPI,mode,nameCityApi,nameCityFront,codCityIbge,user,idUnidade,nomeUnidade,idArea,idMicroarea).then((value)async{
|
||||
countProg = 1;
|
||||
setState(() {});
|
||||
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context)=>HomeScreen(username: user)));
|
||||
});
|
||||
});
|
||||
}
|
||||
countProg = 0.1;
|
||||
setState(()=> messageSteps = "Etapa 1 de 10 - Importando informações do CONECTASUS");
|
||||
await ApiDataSync().syncBairros(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Bairros - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 2 de 10 - Gravando os Bairros no Aplicativo");
|
||||
await DbSqliteSync().insertBairros(value).then((value)async{
|
||||
countProg = 0.2;
|
||||
setState(() {});
|
||||
await ApiDataSync().syncTiposLogradouros(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Tipos de Logradouros - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 3 de 10 - Gravando os Tipos de Logradouros no Aplicativo");
|
||||
await DbSqliteSync().insertTiposLogradouros(value).then((value)async{
|
||||
countProg =0.3;
|
||||
setState(() {});
|
||||
await ApiDataSync().syncLogradouros(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Logradouros - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 4 de 10 - Gravando os Logradouros no Aplicativo");
|
||||
await DbSqliteSync().insertLogradouros(value).then((value)async{
|
||||
countProg = 0.4;
|
||||
setState(() {});
|
||||
await ApiDataSync().syncLoteamentos(urlAPI,mode,nameCityApi,user).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Loteamentos - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 5 de 10 - Gravando os Loteamentos no Aplicativo");
|
||||
await DbSqliteSync().insertLoteamentos(value).then((value)async{
|
||||
countProg = 0.5;
|
||||
setState(() {});
|
||||
await ApiDataSync().syncProfissionais(urlAPI,mode,nameCityApi,user,idUnidade).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Profissionais - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 6 de 10 - Gravando os Profissionais no Aplicativo");
|
||||
await DbSqliteSync().insertProfissionais(value).then((value)async{
|
||||
countProg = 0.6;
|
||||
setState(() {});
|
||||
await ApiDataSync().syncProfissionaisCBOs(urlAPI,mode,nameCityApi,user,idUnidade).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os CBOs dos Profissionais - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 7 de 10 - Gravando os CBO´s dos Profissionais no Aplicativo");
|
||||
}
|
||||
await DbSqliteSync().insertProfissionaisCBOs(value).then((value)async{
|
||||
countProg = 0.7;
|
||||
setState(() {});
|
||||
await ApiDataSync().syncCidadaos(urlAPI,mode,nameCityApi,user,idUnidade,idArea,idMicroarea,foraArea).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Cadastros dos Cidadãos - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 8 de 10 - Gravando os Cidadãos no Aplicativo");
|
||||
await DbSqliteSync().insertCidadaos(value,'sync','').then((value)async{
|
||||
countProg = 0.8;
|
||||
setState(() {});
|
||||
await ApiDataSync().syncCadastrosDomiciliares(urlAPI,mode,nameCityApi,user,idUnidade,idArea,idMicroarea,foraArea).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Cadastros Domiciliares - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 9 de 10 - Gravando os Cadastros Domiciliares no Aplicativo");
|
||||
await DbSqliteSync().insertCadastrosDomiciliares(value,'sync',0,0,'').then((value)async{
|
||||
countProg = 0.9;
|
||||
setState(() {});
|
||||
await ApiDataSync().syncCadastrosIndividuais(urlAPI,mode,nameCityApi,user,idUnidade,idArea,idMicroarea,foraArea).then((value)async{
|
||||
if(value.length == 0){
|
||||
setState(()=> messageSteps = "ERRO: Erro para carregar os Cadastros Individuais - Por favor, tente novamente!");
|
||||
}else{
|
||||
setState(()=> messageSteps = "Etapa 10 de 10 - Gravando os Cadastros Individuais no Aplicativo");
|
||||
await DbSqliteSync().insertCadastrosIndividuais(value,'sync',0).then((value)async{
|
||||
await DbSqliteSync().saveSync(codCity,codState,urlAPI,mode,nameCityApi,nameCityFront,codCityIbge,user,idUnidade,nomeUnidade,idArea,idMicroarea).then((value)async{
|
||||
countProg = 1;
|
||||
setState(() {});
|
||||
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context)=>HomeScreen(username: user)));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user