From 57607d70afd3f6056476a100e8df19a7ece863dd Mon Sep 17 00:00:00 2001 From: Thor Galle Date: Wed, 19 Jul 2017 12:41:04 +0200 Subject: [PATCH] Camera fix + Roeselare version (#27) --- .gitignore | 1 + config.xml | 15 +- ionic.config.json | 5 - package-lock.json | 249 ++++++++++++++++++ package.json | 114 ++++---- src/app/app.module.ts | 17 +- src/app/app.scss | 2 +- src/app/environment.ts | 9 +- src/assets/img/tutorial/empty-1.jpg | Bin 0 -> 17084 bytes src/assets/img/tutorial/empty-2.jpg | Bin 0 -> 13984 bytes src/assets/json/albums.json | 4 +- src/dto/abstract-user.ts | 21 +- src/pages/api-testing/api-testing.html | 56 ++++ src/pages/api-testing/api-testing.scss | 3 + src/pages/api-testing/api-testing.ts | 47 ++++ src/pages/browse/browse.ts | 4 +- src/pages/empty/empty.html | 20 ++ src/pages/empty/empty.scss | 14 + src/pages/empty/empty.ts | 29 ++ .../new-story-selection.html | 57 ++-- .../new-story-selection.ts | 60 ++++- src/pages/new-story/new-story.html | 64 +++-- src/pages/new-story/new-story.scss | 28 +- src/pages/new-story/new-story.ts | 38 ++- src/pages/question/question.html | 17 ++ src/pages/question/question.scss | 31 +++ src/pages/question/question.ts | 42 +++ src/pages/questions/questions.html | 16 ++ src/pages/questions/questions.json.ts | 84 ++++++ src/pages/questions/questions.scss | 6 + src/pages/questions/questions.ts | 28 ++ src/pages/stories/stories.html | 14 +- src/pages/stories/stories.scss | 44 ++-- src/pages/stories/stories.ts | 31 ++- src/pages/storydetails/storydetails.html | 26 +- src/pages/storydetails/storydetails.scss | 5 + src/pages/tabs/tabs.html | 5 +- src/pages/tabs/tabs.ts | 51 +--- src/pages/tutorial/tutorial.html | 40 +-- src/pages/tutorial/tutorial.ts | 24 +- src/services/back-end/prisma-api.service.ts | 2 +- src/services/back-end/story.service.ts | 83 +++++- src/services/back-end/user.service.ts | 41 ++- src/services/util-service.ts | 61 +++-- src/theme/variables.scss | 13 +- 45 files changed, 1216 insertions(+), 305 deletions(-) delete mode 100644 ionic.config.json create mode 100644 src/assets/img/tutorial/empty-1.jpg create mode 100644 src/assets/img/tutorial/empty-2.jpg create mode 100644 src/pages/api-testing/api-testing.html create mode 100644 src/pages/api-testing/api-testing.scss create mode 100644 src/pages/api-testing/api-testing.ts create mode 100644 src/pages/empty/empty.html create mode 100644 src/pages/empty/empty.scss create mode 100644 src/pages/empty/empty.ts create mode 100644 src/pages/question/question.html create mode 100644 src/pages/question/question.scss create mode 100644 src/pages/question/question.ts create mode 100644 src/pages/questions/questions.html create mode 100644 src/pages/questions/questions.json.ts create mode 100644 src/pages/questions/questions.scss create mode 100644 src/pages/questions/questions.ts diff --git a/.gitignore b/.gitignore index 6ac8dff..177b9b6 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ Thumbs.db UserInterfaceState.xcuserstate ionic.config.json src/assets/img/heritage/ +ionic.config.json diff --git a/config.xml b/config.xml index cca819d..9bcc73a 100644 --- a/config.xml +++ b/config.xml @@ -77,11 +77,14 @@ - - - - - - + + + + + + + + + diff --git a/ionic.config.json b/ionic.config.json deleted file mode 100644 index 872844d..0000000 --- a/ionic.config.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "prisma-frontend", - "app_id": "e0fc6bde", - "type": "ionic-angular" -} diff --git a/package-lock.json b/package-lock.json index 9882328..61bc55f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2283,11 +2283,255 @@ "integrity": "sha1-Qa1XsbVVlR7BcUEqgZQrHoIA00o=", "dev": true }, + "cordova-android": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-6.2.3.tgz", + "integrity": "sha1-JJ8hts5fHxyEenq4OxaQnb7Vqig=", + "requires": { + "cordova-common": "2.0.2", + "elementtree": "0.1.6", + "nopt": "3.0.6", + "properties-parser": "0.2.3", + "q": "1.5.0", + "shelljs": "0.5.3" + }, + "dependencies": { + "abbrev": { + "version": "1.1.0", + "bundled": true + }, + "ansi": { + "version": "0.3.1", + "bundled": true + }, + "balanced-match": { + "version": "0.4.2", + "bundled": true + }, + "base64-js": { + "version": "0.0.8", + "bundled": true + }, + "big-integer": { + "version": "1.6.22", + "bundled": true + }, + "bplist-parser": { + "version": "0.1.1", + "bundled": true, + "requires": { + "big-integer": "1.6.22" + } + }, + "brace-expansion": { + "version": "1.1.7", + "bundled": true, + "requires": { + "balanced-match": "0.4.2", + "concat-map": "0.0.1" + } + }, + "concat-map": { + "version": "0.0.1", + "bundled": true + }, + "cordova-common": { + "version": "2.0.2", + "bundled": true, + "requires": { + "ansi": "0.3.1", + "bplist-parser": "0.1.1", + "cordova-registry-mapper": "1.1.15", + "elementtree": "0.1.6", + "glob": "5.0.15", + "minimatch": "3.0.3", + "osenv": "0.1.4", + "plist": "1.2.0", + "q": "1.5.0", + "semver": "5.3.0", + "shelljs": "0.5.3", + "underscore": "1.8.3", + "unorm": "1.4.1" + } + }, + "cordova-registry-mapper": { + "version": "1.1.15", + "bundled": true + }, + "elementtree": { + "version": "0.1.6", + "bundled": true, + "requires": { + "sax": "0.3.5" + } + }, + "glob": { + "version": "5.0.15", + "bundled": true, + "requires": { + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.3", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true + }, + "lodash": { + "version": "3.10.1", + "bundled": true + }, + "minimatch": { + "version": "3.0.3", + "bundled": true, + "requires": { + "brace-expansion": "1.1.7" + } + }, + "nopt": { + "version": "3.0.6", + "bundled": true, + "requires": { + "abbrev": "1.1.0" + } + }, + "once": { + "version": "1.4.0", + "bundled": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true + }, + "osenv": { + "version": "0.1.4", + "bundled": true, + "requires": { + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true + }, + "plist": { + "version": "1.2.0", + "bundled": true, + "requires": { + "base64-js": "0.0.8", + "util-deprecate": "1.0.2", + "xmlbuilder": "4.0.0", + "xmldom": "0.1.27" + } + }, + "properties-parser": { + "version": "0.2.3", + "bundled": true + }, + "q": { + "version": "1.5.0", + "bundled": true + }, + "sax": { + "version": "0.3.5", + "bundled": true + }, + "semver": { + "version": "5.3.0", + "bundled": true + }, + "shelljs": { + "version": "0.5.3", + "bundled": true + }, + "underscore": { + "version": "1.8.3", + "bundled": true + }, + "unorm": { + "version": "1.4.1", + "bundled": true + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true + }, + "wrappy": { + "version": "1.0.2", + "bundled": true + }, + "xmlbuilder": { + "version": "4.0.0", + "bundled": true, + "requires": { + "lodash": "3.10.1" + } + }, + "xmldom": { + "version": "0.1.27", + "bundled": true + } + } + }, + "cordova-plugin-camera": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/cordova-plugin-camera/-/cordova-plugin-camera-2.4.1.tgz", + "integrity": "sha1-GV404S22TxxJ52T31OPyYao9lME=" + }, + "cordova-plugin-compat": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/cordova-plugin-compat/-/cordova-plugin-compat-1.1.0.tgz", + "integrity": "sha1-kr3xaf62EgUyPcyWo/+DSON+h/w=" + }, + "cordova-plugin-console": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/cordova-plugin-console/-/cordova-plugin-console-1.0.7.tgz", + "integrity": "sha1-ibepLtHDNYiN/ADZAtxBcgHPOws=" + }, + "cordova-plugin-device": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/cordova-plugin-device/-/cordova-plugin-device-1.1.6.tgz", + "integrity": "sha1-LSF2TK18m4AVI+TgmjDgJLJJM0s=" + }, "cordova-plugin-filechooser": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cordova-plugin-filechooser/-/cordova-plugin-filechooser-1.0.1.tgz", "integrity": "sha1-+lnpe4zdkSYL4L7EYNuOxd6TSI8=" }, + "cordova-plugin-splashscreen": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/cordova-plugin-splashscreen/-/cordova-plugin-splashscreen-4.0.3.tgz", + "integrity": "sha1-dzzRNjwfO6y5kBZj6eN5PdPgoZ0=" + }, + "cordova-plugin-statusbar": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/cordova-plugin-statusbar/-/cordova-plugin-statusbar-2.2.3.tgz", + "integrity": "sha1-UcXgKtQzvr0LDcl3pEbrkd/uFQI=" + }, + "cordova-plugin-whitelist": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.2.tgz", + "integrity": "sha1-W2M1/rn1MB88ATuQlsuIhb29UHY=" + }, "core-js": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz", @@ -4246,6 +4490,11 @@ "resolved": "https://registry.npmjs.org/ionic-angular/-/ionic-angular-3.5.0.tgz", "integrity": "sha1-NbwT6k8z0wjAwhQna1GuLsQAe60=" }, + "ionic-plugin-keyboard": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ionic-plugin-keyboard/-/ionic-plugin-keyboard-2.2.1.tgz", + "integrity": "sha1-8qnhabvptVIkADR8n9bTRn7j+hI=" + }, "ionicons": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ionicons/-/ionicons-3.0.0.tgz", diff --git a/package.json b/package.json index fc11456..e74fa06 100644 --- a/package.json +++ b/package.json @@ -1,49 +1,69 @@ { - "name": "prisma-frontend", - "version": "0.0.1", - "author": "Project Prisma", - "homepage": "http://2017.summerofcode.be/", - "private": true, - "scripts": { - "clean": "ionic-app-scripts clean", - "build": "ionic-app-scripts build", - "lint": "ionic-app-scripts lint", - "ionic:build": "ionic-app-scripts build", - "ionic:serve": "ionic-app-scripts serve" - }, - "dependencies": { - "@angular/common": "4.1.3", - "@angular/compiler": "4.1.3", - "@angular/compiler-cli": "4.1.3", - "@angular/core": "4.1.3", - "@angular/forms": "4.1.3", - "@angular/http": "4.1.3", - "@angular/platform-browser": "4.1.3", - "@angular/platform-browser-dynamic": "4.1.3", - "@ionic-native/camera": "^3.7.0", - "@ionic-native/core": "3.12.1", - "@ionic-native/file-chooser": "^4.0.0", - "@ionic-native/splash-screen": "3.12.1", - "@ionic-native/status-bar": "3.12.1", - "@ionic/storage": "^2.0.1", - "cordova-plugin-filechooser": "^1.0.1", - "ionic-angular": "3.5.0", - "ionicons": "3.0.0", - "rxjs": "5.4.0", - "sw-toolbox": "3.6.0", - "zone.js": "0.8.12" - }, - "devDependencies": { - "@angular/cli": "^1.2.1", - "@ionic/app-scripts": "1.3.12", - "@ionic/cli-plugin-cordova": "1.4.1", - "@ionic/cli-plugin-ionic-angular": "1.3.2", - "typescript": "2.3.4" - }, - "description": "An Ionic project", - "cordova": { - "plugins": { - "cordova-plugin-filechooser": {} + "name": "prisma-frontend", + "version": "0.0.1", + "author": "Project Prisma", + "homepage": "http://2017.summerofcode.be/", + "private": true, + "scripts": { + "clean": "ionic-app-scripts clean", + "build": "ionic-app-scripts build", + "lint": "ionic-app-scripts lint", + "ionic:build": "ionic-app-scripts build", + "ionic:serve": "ionic-app-scripts serve", + "install": "ionic cordova plugin add cordova-plugin-camera" + }, + "dependencies": { + "@angular/common": "4.1.3", + "@angular/compiler": "4.1.3", + "@angular/compiler-cli": "4.1.3", + "@angular/core": "4.1.3", + "@angular/forms": "4.1.3", + "@angular/http": "4.1.3", + "@angular/platform-browser": "4.1.3", + "@angular/platform-browser-dynamic": "4.1.3", + "@ionic-native/camera": "^3.7.0", + "@ionic-native/core": "3.12.1", + "@ionic-native/file-chooser": "^4.0.0", + "@ionic-native/splash-screen": "3.12.1", + "@ionic-native/status-bar": "3.12.1", + "@ionic/storage": "^2.0.1", + "cordova-android": "^6.2.3", + "cordova-plugin-camera": "^2.4.1", + "cordova-plugin-compat": "^1.1.0", + "cordova-plugin-console": "^1.0.7", + "cordova-plugin-device": "^1.1.6", + "cordova-plugin-filechooser": "^1.0.1", + "cordova-plugin-splashscreen": "^4.0.3", + "cordova-plugin-statusbar": "^2.2.3", + "cordova-plugin-whitelist": "^1.3.2", + "ionic-angular": "3.5.0", + "ionic-plugin-keyboard": "^2.2.1", + "ionicons": "3.0.0", + "rxjs": "5.4.0", + "sw-toolbox": "3.6.0", + "zone.js": "0.8.12" + }, + "devDependencies": { + "@angular/cli": "^1.2.1", + "@ionic/app-scripts": "1.3.12", + "@ionic/cli-plugin-cordova": "1.4.1", + "@ionic/cli-plugin-ionic-angular": "1.3.2", + "typescript": "2.3.4" + }, + "description": "An Ionic project", + "cordova": { + "plugins": { + "cordova-plugin-filechooser": {}, + "cordova-plugin-console": {}, + "cordova-plugin-device": {}, + "cordova-plugin-splashscreen": {}, + "cordova-plugin-statusbar": {}, + "cordova-plugin-whitelist": {}, + "ionic-plugin-keyboard": {}, + "cordova-plugin-camera": {} + }, + "platforms": [ + "android" + ] } - } -} +} \ No newline at end of file diff --git a/src/app/app.module.ts b/src/app/app.module.ts index d216dc6..6a2d641 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -14,7 +14,7 @@ import {SplashScreen} from "@ionic-native/splash-screen"; import {StanizerService} from "../services/stanizer.service"; import {StoryDetailsPage} from "../pages/storydetails/storydetails"; import {PrismaService} from "../services/back-end/prisma-api.service"; -import {UserService} from "../services/back-end/user.service"; +import {PatientService} from "../services/back-end/user.service"; import {HttpModule} from "@angular/http"; import {StoryService} from "../services/back-end/story.service"; import {TutorialPage} from "../pages/tutorial/tutorial"; @@ -22,7 +22,12 @@ import { Camera } from '@ionic-native/camera'; import {NewStoryPage} from "../pages/new-story/new-story"; import {FileChooser} from "@ionic-native/file-chooser"; import {UtilService} from "../services/util-service"; + +import { QuestionsPage } from "../pages/questions/questions"; +import { QuestionPage } from "../pages/question/question"; import {NewStorySelectionPage} from "../pages/new-story-selection/new-story-selection"; +import {EmptyPage} from "../pages/empty/empty"; +import {ApiTestingPage} from "../pages/api-testing/api-testing"; @NgModule({ @@ -33,8 +38,12 @@ import {NewStorySelectionPage} from "../pages/new-story-selection/new-story-sele BrowsePage, PatientProfilePage, StoryDetailsPage, + QuestionsPage, + QuestionPage, NewStoryPage, + EmptyPage, NewStorySelectionPage, + ApiTestingPage, TabsPage ], imports: [ @@ -52,7 +61,11 @@ import {NewStorySelectionPage} from "../pages/new-story-selection/new-story-sele PatientProfilePage, StoryDetailsPage, NewStoryPage, + QuestionsPage, + QuestionPage, + EmptyPage, NewStorySelectionPage, + ApiTestingPage, TabsPage ], providers: [ @@ -62,7 +75,7 @@ import {NewStorySelectionPage} from "../pages/new-story-selection/new-story-sele StanizerService, PrismaService, StoryService, - UserService, + PatientService, Camera, FileChooser, {provide: ErrorHandler, useClass: IonicErrorHandler} diff --git a/src/app/app.scss b/src/app/app.scss index f5d92a1..5eaf8c5 100644 --- a/src/app/app.scss +++ b/src/app/app.scss @@ -22,5 +22,5 @@ } h1, h2, h3, .toolbar-title, ion-list-header .label, .tab-button-text { - font-family: 'Noto Sans',Varela; + font-family: Varela,'Noto Sans'; } diff --git a/src/app/environment.ts b/src/app/environment.ts index e71ad1a..e8cf946 100644 --- a/src/app/environment.ts +++ b/src/app/environment.ts @@ -2,8 +2,8 @@ * Created by Jean on 10-07-17. */ -export const BACKEND: string = 'http://localhost:8080'; -export const API_URL: string = BACKEND + ''; +export const BACKEND: string = 'http://146.185.145.169'; +export const API_URL: string = BACKEND + '/api/v1'; export const env = { @@ -12,7 +12,10 @@ export const env = { localstorage: { }, api: { - getUsers: 'users' + getPatient: 'patient', + getAlbum: 'album', + getStory: 'story', + getAsset: 'asset' }, temp: { albums:"albums" diff --git a/src/assets/img/tutorial/empty-1.jpg b/src/assets/img/tutorial/empty-1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4fa2d367c83d5c4ff247b64d6ee0a41442eae3f9 GIT bin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$u-HborM@3JLR3l`Gx$w!<^l216#SUv#+)NU4c9CV#1RKhPxZs*3q)sb zCreYW3Ar$Wb@K|9rLXoW70_6OPIBKQH`gqo0z6(;o+SZ&L#ae)$#oJi(#y5FRtVQz zyy|km&w>ohw7aTtpJy1>iKZ(3X4o*IUq5*A{6-yuvq#J`KE)5 z-X!3v(}2p?rE5eI0G2w}lg(Z#-v_qzZV@U4uTm&e3Lp?C$!@7_$(n2+_Sk;bB#N0WNr2ak%$*aohZ6^xuaU8pQ2r5mwK@+HR{gNXkEWdT0 z;r}e_lOL4XmxI%+h5Mh$gF&pYZ?j9OTY|fa$N&D06aF07U_JyI>&l=~Y1+8i4C+wP z{l<%I$&gK$Z5fADg7Es+9@t`$uwRydYqmRnrG9w*mqk)HSpow8(pjlGY5g}>_w%|R t?#puRmouPxceGnD8wVbasGCv$?Qy%my_bIIxOG!Qz6BI;mokt({1?dTr#S!s literal 0 HcmV?d00001 diff --git a/src/assets/img/tutorial/empty-2.jpg b/src/assets/img/tutorial/empty-2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..60692b412a051c8502be60c0d6e88d0e8ceaf751 GIT binary patch literal 13984 zcmeHM2UJtby596Eih?52q)6|E5+sNS2nZ5-*FZuEgc4e$$Pon;Y=D4*AOw&aKWPND#if+c$JgJy^WKn|8kz_QVU_#F?h0KmSs zX*PfgtOH{J7-#_7H29Btr?h+RGO)|QE(5y^>@u*+z<(nHXcWSk%MRg)z#;&E;ttuD z-2@Z3Ye>06{-azH5&or2CNBp75fMMjKX(??_jcIZ-C6uMYG@bpE(5y^>@u*+z%Bzn z8IY2Yl!Z#jLM7$6BxIlvS*VmO@JDq3fCf+i0&oVn06Wk-f`$ccC*MKGVejGL3KbW3 zb{9h+U93@JHZB-(9KuyxQcOY|IH81dMc6o^Jh-e;b`H*p{2$A!__-XAiu}e9Z3%5x z6_mZh86PZ4-$%#5#>de{9?7o++e3Q-2gPArF(?lN7Y^g(><+~#a({U`6fEyli*v(H zV3D>^z0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O3M+XMsS7T(^v?CzPr);)J7jW2HsUx{+{eGfN)km)U5jI(w+GqYlaFCTAu%r;QrOR zKO^uo3Q>qd38932rMjp zGDPPGfWx5_WJDN$9Je!Feq>$u4}c@tN5ZU literal 0 HcmV?d00001 diff --git a/src/assets/json/albums.json b/src/assets/json/albums.json index cdfdf75..36283dd 100644 --- a/src/assets/json/albums.json +++ b/src/assets/json/albums.json @@ -97,7 +97,7 @@ ] }, { - "id": "2", + "id": "3", "title": "Plaatsen", "description": "Waar ik zoal geweest ben.", "stories": [ @@ -132,7 +132,7 @@ ] }, { - "id": "2", + "id": "4", "title": "Kunst", "description": "", "stories": [ diff --git a/src/dto/abstract-user.ts b/src/dto/abstract-user.ts index 89e06a7..65bbb0b 100644 --- a/src/dto/abstract-user.ts +++ b/src/dto/abstract-user.ts @@ -5,23 +5,24 @@ export abstract class AbstractUser { firstName: string; lastName: string; dateOfBirth: Date; - birthLocation: string; + birthPlace: string; // profile picture - profilePicture: string; + location: string; constructor(json?) { - if (json) { - this.firstName = json.firstName; - this.lastName = json.lastName; - this.dateOfBirth = new Date(json.dateOfBirth); - this.birthLocation = json.birthLocation; - this.profilePicture = json.profilePicture; - } + if (!json) + return; + this.id = json.id; + this.firstName = json.firstName; + this.lastName = json.lastName; + this.dateOfBirth = new Date(json.dateOfBirth); + this.birthPlace = json.birthPlace; + this.location = json.location; } getThumbnail(): string { - return this.profilePicture; // TODO: derive thumbnail link + return this.location; // TODO: derive thumbnail link } /** Gets the age of the user */ diff --git a/src/pages/api-testing/api-testing.html b/src/pages/api-testing/api-testing.html new file mode 100644 index 0000000..8d897d3 --- /dev/null +++ b/src/pages/api-testing/api-testing.html @@ -0,0 +1,56 @@ + + + Test me out ! + + + + + + + + + + + firstName + + + + lastName + + + + + carehome + + + + dateOfBirth + + + + birthPlace + + + + location + + + + +
+    {{patientAdded | json}}
+  
+
+    {{patientAddedAlbums | json}}
+  
+
+ +
+
+ +
+ + + + +
diff --git a/src/pages/api-testing/api-testing.scss b/src/pages/api-testing/api-testing.scss new file mode 100644 index 0000000..36b9ec7 --- /dev/null +++ b/src/pages/api-testing/api-testing.scss @@ -0,0 +1,3 @@ +page-api-testing { + +} diff --git a/src/pages/api-testing/api-testing.ts b/src/pages/api-testing/api-testing.ts new file mode 100644 index 0000000..599a145 --- /dev/null +++ b/src/pages/api-testing/api-testing.ts @@ -0,0 +1,47 @@ +import {Component} from '@angular/core'; +import {IonicPage, NavController, NavParams} from 'ionic-angular'; +import {TutorialPage} from "../tutorial/tutorial"; +import {PatientService} from "../../services/back-end/user.service"; +import {Patient} from "../../dto/patient"; +import {StoryService} from "../../services/back-end/story.service"; +import {Album} from "../../dto/album"; + +@Component({ + selector: 'page-api-testing', + templateUrl: 'api-testing.html', +}) +export class ApiTestingPage { + + public patientToAdd: Patient = new Patient(); + public patientAdded: Patient = new Patient(); + public patientAddedAlbums: Album[] = []; + + constructor(public navCtrl: NavController, public navParams: NavParams, public patientService: PatientService, public storySerivce: StoryService) { + + } + + ionViewDidLoad() { + this.patientService.getPatient("3").toPromise().then(res => { + this.patientAdded = res; + }) + this.storySerivce.getAlbums(this.patientAdded.id).toPromise().then(res => this.patientAddedAlbums = res); + } + + backToTuto() { + this.navCtrl.push(TutorialPage); + } + + addUser() { + this.patientService.addPatient(this.patientToAdd).toPromise().then(res => { + this.patientService.getPatient(res.id).toPromise().then(res2 => { + this.patientAdded = res2 + }) + }) + } + + generateAlbums() { + this.storySerivce.generateBasicAlbums(this.patientAdded.id).toPromise().then(res => { + this.patientAddedAlbums = res; + }) + } +} diff --git a/src/pages/browse/browse.ts b/src/pages/browse/browse.ts index 2b87654..9d1b683 100644 --- a/src/pages/browse/browse.ts +++ b/src/pages/browse/browse.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'; import {ActionSheetController, NavController} from 'ionic-angular'; import { StanizerService } from '../../services/stanizer.service'; import { StoriesPage } from "../stories/stories"; -import { UserService } from "../../services/back-end/user.service"; +import { PatientService } from "../../services/back-end/user.service"; import { StoryService } from "../../services/back-end/story.service"; import { Album } from "../../dto/album"; import {FileChooser} from "@ionic-native/file-chooser"; @@ -19,7 +19,7 @@ export class BrowsePage extends StoriesPage implements OnInit { constructor(public actionsheetCtrl: ActionSheetController, protected camera: Camera, protected fileChooser: FileChooser, public navCtrl: NavController, protected stanizerService: StanizerService, - protected userService: UserService, protected storyService: StoryService) { + protected userService: PatientService, protected storyService: StoryService) { super(actionsheetCtrl, camera, fileChooser, navCtrl, stanizerService, userService, storyService); } diff --git a/src/pages/empty/empty.html b/src/pages/empty/empty.html new file mode 100644 index 0000000..74d22b6 --- /dev/null +++ b/src/pages/empty/empty.html @@ -0,0 +1,20 @@ + +
+
+ +

+ Verzamel hier verhalen over Marie-Josée. De app is maar zo goed als de info die jij er in stopt. +

+ + Familie en vrienden + + + + + + Gemeente Roeselare + + + +
+
diff --git a/src/pages/empty/empty.scss b/src/pages/empty/empty.scss new file mode 100644 index 0000000..033b63d --- /dev/null +++ b/src/pages/empty/empty.scss @@ -0,0 +1,14 @@ +page-empty { + .desc { + color: #ABAEB4; + font-family: Varela; + font-size: 20px; + line-height: 29px; + } + .ion-title { + color: #545B6D; + font-family: Varela; + font-size: 20px; + line-height: 29px; + } +} diff --git a/src/pages/empty/empty.ts b/src/pages/empty/empty.ts new file mode 100644 index 0000000..2ad46ec --- /dev/null +++ b/src/pages/empty/empty.ts @@ -0,0 +1,29 @@ +import { Component } from '@angular/core'; +import {NavController, NavParams } from 'ionic-angular'; +import {UtilService} from "../../services/util-service"; +import {NewStoryPage} from "../new-story/new-story"; +import {BrowsePage} from "../browse/browse"; + +@Component({ + selector: 'page-empty', + templateUrl: 'empty.html', +}) +export class EmptyPage { + + constructor(public navCtrl: NavController, public navParams: NavParams,public utilService:UtilService) { + } + + ionViewDidLoad() { + console.log('ionViewDidLoad EmptyPage'); + } + takeAPicture(){ + let pictureAttempt: Promise = this.utilService.takeAPicture(); + + pictureAttempt.then( + (dataUrl) => { + this.navCtrl.push(NewStoryPage, + {"dataUrl": dataUrl}) + }); + } + +} diff --git a/src/pages/new-story-selection/new-story-selection.html b/src/pages/new-story-selection/new-story-selection.html index e93c2d7..25020c3 100644 --- a/src/pages/new-story-selection/new-story-selection.html +++ b/src/pages/new-story-selection/new-story-selection.html @@ -6,25 +6,42 @@ - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/src/pages/new-story-selection/new-story-selection.ts b/src/pages/new-story-selection/new-story-selection.ts index 9d72d47..aeb80e0 100644 --- a/src/pages/new-story-selection/new-story-selection.ts +++ b/src/pages/new-story-selection/new-story-selection.ts @@ -1,6 +1,7 @@ -import { Component } from '@angular/core'; -import { NavController, NavParams } from 'ionic-angular'; +import {Component} from "@angular/core"; +import {ActionSheetController, NavController, NavParams} from "ionic-angular"; import {NewStoryPage} from "../new-story/new-story"; +import {UtilService} from "../../services/util-service"; @Component({ @@ -9,13 +10,64 @@ import {NewStoryPage} from "../new-story/new-story"; }) export class NewStorySelectionPage { - constructor(public navCtrl: NavController, public navParams: NavParams) { + constructor(public actionsheetCtrl: ActionSheetController, public navCtrl: NavController, public navParams: NavParams, public utilService: UtilService) { } - addText(){ + addText() { this.navCtrl.push(NewStoryPage); } + cameraActionSheet() { + let actionSheet = this.actionsheetCtrl.create({ + title: 'Foto toevoegen', + cssClass: 'action-sheets-basic-page', + buttons: [ + { + text: 'Maak foto', + role: 'destructive', + icon: 'camera', + cssClass: 'general', + handler: () => { + let pictureAttempt: Promise = this.utilService.takeAPicture(); + + pictureAttempt.then( + (dataUrl) => { + this.navCtrl.push(NewStoryPage, + {"dataUrl": dataUrl}) + }); + + //this.utilService.showErrorMessage("DataURl : " + infos.dataUrl + "\n" + infos.error); + + } + }, + { + text: 'Kies foto van camerarol', + role: 'destructive', + icon: 'image', + handler: () => { + let fileChooseAttempt: Promise = this.utilService.chooseAFile(); + + fileChooseAttempt.then( + (dataUrl) => { + this.navCtrl.push(NewStoryPage, + {"dataUrl": dataUrl}) + }); + } + }, + { + text: 'Cancel', + role: 'cancel', + icon: 'md-arrow-back', + handler: () => { + console.log('canceled'); + } + }, + ] + + }) + ; + actionSheet.present(); + } } diff --git a/src/pages/new-story/new-story.html b/src/pages/new-story/new-story.html index 617fb3b..5045098 100644 --- a/src/pages/new-story/new-story.html +++ b/src/pages/new-story/new-story.html @@ -5,38 +5,64 @@ - + +
 {{ dataUrl | json}}
+ - -
+ + + + - - - Weet je wanneer het was? + + + Weet je wanneer het was? - + + Jaar + + + + + Maand + + + + + Dag + + + - + + + + + + - + - Album - - + Bij welke album hoort het verhaal? + + + + {{album.title}} - - - + + + + + +
diff --git a/src/pages/new-story/new-story.scss b/src/pages/new-story/new-story.scss index cda5c13..3bfb7f4 100644 --- a/src/pages/new-story/new-story.scss +++ b/src/pages/new-story/new-story.scss @@ -1,24 +1,16 @@ page-newstory { - ion-card { - position: relative; - text-align: center; + .question { + height: 29px; + width: 248px; + color: #ABAEB4; + font-family: Varela; + font-size: 20px; + line-height: 29px; } - .card-title { - position: absolute; - top: 36%; - font-size: 2.0em; - width: 100%; - font-weight: bold; - color: #fff; - } - - .card-subtitle { - font-size: 1.0em; - position: absolute; - top: 52%; - width: 100%; - color: #fff; + .select-md .select-icon,.select-ios.select-icon{ + border: 1px black solid; } } + diff --git a/src/pages/new-story/new-story.ts b/src/pages/new-story/new-story.ts index 13bfce4..7357d46 100644 --- a/src/pages/new-story/new-story.ts +++ b/src/pages/new-story/new-story.ts @@ -6,6 +6,7 @@ import {StoryService} from "../../services/back-end/story.service"; import {UserStory} from "../../dto/user-story"; import {StoryType} from "../../dto/enum/story-type"; import {StoriesPage} from "../stories/stories"; +import {UtilService} from "../../services/util-service"; @Component({ selector: 'page-new-story', @@ -15,7 +16,7 @@ export class NewStoryPage { //Step 1 - dataUrl: string = "assets/img/t/anne.jpg"; + dataUrl: string ; description: string; placeHolder: string = "Schrijf het verhaal.\nHoe meer details hoe beter."; //Step 2 @@ -23,21 +24,37 @@ export class NewStoryPage { selectedAlbum: Album; title: string; step: number = 0; + year:number; + month:number; + day:number; - constructor(public navCtrl: NavController, private camera: Camera, public navParams: NavParams, private storyService: StoryService) { - this.dataUrl = navParams.get("dateUrl") as string; - this.storyService.getAlbums().toPromise().then(albums => { + constructor(public navCtrl: NavController, private camera: Camera, public navParams: NavParams, private storyService: StoryService,private utilService:UtilService) { + this.dataUrl = navParams.get("dataUrl") as string || "familie/family1.jpg"; + this.storyService.getAlbums(3).toPromise().then(albums => { this.albums = albums as Album[]; + // if there are three or more albums, select the last one, otherwise create a new one (?) + this.selectedAlbum = this.albums[2] || new Album(); }); + // check if source is a question answer + if (navParams.get("questionAnswer")) { + this.description = navParams.get("description"); + this.goToStep2(); // skip to step 2 because we already have the description + } + } commit() { let newStory: UserStory = new UserStory(); newStory.albumId = this.selectedAlbum.id; newStory.dateAdded = new Date(); + if(this.year) { + newStory.date = new Date(); + newStory.date.setFullYear(this.year,this.month || 1 ,this.day || 1); + } newStory.description = this.description; - newStory.source = this.dataUrl.indexOf("assets/img/t/anne.jpg") > -1 ? "anne.jpg" : this.dataUrl; + if(this.dataUrl) + newStory.source = this.dataUrl.indexOf("assets/img/t/anne.jpg") > -1 ? "anne.jpg" : this.dataUrl; newStory.type = StoryType.IMAGE; newStory.title = this.title; this.storyService.addStory(this.selectedAlbum, newStory).toPromise().then(res => { @@ -45,10 +62,19 @@ export class NewStoryPage { }); } + goBack(){ + this.step--; + } + goToStep2(){ if(this.step === 0){ - this.step = 1; } } + + goToStep3(){ + if(this.step === 1){ + this.step = 2; + } + } } diff --git a/src/pages/question/question.html b/src/pages/question/question.html new file mode 100644 index 0000000..dab871d --- /dev/null +++ b/src/pages/question/question.html @@ -0,0 +1,17 @@ + + + +
+

{{currentQuestion}}

+ +
+ + +
diff --git a/src/pages/question/question.scss b/src/pages/question/question.scss new file mode 100644 index 0000000..fb43422 --- /dev/null +++ b/src/pages/question/question.scss @@ -0,0 +1,31 @@ +page-question { + + .question-header { + position: relative; + width: 100%; + padding: 1.5em; + background-color: map-get($colors, 'general'); + + h2 { + display: inline-block; + width: 90%; + color: #fff; + font-size: map-get($sizes, 'large'); + font-weight: 400; + } + + ion-icon { + position: absolute; + bottom: 1em; + right: 1em; + font-size: 2em; + color: map-get($colors, 'light'); + } + } + + ion-textarea { + font-size: 1.3em; + padding: 0 1em; + height: 5em; + } +} diff --git a/src/pages/question/question.ts b/src/pages/question/question.ts new file mode 100644 index 0000000..674a693 --- /dev/null +++ b/src/pages/question/question.ts @@ -0,0 +1,42 @@ +import { Component, OnInit, Input } from "@angular/core"; +import { NavController, NavParams } from "ionic-angular"; +import { NewStoryPage } from "../new-story/new-story"; + +@Component({ + selector: 'page-question', + templateUrl: 'question.html' +}) + +export class QuestionPage implements OnInit { + + // TODO: create a type for questions/question categories + + category : any; + + currentQuestion: any; + + + @Input() description : string; + + constructor(public navCtrl: NavController, public navParams: NavParams) { + this.category = navParams.get("category"); + } + + ngOnInit(): void { + this.nextQuestion(); + } + + nextQuestion() { + // TODO: implement a random question that avoids repetition + this.currentQuestion = this.category.questions[Math.floor(Math.random()*this.category.questions.length)]; + } + + save() { + this.navCtrl.push(NewStoryPage, { + "questionAnswer": true, + "description": this.description, + "dateUrl": "" // todo: fix "date" ==> "data" & somehow clearly include content type + }); + } + +} diff --git a/src/pages/questions/questions.html b/src/pages/questions/questions.html new file mode 100644 index 0000000..d1a447b --- /dev/null +++ b/src/pages/questions/questions.html @@ -0,0 +1,16 @@ + + + + Vragen + + + + + +

Kies een categorie

+ + + {{category.title}} + + +
diff --git a/src/pages/questions/questions.json.ts b/src/pages/questions/questions.json.ts new file mode 100644 index 0000000..4c1709e --- /dev/null +++ b/src/pages/questions/questions.json.ts @@ -0,0 +1,84 @@ +export const QUESTIONS = [ + { + "id":1, + "title":"Voorouders", + "questions": [ + "Wie was het oudste familielid dat je gekend hebt?", + "Van welk land komen je groutouders?", + "Kende je je overgrootouders?" + ] + }, + { + "id":2, + "title":"Kindertijd en jeugd", + "questions": [ + "In wat voor huis woonden jullie?", + "Welke namen heb je gekregen? Ben je vernoemd naar iemand?", + "Hadden jullie huisdieren?", + "Hadden jullie als gezin een speciale gewoonte of traditie?", + "Wat at je het liefst?", + "Welke kleding droeg je toen?" + ] + }, + { + "id":3, + "title":"School en werk", + "questions": [ + "Welk beroep heb je het langst uitgeoefend?", + "Waar ging je voor het eerst werken?", + "Welke vakantiejobs heb je vroeger gedaan?", + "In welke basisschool zat je? Waarom daar?", + "Herinner je je nog een leerkracht van vroeger?", + "Van welk land komen je groutouders?" + ] + }, + { + "id":4, + "title":"De liefde", + "questions": [ + "Kan je je eerste verliedheid nog herinneren?", + "Hoe ging dat toen, een liefje hebben?", + "Wat kan je je nog herinneren van je trouwdag?" + ] + }, + { + "id":5, + "title":"Gezin", + "questions": [ + "Wanneer kreeg je je eerste kind?", + "Welke namen hebben je kinderen? Heb je nog een foto van vroeger?", + "Nam je soms tijd voor jezelf? Wat deed je dan?" + ] + }, + { + "id":6, + "title":"Vrije tijd en hobby's", + "questions": [ + "Wat doe je het liefst in je vrije tijd?", + "Ging je graag uit? Met wie en waar dan?", + "Keek je televisie? Wat waren je lievelingsprogramma's?", + "Beoefende je een sport?", + "Wat is je favoriete muziek? Ging je soms naar concerten?" + ] + }, + { + "id":7, + "title":"Vriendschap", + "questions": [ + "Had je een beste vriend(in)?", + "Wat deed je samen met je vrienden?" + ] + }, + { + "id":8, + "title":"Vakanties en reizen", + "questions": [ + "Herinner je je allereerste vakantie?", + "Wat is het verste land waar je al geweest bent?", + "Wanneer ging je voor het eerst alleen op vakantie? Waar was dat?", + "Op welke manier reisde je vooral?", + "Wat is de mooiste stad die je al hebt bezocht?" + + ] + } +] diff --git a/src/pages/questions/questions.scss b/src/pages/questions/questions.scss new file mode 100644 index 0000000..ff03bcd --- /dev/null +++ b/src/pages/questions/questions.scss @@ -0,0 +1,6 @@ +page-questions { + h2#categories-title { + margin-top: 1em; + padding-left: 15px; + } +} diff --git a/src/pages/questions/questions.ts b/src/pages/questions/questions.ts new file mode 100644 index 0000000..d6dc28e --- /dev/null +++ b/src/pages/questions/questions.ts @@ -0,0 +1,28 @@ +import { Component, OnInit } from "@angular/core"; +import { QUESTIONS } from "./questions.json"; +import { QuestionPage } from "../question/question"; +import { NavController } from "ionic-angular"; + +@Component({ + selector: 'page-questions', + templateUrl: 'questions.html' +}) + +export class QuestionsPage implements OnInit { + + categories : any[]; + + constructor(private navCtrl: NavController) { } + + ngOnInit(): void { + var _id = 1; + this.categories = QUESTIONS; + } + + showQuestion(category: any) { + this.navCtrl.push(QuestionPage, { + "category": category + }); + } + +} diff --git a/src/pages/stories/stories.html b/src/pages/stories/stories.html index b0f92a1..ffac03f 100644 --- a/src/pages/stories/stories.html +++ b/src/pages/stories/stories.html @@ -21,18 +21,26 @@

{{album.title.trim()}}

--> - + + >
+ [ngStyle]="{'background-image': 'url(' + getThumb(item.source) + ')'}" *ngIf="getThumb(item.source)">
+
+ {{item.description}} +
+
+ + < + diff --git a/src/pages/stories/stories.scss b/src/pages/stories/stories.scss index 2b85164..b8b338e 100644 --- a/src/pages/stories/stories.scss +++ b/src/pages/stories/stories.scss @@ -5,7 +5,7 @@ page-stories { } .item-md h2 { - color: map-get($colors, 'secondary'); + color: map-get($colors, 'dark'); font-size: map-get($sizes, 'medium'); } @@ -20,7 +20,7 @@ page-stories { font-size: .9em; width: 100%; color: #fff; - text-shadow: 1px 1px 3px rgba(0,0,0,.6), 1px 1px 0 rgba(0,0,0,.6); + text-shadow: 1px 1px 3px rgba(0, 0, 0, .6), 1px 1px 0 rgba(0, 0, 0, .6); } .list-header { @@ -39,13 +39,13 @@ page-stories { .story-item { // padding: 0.3em; - margin:1em 0 1em 1em; + margin: 1em 0 1em 1em; } .story-item div { background-size: cover; height: 100%; - box-shadow: 0 10px 20px 0 rgba(84,91,109,0.4); + box-shadow: 0 10px 20px 0 rgba(84, 91, 109, 0.4); } .story-item .slide-zoom { @@ -62,23 +62,37 @@ page-stories { } .story-item img::after { - position: relative; - background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0, #fff 100%); - margin-top: -150px; - height: 150px; - height: 100%; - content: ''; - } + position: relative; + background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0, #fff 100%); + margin-top: -150px; + height: 150px; + height: 100%; + content: ''; + } ion-item.item.item-block { padding-left: 0; - .item-inner { padding-right: 0; margin-right: 0; } - .input-wrapper { } + .item-inner { + padding-right: 0; + margin-right: 0; + } + .input-wrapper { + } + } + ion-list-header .label { + padding-left: 1.25em; } - ion-list-header .label { padding-left: 1.25em; } ion-list.list { margin-bottom: 0; } - + .description { + height: 13.59%; + width: 83.61%; + color: #ABAEB4; + font-family: Varela; + font-size: map-get($sizes, medium); + line-height: 29px; + text-align: center; + } } diff --git a/src/pages/stories/stories.ts b/src/pages/stories/stories.ts index 07a0b7e..66a3d8a 100644 --- a/src/pages/stories/stories.ts +++ b/src/pages/stories/stories.ts @@ -2,7 +2,7 @@ import {Component, OnInit} from "@angular/core"; import {ActionSheetController, NavController} from "ionic-angular"; import {StanizerService} from "../../services/stanizer.service"; import {StoryDetailsPage} from "../storydetails/storydetails"; -import {UserService} from "../../services/back-end/user.service"; +import {PatientService} from "../../services/back-end/user.service"; import {StoryService} from "../../services/back-end/story.service"; import {NewStoryPage} from "../new-story/new-story"; import {User} from "../../dto/user"; @@ -10,6 +10,7 @@ import {UserStory} from "../../dto/user-story"; import {Album} from "../../dto/album"; import {Camera} from "@ionic-native/camera"; import {FileChooser} from "@ionic-native/file-chooser"; +import {EmptyPage} from "../empty/empty"; /* TEMPORARY IMPORT */ @@ -32,13 +33,13 @@ export class StoriesPage implements OnInit { constructor(public actionsheetCtrl: ActionSheetController, protected camera: Camera, protected fileChooser: FileChooser, public navCtrl: NavController, protected stanizerService: StanizerService, - protected userService: UserService, protected storyService: StoryService) { - this.stanizedYoutubeUrl = this.stanizerService.sanitize(this.youtubeUrl); + protected userService: PatientService, protected storyService: StoryService) { + this.stanizedYoutubeUrl = this.stanizerService.sanitize(this.youtubeUrl); } ngOnInit(): void { /* TESTS: to remove - this.userService.getUser("12345").toPromise().then(user => { + this.patientService.getPatient("12345").toPromise().then(user => { this.user = user; }); @@ -47,17 +48,27 @@ export class StoriesPage implements OnInit { console.log(JSON.stringify(stories))); */ } - ionViewWillEnter():void{ - this.storyService.getAlbums().toPromise().then(albums => { + + ionViewWillEnter(): void { + this.storyService.getAlbums(3).toPromise().then(albums => { this.albums = albums as Album[]; + let empty: number = 0; + this.albums.forEach(album => { + if (album.stories.length > 0) empty++ + }); + if (empty === 0) { + this.navCtrl.push(EmptyPage); + } }); - this.storyService.getUserStories().toPromise().then(stories => console.log(".")); } - getThumb(url: string): string { - if(url.startsWith("data:image/jpeg;base64")) + getThumb(url: string, descripton?: string): string { + if (!url) + //return 'data:image/svg+xml;utf8,'+ descripton + ''; + return null; + if (url.startsWith("data:image/jpeg;base64") || url.startsWith("assets")) return url; return "assets/img/t/" + url; } @@ -91,7 +102,7 @@ export class StoriesPage implements OnInit { targetHeight: 1000 }).then((imageData) => { // imageData is a base64 encoded string - let base64Image:string = "data:image/jpeg;base64," + imageData; + let base64Image: string = "data:image/jpeg;base64," + imageData; this.navCtrl.push(NewStoryPage, { "dateUrl": base64Image, "album": album diff --git a/src/pages/storydetails/storydetails.html b/src/pages/storydetails/storydetails.html index f36bbd7..5913048 100644 --- a/src/pages/storydetails/storydetails.html +++ b/src/pages/storydetails/storydetails.html @@ -9,30 +9,28 @@ - - - + -

{{album.stories[index].description}}

+ {{album.stories[index].description}}
-
-
-
diff --git a/src/pages/storydetails/storydetails.scss b/src/pages/storydetails/storydetails.scss index a7c1dd5..7dbeae0 100644 --- a/src/pages/storydetails/storydetails.scss +++ b/src/pages/storydetails/storydetails.scss @@ -2,4 +2,9 @@ page-storydetails { .description { background-color: color($colors, general); } + + .ion-card-content{ + width: 100%; + height: 100%; + } } diff --git a/src/pages/tabs/tabs.html b/src/pages/tabs/tabs.html index ca7da38..1fbc945 100644 --- a/src/pages/tabs/tabs.html +++ b/src/pages/tabs/tabs.html @@ -1,7 +1,6 @@ - - + + -n diff --git a/src/pages/tabs/tabs.ts b/src/pages/tabs/tabs.ts index 35bbefb..edd00c0 100644 --- a/src/pages/tabs/tabs.ts +++ b/src/pages/tabs/tabs.ts @@ -4,6 +4,7 @@ import {ActionSheetController, NavController} from "ionic-angular"; import {StoriesPage} from "../stories/stories"; import {BrowsePage} from "../browse/browse"; import {PatientProfilePage} from "../patientprofile/patientprofile"; +import { QuestionsPage } from "../questions/questions"; import { Camera } from '@ionic-native/camera'; import {NewStoryPage} from "../new-story/new-story"; @@ -17,57 +18,11 @@ import {NewStorySelectionPage} from "../new-story-selection/new-story-selection" export class TabsPage { tab1Root = StoriesPage; - tab2Root = BrowsePage; - tab3Root = NewStorySelectionPage; + tab2Root = NewStorySelectionPage; + tab3Root = QuestionsPage; tab4Root = PatientProfilePage; constructor(public actionsheetCtrl: ActionSheetController,private utilService:UtilService,public navCtrl: NavController) { } - openMenu() { - let actionSheet = this.actionsheetCtrl.create({ - title: 'Verhaal toevoegen', - cssClass: 'action-sheets-basic-page', - buttons: [ - { - text: 'Foto nemen', - role: 'destructive ', - icon: 'camera', - handler: () => { - let base64Image:string = this.utilService.takeAPicture(); - this.navCtrl.push(NewStoryPage,{ - "dateUrl": base64Image - }) - } - }, - { - text: 'Foto uit album kiezen', - role: 'destructive ', - icon: 'image', - handler: () => { - console.log('addPhoto with album clicked'); - } - }, - { - text: 'Youtube video kiezen', - role: 'destructive ', - icon: 'logo-youtube', - handler: () => { - console.log('choose youtube video clicked'); - } - }, - { - text: 'Cancel', - role: 'cancel ', - icon: 'md-arrow-back', - handler: () => { - console.log('canceled'); - } - }, - ] - - }) - ; - actionSheet.present(); - } } diff --git a/src/pages/tutorial/tutorial.html b/src/pages/tutorial/tutorial.html index 4b52c2a..f08a721 100644 --- a/src/pages/tutorial/tutorial.html +++ b/src/pages/tutorial/tutorial.html @@ -1,18 +1,26 @@ - - - - - {{slide.title}} - -

- {{slide.text}} -

-
- -
-
- + + + + + {{slide.title}} + +

+ {{slide.text}} +

+
+ +
+
+ + + + +
diff --git a/src/pages/tutorial/tutorial.ts b/src/pages/tutorial/tutorial.ts index e451ba0..92a3bf5 100644 --- a/src/pages/tutorial/tutorial.ts +++ b/src/pages/tutorial/tutorial.ts @@ -1,19 +1,21 @@ -import {Component, OnInit, ViewChild} from "@angular/core"; +import {Component, ViewChild} from "@angular/core"; import {NavController, NavParams, Slides} from "ionic-angular"; import {TabsPage} from "../tabs/tabs"; import {StoriesPage} from "../stories/stories"; +import {ApiTestingPage} from "../api-testing/api-testing"; @Component({ selector: 'page-tutorial', templateUrl: 'tutorial.html', }) -export class TutorialPage{ +export class TutorialPage { @ViewChild(Slides) slider: Slides; homeRoot = StoriesPage; + currentSlide: number = 0; slides: Array = [ { id: "slide1", @@ -37,8 +39,24 @@ export class TutorialPage{ constructor(public navCtrl: NavController, public navParams: NavParams) { } + goToTheApp() { - this.navCtrl.push(TabsPage); + localStorage.clear(); + this.navCtrl.push(TabsPage); + } + + + goToSlide(index: number) { + this.slider.slideTo(index); + this.currentSlide = index; } + getCurrentSlide(): number { + return this.slider.getActiveIndex(); + ; + } + + testApi(){ + this.navCtrl.push(ApiTestingPage); + } } diff --git a/src/services/back-end/prisma-api.service.ts b/src/services/back-end/prisma-api.service.ts index 1793ad7..20ca385 100644 --- a/src/services/back-end/prisma-api.service.ts +++ b/src/services/back-end/prisma-api.service.ts @@ -1,5 +1,5 @@ import {Injectable, OnInit} from "@angular/core"; -import {Http } from "@angular/http"; +import {Headers, Http} from "@angular/http"; import {Observable} from "rxjs/Observable"; import 'rxjs/add/observable/of'; import {API_URL, env} from "../../app/environment"; diff --git a/src/services/back-end/story.service.ts b/src/services/back-end/story.service.ts index bdb51c1..ca93b1f 100644 --- a/src/services/back-end/story.service.ts +++ b/src/services/back-end/story.service.ts @@ -7,6 +7,7 @@ import {Injectable} from "@angular/core"; import {UserStory} from "../../dto/user-story"; import {Album} from "../../dto/album"; import {env} from "../../app/environment"; +import {Patient} from "../../dto/patient"; @Injectable() export class StoryService extends PrismaService { @@ -28,32 +29,54 @@ export class StoryService extends PrismaService { .catch(error => this.handleError(error)); } - getAlbums(): Observable { - return this._http.get("assets/json/albums.json").map(res => { - /*let albums: Album[] = []; - res.json().forEach(album => albums.push(new Album(album))); - return albums;*/ + getAlbums(patientId: string | number): Observable { + + let url: string = env.api.getPatient; + let albumUrl: string = env.api.getAlbum; + return this._http.get(`${this._urlToApi}/${url}/${patientId}/${albumUrl}`, { + headers: this._head + }) + .map(res => { + let albums: Album[] = []; + res.json().response.forEach(album => albums.push(new Album(album))); + return albums; + }) + .catch(err => this.handleError(err)); + + /**return this._http.get("assets/json/albums.json").map(res => { let albums: Album[]; let hasAlbums: boolean = false; albums = JSON.parse(localStorage.getItem(env.temp.albums)) as Album[]; - if(albums) + if (albums) hasAlbums = true; if (!hasAlbums) { albums = res.json() ? res.json() as Album[] : []; - localStorage.setItem(env.temp.albums, JSON.stringify(res.json() as Album[])); + let temp: Album[] = [] + albums.forEach(album => { + album.stories = []; + temp.push(album); + }); + localStorage.setItem(env.temp.albums, JSON.stringify(albums)); } - return albums; - }) - .catch(error => this.handleError(error)); + return albums;**/ } - addStory(selectedAlbum: Album, newStory: UserStory): Observable { + + /**addStory(selectedAlbum: Album, newStory: UserStory): Observable { let currentAlbums: Album[] = JSON.parse(localStorage.getItem(env.temp.albums)) as Album[] || []; + + console.log("Before \n" + JSON.stringify(JSON.parse(localStorage.getItem(env.temp.albums)) as Album[])); let isANewAlbum: boolean = true; currentAlbums.forEach(album => { if (album.id === selectedAlbum.id) { isANewAlbum = false; - newStory.id = album.stories[album.stories.length - 1].id + 1; + if (album.stories.length === 0) { + album.stories = []; + newStory.id = "1"; + } + else { + newStory.id = album.stories[album.stories.length - 1].id + 1; + } album.stories.push(newStory); } }); @@ -61,13 +84,47 @@ export class StoryService extends PrismaService { newStory.id = "1"; selectedAlbum = new Album(); selectedAlbum.title = "Random"; - selectedAlbum.id ="RandomId"; + selectedAlbum.id = "RandomId"; selectedAlbum.stories.push(newStory); currentAlbums.push(selectedAlbum); } localStorage.setItem(env.temp.albums, JSON.stringify(currentAlbums as Album[])); + console.log("After \n" + JSON.stringify(JSON.parse(localStorage.getItem(env.temp.albums)) as Album[])); return Observable.of(true); + }*/ + addStory(selectedAlbum: Album, newStory: UserStory): Observable { + let url: string = env.api.getPatient; + return this._http.post(`${this._urlToApi}/${url}`, newStory) + .map(res => { + // If request fails, throw an Error that will be caught + if (res.status < 200 || res.status >= 300) { + return null; + } + return new Patient(res.json().response) as Patient; + }).catch(err => this.handleError(err)); + } + + generateBasicAlbums(patientId: string): Observable { + let url: string = env.api.getPatient; + let albumUrl: string = env.api.getAlbum; + return this._http.get("assets/json/albums.json").map(res => { + let albums: Album[] = res.json(); + let returnedAlbums: Album[] = []; + if (!albums) + return; + albums.forEach(album => { + this._http.post(`${this._urlToApi}/${url}/${patientId}/${albumUrl}`, album) + .map(res => { + // If request fails, throw an Error that will be caught + if (res.status < 200 || res.status >= 300) { + return null; + } + return new Album(res.json().response) as Album; + }).toPromise().then(res2 => returnedAlbums.push(res2)).catch(err => this.handleError(err)); + }); + return returnedAlbums; + }).catch(err => this.handleError(err)); } /** Get historical themes (just albums for now) */ diff --git a/src/services/back-end/user.service.ts b/src/services/back-end/user.service.ts index cfa5671..eb7de1f 100644 --- a/src/services/back-end/user.service.ts +++ b/src/services/back-end/user.service.ts @@ -1,20 +1,43 @@ -import { PrismaService } from "./prisma-api.service"; -import { Observable } from "rxjs/Observable"; -import { User } from "../../dto/user"; +import {PrismaService} from "./prisma-api.service"; +import {Observable} from "rxjs/Observable"; +import {User} from "../../dto/user"; import 'rxjs/add/operator/catch'; import 'rxjs/add/operator/map'; import 'rxjs/Rx'; import {Subscription} from 'rxjs/Subscription'; -import { Injectable } from "@angular/core"; +import {Injectable} from "@angular/core"; +import {Patient} from "../../dto/patient"; +import {env} from "../../app/environment"; @Injectable() -export class UserService extends PrismaService { +export class PatientService extends PrismaService { - getUser(id: string): Observable { - return this._http.get("assets/json/users_id.json").map(res => { - return new User(res.json()); + getPatient(id: string): Observable { + /* return this._http.get("assets/json/users_id.json").map(res => { + return new User(res.json()); + }) + .catch(error => this.handleError(error));*/ + let url: string = env.api.getPatient; + return this._http.get(`${this._urlToApi}/${url}/${id}`, { + headers: this._head + }) + .map(res => { + return new Patient(res.json().response) as Patient; }) - .catch(error => this.handleError(error)); + .catch(err => this.handleError(err)); + } + + + addPatient(patient: Patient): Observable { + let url: string = env.api.getPatient; + return this._http.post(`${this._urlToApi}/${url}`, patient) + .map(res => { + // If request fails, throw an Error that will be caught + if (res.status < 200 || res.status >= 300) { + return null; + } + return new Patient(res.json().response) as Patient; + }).catch(err => this.handleError(err)); } } diff --git a/src/services/util-service.ts b/src/services/util-service.ts index 22e856b..46a3bba 100644 --- a/src/services/util-service.ts +++ b/src/services/util-service.ts @@ -1,37 +1,60 @@ import {Injectable} from "@angular/core"; -import {Camera} from "@ionic-native/camera"; +import {Camera, CameraOptions} from "@ionic-native/camera"; import {FileChooser} from "@ionic-native/file-chooser"; +import {AlertController} from "ionic-angular"; @Injectable() export class UtilService{ - constructor(private camera: Camera,private fileChooser: FileChooser){ + constructor(public alertCtrl: AlertController,private camera: Camera,private fileChooser: FileChooser){ } - takeAPicture(): string{ - let dataUrl:string =""; - this.camera.getPicture({ - destinationType: this.camera - .DestinationType.DATA_URL, - targetWidth: 1000, - targetHeight: 1000 - }).then((imageData) => { + pictureOptions : CameraOptions = { + destinationType: this.camera.DestinationType.DATA_URL, + encodingType: this.camera.EncodingType.JPEG, + targetWidth: 1000, + targetHeight: 1000, + correctOrientation: true + }; + + takeAPicture(): Promise { + return this.camera.getPicture(this.pictureOptions).then((imageData) => { // imageData is a base64 encoded string - dataUrl = "data:image/jpeg;base64," + imageData; + return "data:image/jpeg;base64," + imageData; }, (err) => { - console.log("Error for taking a pic :" + err); + this.showErrorMessage("Error for taking a pic :" + err); + return err; }); - return dataUrl; } - chooseAFile():string{ - let dataUrl:string = ""; - this.fileChooser.open() - .then(uri => dataUrl = uri) - .catch(e => console.log("Error for chosing a file : " + e)); - return dataUrl; + chooseFileOption : CameraOptions = { + quality: 100, + destinationType: this.camera.DestinationType.DATA_URL, + encodingType: this.camera.EncodingType.JPEG, + sourceType: this.camera.PictureSourceType.PHOTOLIBRARY, + mediaType: this.camera.MediaType.PICTURE + } + + chooseAFile(): Promise { + return this.camera.getPicture(this.chooseFileOption).then((imageData) => { + // imageData is a base64 encoded string + return "data:image/jpeg;base64," + imageData; + }, (err) => { + this.showErrorMessage("Error for taking a pic :" + err); + return err; + }); + } + + showErrorMessage(errorMessage:string):Promise{ + let alert = this.alertCtrl.create({ + title:"Error", + subTitle: errorMessage, + buttons: ['Ok'] + }); + console.log(errorMessage); + return alert.present(); } } diff --git a/src/theme/variables.scss b/src/theme/variables.scss index 472b259..eeef19c 100644 --- a/src/theme/variables.scss +++ b/src/theme/variables.scss @@ -34,7 +34,8 @@ $colors: ( primary: #ff4444, secondary: #33b5e5, danger: #ffbb33, - light: #ebf1f2, + light: #ABAEB4, + transparent: rgba(216,216,216,0), dark: #1f5760, general: #647FC6 ); @@ -82,22 +83,22 @@ $sizes: ( @import "noto-sans"; //Custom schemas -$tabs-md-tab-font-size: 15px; +$tabs-md-tab-font-size: map_get($sizes,medium); $tabs-ios-tab-font-size: $tabs-md-tab-font-size; -$tabs-md-tab-icon-size: 30px; +$tabs-md-tab-icon-size: map_get($sizes,icons); $tabs-ios-tab-icon-size: $tabs-md-tab-icon-size; $tabs-ios-tab-text-color: color($colors, light); $tabs-md-tab-text-color: $tabs-ios-tab-text-color; $tabs-md-tab-icon-color: color($colors, light); -$tabs-md-tab-icon-color-active: color($colors, secondary); +$tabs-md-tab-icon-color-active: color($colors, general); // Use the primary color as the background for the toolbar-md-background -$toolbar-md-background: color($colors, general); +$toolbar-md-background: color($colors, transparent); // Use the default background for the tabbar since it inherits from toolbar -$tabs-md-background: color($colors, general); +$tabs-md-background: color($colors, transparent); // Change the color of the tabs text $tab-button-md-active-color: $tabs-md-tab-icon-color-active;