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
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"name": "io.empowerhack.hababy",
"author": "HaBaby Team",
"homepage": "http://empowerhack.io/",
"description": "HaBaby: An Ionic project",
"version": "0.0.1",
"private": true,
"scripts": {
"ionic:build": "ionic-app-scripts build",
Expand Down Expand Up @@ -44,6 +46,5 @@
"version": "",
"locator": "ios"
}
],
"description": "HaBaby: An Ionic project"
]
}
118 changes: 55 additions & 63 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import{Component, ViewChild}from '@angular/core';
import {Platform, MenuController, Nav, Events }from 'ionic-angular';
import {StatusBar, Splashscreen, SQLite}from 'ionic-native';
import {TranslateService}from 'ng2-translate/ng2-translate';

import { Component, ViewChild } from '@angular/core';
import { Platform, MenuController, Nav, Events } from 'ionic-angular';
import { StatusBar, Splashscreen, SQLite } from 'ionic-native';
import { TranslateService } from 'ng2-translate';

import { ClinicianPage } from '../pages/clinician/clinician';
import { HelpSettingsPage } from '../pages/help-settings/help-settings';
import { HistoryPage } from '../pages/history/history';
import { HomePage } from '../pages/home/home';
import { PatientPage } from '../pages/patients/patient';
import { ClinicianPage } from '../pages/clinicians/index';
import { SymptomEntryPage } from '../pages/symptoms/entry';
import { MedicalHistoryPage } from '../pages/history/index';
import { PregnancyInfoPage } from '../pages/pregnancy/index';
import { LocationResourcesPage } from '../pages/resources/index';
import { HelpSettingsPage } from '../pages/help/index';
import { LocationResourcesPage } from '../pages/location-resources/location-resources';
import { PatientPage } from '../pages/patient/patient';
import { PregnancyPage } from '../pages/pregnancy/pregnancy';
import { SymptomsEntryPage } from '../pages/symptoms-entry/symptoms-entry';

@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage: any = HomePage;
menuPages: Array<{title: string, component: any}>;
menuPages: Array<{ title: string, component: any }>;

// the root nav is a child of the root app component
// @ViewChild(Nav) gets a reference to the app's root nav
@ViewChild(Nav) nav: Nav;

constructor(platform: Platform,
public menu: MenuController,
public events: Events,
private translate: TranslateService
public menu: MenuController,
public events: Events,
private translate: TranslateService
) {

platform.ready().then(() => {
Expand All @@ -36,19 +36,19 @@ export class MyApp {
Splashscreen.hide();
this.initializeTranslateServiceConfig();

let db = new SQLite();
db.openDatabase({
name: "data.db",
location: "default"
}).then(() => {
db.executeSql("CREATE TABLE IF NOT EXISTS symptom_log (id INTEGER PRIMARY KEY AUTOINCREMENT, timestamp TEXT, symptom1 INTEGER, symptom2 INTEGER, symptom3 INTEGER, notes TEXT)", {}).then((data) => {
console.log("TABLE CREATED: ", data);
}, (error) => {
console.error("Unable to execute sql", error);
})
let db = new SQLite();
db.openDatabase({
name: "data.db",
location: "default"
}).then(() => {
db.executeSql("CREATE TABLE IF NOT EXISTS symptom_log (id INTEGER PRIMARY KEY AUTOINCREMENT, timestamp TEXT, symptom1 INTEGER, symptom2 INTEGER, symptom3 INTEGER, notes TEXT)", {}).then((data) => {
console.log("TABLE CREATED: ", data);
}, (error) => {
console.error("Unable to open database", error);
});
console.error("Unable to execute sql", error);
})
}, (error) => {
console.error("Unable to open database", error);
});

});

Expand All @@ -75,37 +75,34 @@ export class MyApp {
}

updateMenuOptions(menu) {
if (menu == "patient")
{
// set patient section's pages
this.menuPages = [
{ title: this.translate.instant('menu.medicalHistory'), component: MedicalHistoryPage },
{ title: this.translate.instant('menu.symptomEntry'), component: SymptomEntryPage },
{ title: this.translate.instant('menu.pregnancyInfo'), component: PregnancyInfoPage },
{ title: this.translate.instant('menu.resources'), component: LocationResourcesPage },
{ title: this.translate.instant('menu.help'), component: HelpSettingsPage }
];
}
else if (menu == "clinician")
{
// set clinician section's pages
this.menuPages = [
{ title: this.translate.instant('menu.symptomEntry'), component: SymptomEntryPage },
{ title: this.translate.instant('menu.pregnancyInfo'), component: PregnancyInfoPage },
{ title: this.translate.instant('menu.resources'), component: LocationResourcesPage },
{ title: this.translate.instant('menu.help'), component: HelpSettingsPage }
];
}
else
{
// default
this.menuPages = [
{ title: 'Home', component: HomePage }
];
}
if (menu == "patient") {
// set patient section's pages
this.menuPages = [
{ title: this.translate.instant('menu.medicalHistory'), component: HistoryPage },
{ title: this.translate.instant('menu.symptomEntry'), component: SymptomsEntryPage },
{ title: this.translate.instant('menu.pregnancyInfo'), component: PregnancyPage },
{ title: this.translate.instant('menu.resources'), component: LocationResourcesPage },
{ title: this.translate.instant('menu.help'), component: HelpSettingsPage }
];
}
else if (menu == "clinician") {
// set clinician section's pages
this.menuPages = [
{ title: this.translate.instant('menu.symptomEntry'), component: SymptomsEntryPage },
{ title: this.translate.instant('menu.pregnancyInfo'), component: PregnancyPage },
{ title: this.translate.instant('menu.resources'), component: LocationResourcesPage },
{ title: this.translate.instant('menu.help'), component: HelpSettingsPage }
];
}
else {
// default
this.menuPages = [
{ title: 'Home', component: HomePage }
];
}
}

openPage(page: {title: string, component: any}) {
openPage(page: { title: string, component: any }) {

// the nav component was found using @ViewChild(Nav)
// reset the nav to remove previous pages and only have this page
Expand All @@ -127,13 +124,8 @@ export class MyApp {
this.translate.use(userLang);

this.translate.onLangChange.subscribe((event: Event) => {
this.updateMenuOptions("");
this.updateMenuOptions("");
});
}


}




64 changes: 29 additions & 35 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
import { NgModule } from '@angular/core';
import { IonicApp, IonicModule } from 'ionic-angular';
import { HttpModule, Http } from '@angular/http';
import { TranslateModule, TranslateLoader, TranslateStaticLoader } from 'ng2-translate/ng2-translate';
import { TranslateModule, TranslateLoader, TranslateStaticLoader } from 'ng2-translate';

import { MyApp } from './app.component';
import { AboutPage } from '../pages/about/about';
import { HomePage } from '../pages/home/home';
import { BasicInfoPage } from '../pages/basic-info/basic-info';
import { ClinicianPage } from '../pages/clinician/clinician';
import { DisclaimerPage } from '../pages/disclaimer/disclaimer';
import { BasicInfoPage } from '../pages/basicinfo/basicinfo';
import { PatientPage } from '../pages/patients/patient';
import { ClinicianPage } from '../pages/clinicians/index';
import { SymptomEntryPage } from '../pages/symptoms/entry';
import { MedicalHistoryPage } from '../pages/history/index';
import { HistoryProblemsPage } from '../pages/history/problems';
import { HelpSettingsPage } from '../pages/help-settings/help-settings';
import { HistoryPage } from '../pages/history/history';
import { HistoryProblemsPage } from '../pages/history-problems/history-problems';
import { HomePage } from '../pages/home/home';
import { LocationResourcesPage } from '../pages/location-resources/location-resources';
import { PatientPage } from '../pages/patient/patient';
import { PregnancyPage } from '../pages/pregnancy/pregnancy';
import { SymptomsEntryPage } from '../pages/symptoms-entry/symptoms-entry';
import { SymptomsLogPage } from '../pages/symptoms-log/symptoms-log';

import { PregnancyInfoPage } from '../pages/pregnancy/index';
import { LocationResourcesPage } from '../pages/resources/index';
import { HelpSettingsPage } from '../pages/help/index';
export const pages = [
AboutPage,
BasicInfoPage,
ClinicianPage,
DisclaimerPage,
HelpSettingsPage,
HistoryPage,
HistoryProblemsPage,
HomePage,
LocationResourcesPage,
PatientPage,
PregnancyPage,
SymptomsEntryPage,
SymptomsLogPage
];

export function createTranslateLoader(http: Http) {
return new TranslateStaticLoader(http, './assets/i18n', '.json');
Expand All @@ -25,18 +41,7 @@ export function createTranslateLoader(http: Http) {
@NgModule({
declarations: [
MyApp,
AboutPage,
HomePage,
DisclaimerPage,
BasicInfoPage,
PatientPage,
ClinicianPage,
SymptomEntryPage,
MedicalHistoryPage,
HistoryProblemsPage,
PregnancyInfoPage,
LocationResourcesPage,
HelpSettingsPage
pages
],
imports: [
HttpModule,
Expand All @@ -50,18 +55,7 @@ export function createTranslateLoader(http: Http) {
bootstrap: [IonicApp],
entryComponents: [
MyApp,
AboutPage,
HomePage,
DisclaimerPage,
BasicInfoPage,
PatientPage,
ClinicianPage,
SymptomEntryPage,
MedicalHistoryPage,
HistoryProblemsPage,
PregnancyInfoPage,
LocationResourcesPage,
HelpSettingsPage
pages
],
providers: []
})
Expand Down
19 changes: 19 additions & 0 deletions src/app/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,22 @@ button.inline {
.bar-button {
color: #fff;
}

.scroll-content {
text-align: center;
}
h2.apptitle {
font-size: 24px;
padding-top: 2em;
padding-bottom: 1em;
}
.language {
margin: 20px 32px;
font-size: 12px;
}
.tagline {
margin-top: 48px;
font-size: 11px;
}


2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<title>Ionic App</title>
<title>HaBaby</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
Expand Down
10 changes: 5 additions & 5 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "Ionic",
"short_name": "Ionic",
"name": "HaBaby",
"short_name": "HaBaby",
"start_url": "index.html",
"display": "standalone",
"icons": [{
"src": "assets/imgs/logo.png",
"sizes": "512x512",
"src": "assets/hababy_logo.png",
"sizes": "373x373",
"type": "image/png"
}],
"background_color": "#4e8ef7",
"theme_color": "#4e8ef7"
}
}
6 changes: 1 addition & 5 deletions src/pages/about/about.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import { Component } from '@angular/core';

import { NavController } from 'ionic-angular';

@Component({
selector: 'page-about',
templateUrl: 'about.html'
})
export class AboutPage {

constructor(public navCtrl: NavController) {

}
constructor() {}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
page-basicinfo {
page-basic-info {
.question {
font-size: 16px;
}
Expand Down
22 changes: 22 additions & 0 deletions src/pages/basic-info/basic-info.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Component } from '@angular/core';
import { NavController, Events } from 'ionic-angular';

@Component({
selector: 'page-basic-info',
templateUrl: 'basic-info.html'
})
export class BasicInfoPage {

constructor(
private navCtrl: NavController,
private events: Events
) {}

clickPregnant() {
this.events.publish('user:patient');
}
clickCaregiver() {
this.events.publish('user:clinician');
}

}
22 changes: 0 additions & 22 deletions src/pages/basicinfo/basicinfo.ts

This file was deleted.

File renamed without changes.
3 changes: 3 additions & 0 deletions src/pages/clinician/clinician.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
page-clinician {

}
Loading