Sfoglia il codice sorgente

added select buttons on teacher reg page, reg user operational

rjsmall90 6 anni fa
parent
commit
c720cef37a

+ 2
- 0
src/app/app.component.ts Vedi File

@@ -6,6 +6,7 @@ import { SplashScreen } from '@ionic-native/splash-screen';
6 6
 import { HomePage } from '../pages/home/home';
7 7
 import { ListPage } from '../pages/list/list';
8 8
 import { NewProfilePage } from '../pages/registerUser/registerUser';
9
+import {TeacherRegistrationPage } from '../pages/registerTeacher/registerTeacher'
9 10
 
10 11
 
11 12
 @Component({
@@ -26,6 +27,7 @@ export class MyApp {
26 27
       { title: 'Home', component: HomePage },
27 28
       { title: 'List', component: ListPage },
28 29
       { title: 'Register User', component: NewProfilePage },
30
+      { title: 'Register Teacher', component: TeacherRegistrationPage }, 
29 31
     ];
30 32
 
31 33
   }

+ 11
- 4
src/app/app.module.ts Vedi File

@@ -1,11 +1,14 @@
1 1
 import { BrowserModule } from '@angular/platform-browser';
2 2
 import { ErrorHandler, NgModule } from '@angular/core';
3 3
 import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
4
+import { HttpClientModule } from '@angular/common/http';
4 5
 
5 6
 import { MyApp } from './app.component';
6 7
 import { HomePage } from '../pages/home/home';
7 8
 import { ListPage } from '../pages/list/list';
8 9
 import { NewProfilePage } from '../pages/registerUser/registerUser';
10
+import {TeacherRegistrationPage } from '../pages/registerTeacher/registerTeacher'
11
+
9 12
 
10 13
 import { StatusBar } from '@ionic-native/status-bar';
11 14
 import { SplashScreen } from '@ionic-native/splash-screen';
@@ -16,24 +19,28 @@ import { ConnectionProvider } from '../providers/connection/connection';
16 19
     MyApp,
17 20
     HomePage,
18 21
     ListPage,
19
-    NewProfilePage
22
+    NewProfilePage,
23
+    TeacherRegistrationPage
20 24
   ],
21 25
   imports: [
22 26
     BrowserModule,
23 27
     IonicModule.forRoot(MyApp),
28
+    HttpClientModule
24 29
   ],
25 30
   bootstrap: [IonicApp],
26 31
   entryComponents: [
27 32
     MyApp,
28 33
     HomePage,
29 34
     ListPage, 
30
-    NewProfilePage
35
+    NewProfilePage,
36
+    TeacherRegistrationPage
31 37
   ],
32 38
   providers: [
33 39
     StatusBar,
34 40
     SplashScreen,
35
-    {provide: ErrorHandler, useClass: IonicErrorHandler},
36
-    ConnectionProvider
41
+    ConnectionProvider,
42
+    {provide: ErrorHandler, useClass: IonicErrorHandler}
43
+    
37 44
   ]
38 45
 })
39 46
 export class AppModule {}

+ 8
- 0
src/app/component/user.ts Vedi File

@@ -0,0 +1,8 @@
1
+export class User {
2
+
3
+    firstName: string;
4
+    lastName: string;
5
+    displayName: string; 
6
+    email: string;
7
+    password: string; 
8
+}

+ 4
- 0
src/pages/home/home.ts Vedi File

@@ -1,6 +1,9 @@
1 1
 import { Component } from '@angular/core';
2 2
 import { NavController } from 'ionic-angular';
3 3
 
4
+//import { ConnectionProvider } from '../../providers/connection/connection;
5
+//import { User } from './../../app/users/user';
6
+
4 7
 @Component({
5 8
   selector: 'page-home',
6 9
   templateUrl: 'home.html'
@@ -11,4 +14,5 @@ export class HomePage {
11 14
 
12 15
   }
13 16
 
17
+
14 18
 }

+ 71
- 0
src/pages/registerTeacher/registerTeacher.html Vedi File

@@ -0,0 +1,71 @@
1
+<ion-header>
2
+  <ion-navbar>
3
+    <button ion-button menuToggle>
4
+      <ion-icon name="menu"></ion-icon>
5
+    </button>
6
+    <ion-title>
7
+      Teacher Registration
8
+    </ion-title>
9
+  </ion-navbar>
10
+</ion-header>
11
+<ion-content padding id="page13" style="background:url(assets/imgs/final_spitball.jpg) no-repeat center;background-size:cover;">
12
+  <form id="teacherRegistration-form10">
13
+    <ion-list id="teacherRegistration-list25">
14
+      <ion-item id="teacherRegistration-input8">
15
+        <ion-label>
16
+          First Name
17
+        </ion-label>
18
+        <ion-input type="text" placeholder=""></ion-input>
19
+      </ion-item>
20
+      <ion-item id="teacherRegistration-input11">
21
+        <ion-label>
22
+          Last Name
23
+        </ion-label>
24
+        <ion-input type="text" placeholder=""></ion-input>
25
+      </ion-item>
26
+      <ion-item id="teacherRegistration-input9">
27
+        <ion-label>
28
+          Email
29
+        </ion-label>
30
+        <ion-input type="email" placeholder=""></ion-input>
31
+      </ion-item>
32
+       <ion-item id="teacherRegistration-item-select1">
33
+        <ion-label>
34
+          State
35
+        </ion-label>
36
+        <ion-select> 
37
+             <ion-option>DE</ion-option>
38
+          <ion-option>PA</ion-option>
39
+          <ion-option>MD</ion-option>
40
+        </ion-select>
41
+        </ion-item>
42
+      <ion-item id="teacherRegistration-item-select2">
43
+      <ion-label>
44
+          School/School District
45
+      </ion-label>
46
+        <ion-select> 
47
+            <ion-option>Red Clay</ion-option>
48
+            <ion-option>Colonial</ion-option>
49
+            <ion-option>Christiana</ion-option>
50
+        </ion-select>
51
+        <!-- <ion-input type="text" placeholder=""></ion-input> -->
52
+      </ion-item>
53
+    </ion-list>
54
+    <div class="spacer" style="height:100px;" id="teacherRegistration-spacer9"></div>
55
+    <ion-item id="teacherRegistration-input10">
56
+      <ion-label>
57
+        Password
58
+      </ion-label>
59
+      <ion-input type="text" placeholder=""></ion-input>
60
+    </ion-item>
61
+    <ion-item id="teacherRegistration-input14">
62
+      <ion-label>
63
+        Verify Password
64
+      </ion-label>
65
+      <ion-input type="text" placeholder=""></ion-input>
66
+    </ion-item>
67
+    <button id="teacherRegistration-button17" ion-button color="stable" block on-click="goToTeacherProfile()">
68
+      Sign up
69
+    </button>
70
+  </form>
71
+</ion-content>

+ 1
- 0
src/pages/registerTeacher/registerTeacher.scss Vedi File

@@ -0,0 +1 @@
1
+page-registerTeacher{}

+ 17
- 0
src/pages/registerTeacher/registerTeacher.ts Vedi File

@@ -0,0 +1,17 @@
1
+import { Component } from '@angular/core';
2
+import { NavController } from 'ionic-angular';
3
+//import { TeacherProfilePage } from '../teacher-profile/teacher-profile';
4
+
5
+@Component({
6
+  selector: 'page-registerTeacher',
7
+  templateUrl: 'registerTeacher.html'
8
+})
9
+export class TeacherRegistrationPage {
10
+
11
+  constructor(public navCtrl: NavController) {
12
+  }
13
+//   goToTeacherProfile(params){
14
+//     if (!params) params = {};
15
+//     this.navCtrl.push(TeacherProfilePage);
16
+//   }
17
+}

+ 9
- 9
src/pages/registerUser/registerUser.html Vedi File

@@ -9,26 +9,26 @@
9 9
   </ion-navbar>
10 10
 </ion-header>
11 11
 
12
-<ion-content padding style="background:url(assets/img/tMs0PFvR0QQs5HRllDbw_final_spitball.jpg) no-repeat center;background-size:cover;" id="page11">
12
+<ion-content padding style="background:url(assets/imgs/final_spitball.jpg) no-repeat center;background-size:cover;" id="page11">
13 13
   <form id="newProfile-form4">
14 14
     <ion-list id="newProfile-list17">
15 15
       <ion-item id="newProfile-input3">
16 16
         <ion-label>
17 17
           First Name
18 18
         </ion-label>
19
-        <ion-input type="text" placeholder=""></ion-input>
19
+        <ion-input type="text" placeholder="" [(ngModel)]="user.firstName" name="firstName"></ion-input>
20 20
       </ion-item>
21 21
       <ion-item id="newProfile-input4">
22 22
         <ion-label>
23 23
           Last Name
24 24
         </ion-label>
25
-        <ion-input type="text" placeholder=""></ion-input>
25
+        <ion-input type="text" placeholder="" [(ngModel)]="user.lastName" name="lastName"></ion-input>
26 26
       </ion-item>
27 27
       <ion-item id="newProfile-input12">
28 28
         <ion-label>
29 29
           E-mail
30 30
         </ion-label>
31
-        <ion-input type="email" placeholder=""></ion-input>
31
+        <ion-input type="email" placeholder=""[(ngModel)]="user.email" name="email"></ion-input>
32 32
       </ion-item>
33 33
       <form id="newProfile-form6">
34 34
         <ion-item id="newProfile-toggle4">
@@ -43,11 +43,11 @@
43 43
           </ion-label>
44 44
           <ion-toggle color="positive" checked="false"></ion-toggle>
45 45
         </ion-item>
46
-        <ion-item id="newProfile-radio2">
46
+        <ion-item id="newProfile-input6">
47 47
           <ion-label>
48 48
             Display Name (optional)
49 49
           </ion-label>
50
-          <ion-radio></ion-radio>
50
+          <ion-input type="text" placeholder="" [(ngModel)]="user.displayName" name="displayName"></ion-input>
51 51
         </ion-item>
52 52
         <div class="spacer" style="width:299.531px;height:12.9688px;" id="newProfile-spacer5"></div>
53 53
         <div id="newProfile-markdown17" class="show-list-numbers-and-dots">
@@ -60,17 +60,17 @@
60 60
         <ion-label>
61 61
           Password
62 62
         </ion-label>
63
-        <ion-input type="text" placeholder=""></ion-input>
63
+        <ion-input type="text" placeholder="" [(ngModel)]="user.password" name="password"></ion-input>
64 64
       </ion-item>
65 65
     </ion-list>
66 66
     <ion-item id="newProfile-input13">
67 67
       <ion-label>
68 68
         Verify Password
69 69
       </ion-label>
70
-      <ion-input type="text" placeholder=""></ion-input>
70
+      <ion-input type="text" placeholder="" [(ngModel)]="user.password" name="password">></ion-input>
71 71
     </ion-item>
72 72
     <div class="spacer" style="width:299.514px;height:55.9757px;" id="newProfile-spacer4"></div>
73
-    <button id="newProfile-button9" ion-button color="balanced" full on-click="goToUserProfile()">
73
+    <button id="newProfile-button9" ion-button color="balanced" full on-click="register()">
74 74
       Get Started!
75 75
     </button>
76 76
   </form>

+ 13
- 3
src/pages/registerUser/registerUser.ts Vedi File

@@ -1,7 +1,7 @@
1 1
 import { Component } from '@angular/core';
2 2
 import { NavController } from 'ionic-angular';
3
-//import { Home } from '../home/home';
4
-//import { UpdateProfilePage } from '../update-profile/update-profile';
3
+import { User } from './../../app/component/user';
4
+import { ConnectionProvider } from './../../providers/connection/connection';
5 5
 
6 6
 @Component({
7 7
   selector: 'page-registerUser',
@@ -9,8 +9,18 @@ import { NavController } from 'ionic-angular';
9 9
 })
10 10
 export class NewProfilePage {
11 11
 
12
-  constructor(public navCtrl: NavController) {
12
+user: User = new User();
13
+
14
+  constructor(public navCtrl: NavController, public conn: ConnectionProvider) {
15
+  }
16
+
17
+  register(){
18
+    this.conn.post('user_profile/register_user', this.user).subscribe(
19
+      data => console.log(data)
20
+    );
13 21
   }
22
+
23
+
14 24
   // goToUserProfile(params){
15 25
   //   if (!params) params = {};
16 26
   //   this.navCtrl.push(Home);

+ 8
- 0
src/providers/connection/connection.ts Vedi File

@@ -9,9 +9,17 @@ import { Injectable } from '@angular/core';
9 9
 */
10 10
 @Injectable()
11 11
 export class ConnectionProvider {
12
+public apiUrl = 'http://localhost:8080/';
13
+public user = this.apiUrl + '/user_profile';
12 14
 
13 15
   constructor(public http: HttpClient) {
14 16
     console.log('Hello ConnectionProvider Provider');
15 17
   }
16 18
 
19
+post(partialPath: string, data: any) {
20
+  return this.http.post(this.apiUrl + partialPath, data);
21
+}
22
+
23
+
24
+
17 25
 }