diff --git a/config.xml b/config.xml index de262df..c6d5695 100644 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ - + SintomApp-Acatlan An app for control an visualizatión of a pandemic data like simphtoms evolution and sumarized data in the 'FES Acatán UNAM' Axel Iván Solano González diff --git a/resources/android/xml/network_security_config.xml b/resources/android/xml/network_security_config.xml index 8861d0f..0fdb1fd 100644 --- a/resources/android/xml/network_security_config.xml +++ b/resources/android/xml/network_security_config.xml @@ -1,7 +1,7 @@ - 192.168.0.8 + 192.168.0.13 132.248.80.77 diff --git a/sintomApp.apk b/sintomApp.apk deleted file mode 100644 index b56d202..0000000 Binary files a/sintomApp.apk and /dev/null differ diff --git a/src/app/admininfo/admininfo.page.html b/src/app/admininfo/admininfo.page.html index 7ea1c2f..099e73b 100644 --- a/src/app/admininfo/admininfo.page.html +++ b/src/app/admininfo/admininfo.page.html @@ -1,7 +1,7 @@ - + Datos Secretario diff --git a/src/app/admininfo/admininfo.page.ts b/src/app/admininfo/admininfo.page.ts index 5da9214..08c26cf 100644 --- a/src/app/admininfo/admininfo.page.ts +++ b/src/app/admininfo/admininfo.page.ts @@ -70,7 +70,23 @@ noCtaStudent:Number; } } },{ - text: 'Cancel', + text: 'Alumno Saludable', + icon: 'medkit-outline', + handler: () => { + this.noCtaStudent=stu.user.username; + console.log("value to compare",this.noCtaStudent); + var studentFinal = this.students.find(student => student.user.username==this.noCtaStudent); + const request =this.auth.store.update("secretary/healthy",studentFinal.id); + this.loader.do(request, 'Validando información'); + if(studentFinal.infected){ + var index = this.students.indexOf(studentFinal); + studentFinal.infected=false; + this.students[index]=studentFinal; + this.presentToast(studentFinal.name); + } + } + },{ + text: 'Cancelar', icon: 'close', role: 'cancel', handler: () => { diff --git a/src/app/admintabs/admintabs-routing.module.ts b/src/app/admintabs/admintabs-routing.module.ts index 75d5d75..7aee4dc 100644 --- a/src/app/admintabs/admintabs-routing.module.ts +++ b/src/app/admintabs/admintabs-routing.module.ts @@ -22,7 +22,7 @@ const routes: Routes = [ }, { path: '', - redirectTo: '/admintabs/info', + redirectTo: '/admintabs/data', pathMatch: 'full' } ] diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 73f22b5..474b65f 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -23,6 +23,14 @@ const routes: Routes = [ path: 'admin', loadChildren: () => import('./admin-page/admin-page.module').then( m => m.AdminPagePageModule) }, + { + path: 'user', + loadChildren: () => import('./tab1/tab1.module').then( m => m.Tab1PageModule) + }, + { + path: 'simtoms', + loadChildren: () => import('./tab2/tab2.module').then( m => m.Tab2PageModule) + } ]; @NgModule({ imports: [ diff --git a/src/app/loggin/loggin.page.ts b/src/app/loggin/loggin.page.ts index a64f6b6..58c638d 100644 --- a/src/app/loggin/loggin.page.ts +++ b/src/app/loggin/loggin.page.ts @@ -78,24 +78,24 @@ export class LogginPage implements OnInit { switch (errorResponse.error.message) { case 'Bad credentials': - this.errorMessage = 'El usuario o la contraseña son inválidos'; + //this.errorMessage = 'El usuario o la contraseña son inválidos'; this.presentAlertErrores('El usuario o la contraseña son inválidos') break; default: this.presentAlertErrores(errorResponse.error.message) - this.errorMessage = 'Intentelo de nuevo más tarde.'; + /*this.errorMessage = 'Intentelo de nuevo más tarde.'; if (errorResponse.error.message) { this.errorMessage = this.errorMessage + ` [${errorResponse.error.message}]`; } else { this.errorMessage = this.errorMessage + ` [${errorResponse.message}]`; - } + }*/ } } routeDirector(userRole){ console.log(userRole.details.authorities) if(userRole.details.authorities[0]==="ROLE_USER"){ - this.nav.navigateForward('/tabs/user'); + this.nav.navigateForward('/user'); } else if (userRole.details.authorities[0]==="ROLE_SECRETARY"){ this.nav.navigateForward('/admintabs'); } else if (userRole.details.authorities[0]==="ROLE_ADMIN"){ @@ -105,7 +105,7 @@ export class LogginPage implements OnInit { onGoToNextPage(data){ if(data.details.authorities[0]=== "ROLE_USER"){ - this.router.navigate(['/tabs/user'],{ + this.router.navigate(['/user'],{ queryParams: { value : JSON.stringify(data) }, @@ -133,6 +133,9 @@ export class LogginPage implements OnInit { message: 'Para ingresar deberás utilizar las mismas credenciales que usas en servicios escolares.', buttons: ['OK'] }); + await alert.present(); + const { role } = await alert.onDidDismiss(); + console.log('onDidDismiss resolved with role', role); } async presentAlertErrores(message) { const alert = await this.alertController.create({ @@ -141,5 +144,8 @@ export class LogginPage implements OnInit { message: message, buttons: ['OK'] }); + await alert.present(); + const { role } = await alert.onDidDismiss(); + console.log('onDidDismiss resolved with role', role); } } diff --git a/src/app/photo/photo.page.ts b/src/app/photo/photo.page.ts index dd60512..75c29ea 100644 --- a/src/app/photo/photo.page.ts +++ b/src/app/photo/photo.page.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; -import { environment } from '../../environments/environment'; import { AuthService } from '../services/auth.service'; +import { AlertController } from '@ionic/angular'; const STORAGE_KEY = 'my_images'; @@ -17,7 +17,8 @@ export class PhotoPage implements OnInit { private file: File; constructor( - private auth:AuthService) { + private auth:AuthService, + public alertController: AlertController) { } ngOnInit(): void { @@ -30,14 +31,40 @@ export class PhotoPage implements OnInit { async submitForm() { let formData = new FormData(); formData.append("file", this.file, this.file.name); - + console.log("file weight:", this.file.size) this.auth.store.create("file", formData).subscribe((response) => {if(response){ + this.presentAlert(); console.log("exito"); }else{ + this.presentAlertFail(); console.log("error"); } }); } + async presentAlert() { + const alert = await this.alertController.create({ + cssClass: 'my-custom-class', + header: 'Foto enviada', + message: 'Tu foto fue enviada, el secretario técnico podrá validar en breve, si deseas enviar otro archivo puedes hacerlo', + buttons: ['OK'] + }); + await alert.present(); + const { role } = await alert.onDidDismiss(); + console.log('onDidDismiss resolved with role', role); + } + + async presentAlertFail() { + const alert = await this.alertController.create({ + cssClass: 'my-custom-class', + header: 'Foto enviada', + message: 'Tu foto no fue enviada, si deseas enviar otro archivo puedes hacerlo', + buttons: ['OK'] + }); + await alert.present(); + const { role } = await alert.onDidDismiss(); + console.log('onDidDismiss resolved with role', role); + } + } diff --git a/src/app/student/student.page.html b/src/app/student/student.page.html index d3f5dc7..0a0bbc6 100644 --- a/src/app/student/student.page.html +++ b/src/app/student/student.page.html @@ -1,7 +1,7 @@ - + {{ data.user.name }} @@ -47,6 +47,15 @@ Infectado: {{ data.infected }} + + + Sintomas + + + + {{ simptom.symptoms.description}} + + diff --git a/src/app/student/student.page.ts b/src/app/student/student.page.ts index 7adac23..ae79cb8 100644 --- a/src/app/student/student.page.ts +++ b/src/app/student/student.page.ts @@ -11,6 +11,7 @@ export class StudentPage implements OnInit { data= {email:"", phone:"", street:"", noExt:0, noInt:0, suburb:"",cp:"", state:"",infected:false, user:{name:""}} photos = [] + simpthoms = [] constructor( public activatedRoute : ActivatedRoute, private auth : AuthService) { @@ -20,6 +21,10 @@ export class StudentPage implements OnInit { console.log(all); this.photos = all; }); + this.auth.store.get(`secretary/evolution/${JSON.parse(res.value).user.name}`).subscribe( all =>{ + console.log(all); + this.simpthoms = all; + }); }); } ngOnInit(): void { diff --git a/src/app/tab1/tab1.page.html b/src/app/tab1/tab1.page.html index 5d92786..ada1e9b 100644 --- a/src/app/tab1/tab1.page.html +++ b/src/app/tab1/tab1.page.html @@ -1,7 +1,7 @@ - + Datos @@ -19,7 +19,7 @@ Correo: - + @@ -59,9 +59,11 @@
+ Guardar - + + Sintomas
diff --git a/src/app/tab1/tab1.page.ts b/src/app/tab1/tab1.page.ts index 7934f77..91172ac 100644 --- a/src/app/tab1/tab1.page.ts +++ b/src/app/tab1/tab1.page.ts @@ -45,7 +45,7 @@ export class Tab1Page implements OnInit{ } moveOn(){ - this.nav.navigateForward('/tabs/simptoms') + this.nav.navigateForward('/simtoms') } dailyNotification(){ diff --git a/src/app/tab2/tab2.page.html b/src/app/tab2/tab2.page.html index 4df2e39..285e5ee 100644 --- a/src/app/tab2/tab2.page.html +++ b/src/app/tab2/tab2.page.html @@ -1,6 +1,6 @@ - + Enviar diff --git a/src/app/tab2/tab2.page.ts b/src/app/tab2/tab2.page.ts index 0ca76a4..091e770 100644 --- a/src/app/tab2/tab2.page.ts +++ b/src/app/tab2/tab2.page.ts @@ -29,6 +29,17 @@ export class Tab2Page implements OnInit{ }) } ); + this.auth.store.get("evolution").subscribe( + res => { + res.forEach(element => { + this.form.forEach(formElement => { + if(formElement.id == element.id){ + formElement.isChecked=true; + } + }) + }); + } + ) } loadData(){ @@ -36,14 +47,16 @@ export class Tab2Page implements OnInit{ console.log(request); this.loader.do(request, 'Guardando información'); this.presentToast(); + this.nav.navigateBack('/user'); } async presentToast() { const toast = await this.toast.create({ message: 'Sintomas enviados, gracias', - duration: 30000 + duration: 5000 }); toast.present(); + } movePhoto(){ this.nav.navigateForward('/photo')