Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class MyApp {
this.pages = [
{title: 'page.profile', component: 'ProfilePage'},
{title: 'page.regiobed.title', component: 'RegiobedPage'},
{title: 'Patients', component: 'PatientsPage'},
{title: 'page.beds.list', component: 'BedsPage'},
{title: 'page.logout', component: 'LoginPage', method: 'logout'}
];
Expand Down
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {AuthHttp, AuthConfig} from 'angular2-jwt';
import {Storage} from '@ionic/storage';
import {AuthService} from '../providers/auth-service';
import {BedsService} from '../providers/beds-service';
import {PatientsService} from '../providers/patients-service';
import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
import {TranslateHttpLoader} from '@ngx-translate/http-loader';

Expand Down Expand Up @@ -64,6 +65,7 @@ export function createTranslateLoader(http: Http) {
},
AuthService,
BedsService,
PatientsService,
DistoreProvider,
CryptoProvider,
MockstoreProvider,
Expand Down
3 changes: 2 additions & 1 deletion src/app/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export let cfg = {
register: '/auth/signup',
login: '/auth/login'
},
beds: '/beds'
beds: '/beds',
patients: '/patients'
};
10 changes: 10 additions & 0 deletions src/models/patient.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export class PatientModel {
public id?: number;
public name: string;
public date_of_birth: string;

constructor(){
this.name = "Annie";
this.date_of_birth = "2017/12/12";
}
}
41 changes: 41 additions & 0 deletions src/pages/patient-add-page/patient-add-page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<ion-header>

<ion-navbar>
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>{{ 'page.patient.add' | translate }}</ion-title>
</ion-navbar>

</ion-header>


<ion-content padding>

<ion-grid>
<ion-row justify-content-around>
<ion-col col-sm-6 col-md-6 col-lg-4 col-xl-3 align-self-center>
<form [formGroup]="patientData" (ngSubmit)="process()">
<ion-item>
<ion-label floating>{{ 'label.name' | translate }}:</ion-label>
<ion-input type="text" formControlName="name"></ion-input>
</ion-item>

<ion-item>
<ion-label floating>Date of Birth:</ion-label>
<ion-input type="text" formControlName="date_of_birth"></ion-input>
</ion-item>

<button margin-top ion-button type="submit" [disabled]="!patientData.valid">{{ 'button.submit' | translate }}</button>

</form>

</ion-col>

</ion-row>



</ion-grid>

</ion-content>
18 changes: 18 additions & 0 deletions src/pages/patient-add-page/patient-add-page.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {NgModule} from '@angular/core';
import {IonicPageModule} from 'ionic-angular';
import {PatientAddPage} from './patient-add-page';
import {TranslateModule} from '@ngx-translate/core';

@NgModule({
declarations: [
PatientAddPage,
],
imports: [
IonicPageModule.forChild(PatientAddPage),
TranslateModule.forChild()
],
exports: [
PatientAddPage
]
})
export class PatientAddPageModule {}
3 changes: 3 additions & 0 deletions src/pages/patient-add-page/patient-add-page.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
page-patient-add-page {

}
65 changes: 65 additions & 0 deletions src/pages/patient-add-page/patient-add-page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams, MenuController} from 'ionic-angular';
import {ToastController} from 'ionic-angular';
import {ProtectedPage} from '../protected-page/protected-page';
import {Storage} from '@ionic/storage';
import {Validators, FormBuilder, FormGroup} from '@angular/forms';
import {PatientsService} from '../../providers/patients-service';
import {PatientModel} from '../../models/patient.model';
import {AutoriteitProvider} from '../../providers/autoriteit/autoriteit'



@IonicPage()
@Component({
selector: 'page-patient-add-page',
templateUrl: 'patient-add-page.html',
})
export class PatientAddPage extends ProtectedPage {

private patientData: FormGroup;

constructor(
public navCtrl: NavController,
public navParams: NavParams,
public toastCtrl: ToastController,
public menuCtrl: MenuController,
public storage: Storage,
public formBuilder: FormBuilder,
public au: AutoriteitProvider,
public patientsService: PatientsService) {

super(navCtrl, navParams, storage);

this.patientData = this.formBuilder.group({
id: [Math.floor(Math.random() * 10)],
name: ['', Validators.required],
date_of_birth: ['', Validators.required],
});
}

showToastWithCloseButton() {
const toast = this.toastCtrl.create({
message: 'Patient was succesfully added!',
showCloseButton: true,
duration: 2000,
cssClass: 'succes',
closeButtonText: 'Ok'
});
toast.present();
}

process() {
let patient: PatientModel;
patient = new PatientModel();
let newpatient = Object.assign(patient, this.patientData.value);
this.patientsService.add(newpatient);
this.navCtrl.pop();
this.showToastWithCloseButton();
/* this.PatientsService.add(this.patientData.value)
.then(() => this.navCtrl.push('patientsPage'))
.catch((e) => console.log("add patient error", e)); */
}


}
42 changes: 42 additions & 0 deletions src/pages/patient-edit-page/patient-edit-page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<ion-header>

<ion-navbar>
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>Edit Patient</ion-title>
</ion-navbar>

</ion-header>


<ion-content padding>

<ion-grid>
<ion-row justify-content-around>
<ion-col col-sm-6 col-md-6 col-lg-4 col-xl-3 align-self-center>
<form [formGroup]="patientData" (ngSubmit)="process()">
<ion-item>
<ion-label floating>{{ 'label.name' | translate }}:</ion-label>
<ion-input type="text" formControlName="name"></ion-input>
</ion-item>

<ion-item>
<ion-label floating>Date of Birth:</ion-label>
<ion-input type="text" formControlName="date_of_birth"></ion-input>
</ion-item>


<button margin-top ion-button type="submit" [disabled]="!patientData.valid">{{ 'button.submit' | translate }}</button>

</form>

</ion-col>

</ion-row>



</ion-grid>

</ion-content>
18 changes: 18 additions & 0 deletions src/pages/patient-edit-page/patient-edit-page.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {NgModule} from '@angular/core';
import {IonicPageModule} from 'ionic-angular';
import {PatientEditPage} from './patient-edit-page';
import {TranslateModule} from '@ngx-translate/core';

@NgModule({
declarations: [
PatientEditPage,
],
imports: [
IonicPageModule.forChild(PatientEditPage),
TranslateModule.forChild()
],
exports: [
PatientEditPage
]
})
export class PatientEditPageModule {}
3 changes: 3 additions & 0 deletions src/pages/patient-edit-page/patient-edit-page.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
page-patient-add-page {

}
52 changes: 52 additions & 0 deletions src/pages/patient-edit-page/patient-edit-page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams, MenuController} from 'ionic-angular';
import {ProtectedPage} from '../protected-page/protected-page';
import {Storage} from '@ionic/storage';
import {Validators, FormBuilder, FormGroup} from '@angular/forms';
import {PatientsService} from '../../providers/patients-service';
import {PatientModel} from '../../models/patient.model';
import {AutoriteitProvider} from '../../providers/autoriteit/autoriteit'

@IonicPage()
@Component({
selector: 'page-patient-edit-page',
templateUrl: 'patient-edit-page.html',
})
export class PatientEditPage extends ProtectedPage {

private patientData: FormGroup;
private patient: PatientModel;

constructor(
public navCtrl: NavController,
public navParams: NavParams,
public menuCtrl: MenuController,
public storage: Storage,
public au: AutoriteitProvider,
public formBuilder: FormBuilder,
public patientsService: PatientsService) {

super(navCtrl, navParams, storage);

this.patient = navParams.get('patient');


this.patientData = this.formBuilder.group({
name: [this.patient.name, Validators.required],
date_of_birth: [this.patient.date_of_birth, Validators.required]
});
}

process() {

let updatedPatient = Object.assign(this.patient, this.patientData.value);

this.patientsService.update(updatedPatient);
this.navCtrl.pop();
/* this.bedsService.update(updatedBed)
.then(() => this.navCtrl.pop())
.catch((e) => console.log("add bed error", e)); */
}


}
42 changes: 42 additions & 0 deletions src/pages/patient-info-page/patient-info-page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<ion-header>

<ion-navbar>
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>Patient</ion-title>
</ion-navbar>

</ion-header>


<ion-content padding>

<ion-card *ngIf="patient">
<ion-card-content>
<h1>{{ patient.name }}</h1>
{{ patient.date_of_birth }}
</ion-card-content>


<ion-row>
<ion-col>
<button ion-button icon-left clear small color="secondary" (click)="editPatient(patient)">
<ion-icon name="construct"></ion-icon>
<div>{{ 'button.edit' | translate }}</div>
</button>
</ion-col>

<ion-col text-right>
<button ion-button icon-left clear small color="danger" (click)="deletePatient(patient)">
<ion-icon name="trash"></ion-icon>
<div>{{ 'button.delete' | translate }}</div>
</button>
</ion-col>

</ion-row>


</ion-card>

</ion-content>
18 changes: 18 additions & 0 deletions src/pages/patient-info-page/patient-info-page.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { PatientInfoPage } from './patient-info-page';
import {TranslateModule} from '@ngx-translate/core';

@NgModule({
declarations: [
PatientInfoPage,
],
imports: [
IonicPageModule.forChild(PatientInfoPage),
TranslateModule.forChild()
],
exports: [
PatientInfoPage
]
})
export class PatientInfoPageModule {}
Loading