diff --git a/src/app/app.routes.ts b/src/app/app-router.module.ts similarity index 51% rename from src/app/app.routes.ts rename to src/app/app-router.module.ts index 1896cb5..3627b30 100644 --- a/src/app/app.routes.ts +++ b/src/app/app-router.module.ts @@ -1,28 +1,31 @@ -import { ModuleWithProviders } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; +import { NgModule } from "@angular/core"; +import { RouterModule } from "@angular/router"; -import { AuthGuard } from "./guards/auth.guard"; -import { LoginGuard } from "./guards/login.guard"; -import { LoginComponent } from "./login/login.component"; -import { ProfileComponent } from "./profile/profile.component"; -import { StudentsComponent } from './students/students.component'; -import { StudentFormComponent } from './students/student-form/student-form.component'; -import { StudentPanelComponent } from './students/student-panel/student-panel.component'; -import { DailyLogComponent } from './students/daily-log/daily-log.component'; -import { DailyLogFormComponent } from './students/daily-log-form/daily-log-form.component'; -import { ReportComponent } from './students/report/report.component'; -import { ReportFormComponent } from './students/report-form/report-form.component'; -import { ReferralComponent } from './students/referral/referral.component'; -import { ReferralFormComponent } from './students/referral-form/referral-form.component'; -import { ReferralPanelComponent } from './students/referral-panel/referral-panel.component'; -import { DailyLogPanelComponent } from './students/daily-log-panel/daily-log-panel.component'; +import { LoginComponent } from "./login/login.component"; +import { ProfileComponent } from "./profile/profile.component"; +import { AdminPageComponent } from './profile/admin-page/admin-page.component'; +import { StudentsComponent } from './students/students.component'; +import { StudentFormComponent } from './students/student-form/student-form.component'; +import { StudentPanelComponent } from './students/student-panel/student-panel.component'; +import { DailyLogComponent } from './students/daily-log/daily-log.component'; +import { DailyLogFormComponent } from './students/daily-log-form/daily-log-form.component'; +import { DailyLogPanelComponent } from './students/daily-log-panel/daily-log-panel.component'; +import { ReferralComponent } from './students/referral/referral.component'; +import { ReferralFormComponent } from './students/referral-form/referral-form.component'; +import { ReferralPanelComponent } from './students/referral-panel/referral-panel.component'; +import { ReportComponent } from './students/report/report.component'; +import { ReportFormComponent } from './students/report-form/report-form.component'; import { RecommendationPanelComponent } from './students/recommendation-panel/recommendation-panel.component'; -import { AdminPageComponent } from './profile/admin-page/admin-page.component'; +import { TutorialComponent } from './tutorial/tutorial.component'; -const APP_ROUTES: Routes = [ +import { AuthGuard } from "./shared/guards/auth.guard"; +import { LoginGuard } from "./shared/guards/login.guard"; + +const ROUTES = RouterModule.forRoot([ { path: '' , redirectTo: 'students' , pathMatch: 'full' }, { path: 'login' , component: LoginComponent , canActivate: [LoginGuard]}, { path: 'profile' , component: ProfileComponent , canActivate: [AuthGuard] }, + { path: 'admin' , component: AdminPageComponent , canActivate: [AuthGuard] }, { path: 'students' , component: StudentsComponent , pathMatch: 'full' , canActivate: [AuthGuard] }, { path: 'students/new' , component: StudentFormComponent , canActivate: [AuthGuard] }, { path: 'studentpanel/:id' , component: StudentPanelComponent , canActivate: [AuthGuard] }, @@ -35,7 +38,11 @@ const APP_ROUTES: Routes = [ { path: 'report/:id' , component: ReportFormComponent , canActivate: [AuthGuard] }, { path: 'reports' , component: ReportComponent , canActivate: [AuthGuard] }, { path: 'recommendation/:id', component: RecommendationPanelComponent, canActivate: [AuthGuard] }, - { path: 'admin' , component: AdminPageComponent, canActivate: [AuthGuard] } -]; + { path: 'tutorial' , component: TutorialComponent, canActivate: [AuthGuard] } +]) -export const routes: ModuleWithProviders = RouterModule.forRoot(APP_ROUTES); +@NgModule({ + imports: [ROUTES], + exports: [RouterModule] +}) +export class AppRouterModule {} diff --git a/src/app/app.component.html b/src/app/app.component.html index 6424773..c768a10 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,4 +1,4 @@ -
+
diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 4a8666b..236960f 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -7,10 +7,10 @@ import { MaterializeModule } from 'angular2-materialize'; import { Angular2TokenService } from 'angular2-token'; import { AppComponent } from './app.component'; -import { NavbarComponent } from './navbar/navbar.component'; -import { SidenavComponent } from './sidenav/sidenav.component'; +import { NavbarComponent } from './header/navbar/navbar.component'; +import { SidenavComponent } from './header/sidenav/sidenav.component'; import { RegisterFormComponent } from './register/register-form/register-form.component'; -import { AuthService } from './services/auth.service'; +import { AuthService } from './shared/services/auth.service'; describe('AppComponent', () => { let tokenMock = jasmine.createSpyObj('tokenMock', ['init', 'validateToken', 'subscribe']); diff --git a/src/app/app.component.ts b/src/app/app.component.ts index c42443b..ac6a03e 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -3,7 +3,7 @@ import { Component } from '@angular/core'; import { Angular2TokenService } from 'angular2-token'; import { environment } from '../environments/environment'; -import { AuthService } from './services/auth.service'; +import { AuthService } from './shared/services/auth.service'; @Component({ selector: 'app-root', diff --git a/src/app/app.module.ts b/src/app/app.module.ts index ac87976..932e324 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -3,24 +3,24 @@ import { HttpModule } from '@angular/http'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { MaterializeModule } from 'angular2-materialize'; +import { MaterializeModule } from 'angular2-materialize'; import { Angular2TokenService } from 'angular2-token'; import { OrderModule } from 'ngx-order-pipe'; import { AppComponent } from './app.component'; -import { routes } from './app.routes'; -import { AuthGuard } from "./guards/auth.guard"; -import { LoginGuard } from "./guards/login.guard"; -import { AuthService } from "./services/auth.service"; +import { AppRouterModule } from "./app-router.module"; +import { AuthGuard } from "./shared/guards/auth.guard"; +import { LoginGuard } from "./shared/guards/login.guard"; +import { AuthService } from "./shared/services/auth.service"; import { LoginComponent } from './login/login.component'; import { RegisterFormComponent } from './register/register-form/register-form.component'; import { ProfileComponent } from './profile/profile.component'; -import { StudentsService } from './services/students.service'; +import { StudentsService } from './shared/services/students.service'; import { StudentsComponent } from './students/students.component'; import { StudentFormComponent } from './students/student-form/student-form.component'; -import { FilterPipe } from './shared/filter.pipe'; -import { SidenavComponent } from './sidenav/sidenav.component'; -import { NavbarComponent } from './navbar/navbar.component'; +import { FilterPipe } from './shared/pipes/filter.pipe'; +import { SidenavComponent } from './header/sidenav/sidenav.component'; +import { NavbarComponent } from './header/navbar/navbar.component'; import { StudentPanelComponent } from './students/student-panel/student-panel.component'; import { DailyLogComponent } from './students/daily-log/daily-log.component'; import { DailyLogFormComponent } from './students/daily-log-form/daily-log-form.component'; @@ -32,6 +32,8 @@ import { ReferralPanelComponent } from './students/referral-panel/refe import { DailyLogPanelComponent } from './students/daily-log-panel/daily-log-panel.component'; import { RecommendationPanelComponent } from './students/recommendation-panel/recommendation-panel.component'; import { AdminPageComponent } from './profile/admin-page/admin-page.component'; +import { TutorialComponent } from './tutorial/tutorial.component'; +import { TutorialLoginComponent } from "./tutorial/tutorial-login/tutorial-login.component"; @NgModule({ declarations: [ @@ -54,8 +56,9 @@ import { AdminPageComponent } from './profile/admin-page/admin-pag ReferralPanelComponent, DailyLogPanelComponent, RecommendationPanelComponent, - AdminPageComponent - + AdminPageComponent, + TutorialComponent, + TutorialLoginComponent ], imports: [ HttpModule, @@ -64,7 +67,7 @@ import { AdminPageComponent } from './profile/admin-page/admin-pag OrderModule, ReactiveFormsModule, MaterializeModule, - routes + AppRouterModule ], providers: [ LoginGuard, diff --git a/src/app/navbar/navbar.component.css b/src/app/header/navbar/navbar.component.css similarity index 100% rename from src/app/navbar/navbar.component.css rename to src/app/header/navbar/navbar.component.css diff --git a/src/app/navbar/navbar.component.html b/src/app/header/navbar/navbar.component.html similarity index 72% rename from src/app/navbar/navbar.component.html rename to src/app/header/navbar/navbar.component.html index 2d6befa..6eba42e 100644 --- a/src/app/navbar/navbar.component.html +++ b/src/app/header/navbar/navbar.component.html @@ -1,4 +1,4 @@ - +
+ + help_outline + +
+ + diff --git a/src/app/login/login.component.spec.ts b/src/app/login/login.component.spec.ts index cd6e204..707e06d 100644 --- a/src/app/login/login.component.spec.ts +++ b/src/app/login/login.component.spec.ts @@ -3,10 +3,12 @@ import { HttpModule } from '@angular/http'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { RouterTestingModule } from '@angular/router/testing'; +import { MaterializeModule } from 'angular2-materialize'; import { Angular2TokenService } from 'angular2-token'; -import { AuthService } from "../services/auth.service"; +import { AuthService } from "../shared/services/auth.service"; import { LoginComponent } from './login.component'; +import { TutorialLoginComponent } from '../tutorial/tutorial-login/tutorial-login.component'; describe('LoginComponent', () => { let component: LoginComponent; @@ -17,10 +19,14 @@ describe('LoginComponent', () => { tokenMock.validateToken.and.returnValue(tokenMock); TestBed.configureTestingModule({ - declarations: [ LoginComponent ], + declarations: [ + LoginComponent, + TutorialLoginComponent + ], imports: [ HttpModule, FormsModule, + MaterializeModule, ReactiveFormsModule, RouterTestingModule ], diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts index 1b49115..f9aafe7 100644 --- a/src/app/login/login.component.ts +++ b/src/app/login/login.component.ts @@ -1,12 +1,13 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, ViewChild } from '@angular/core'; import { Router } from "@angular/router"; import { FormBuilder, FormControl, FormGroup, Validators } from "@angular/forms"; import { MaterializeAction } from "angular2-materialize"; import { RegisterData } from "angular2-token"; -import { AuthService } from "../services/auth.service"; +import { AuthService } from "../shared/services/auth.service"; import { FormUtils } from "../shared/form.utils"; +import { TutorialLoginComponent } from "../tutorial/tutorial-login/tutorial-login.component"; @Component({ selector: 'app-login', @@ -18,16 +19,14 @@ export class LoginComponent implements OnInit { formUtils: FormUtils; public submitted: boolean; public formErrors: Array; + @ViewChild('tutorialLogin') tutorialLogin: TutorialLoginComponent; constructor( private router: Router, private formBuilder: FormBuilder, - private authService: AuthService + private authService: AuthService, ) { this.setupForm(); - this.formUtils = new FormUtils(this.form); - this.submitted = false; - this.formErrors = null; } ngOnInit() {} @@ -48,10 +47,18 @@ export class LoginComponent implements OnInit { ); } + openTutorial(){ + this.tutorialLogin.openDialog(); + } + private setupForm(){ this.form = this.formBuilder.group({ email: [null, [Validators.required, Validators.email]], password: [null, [Validators.required, Validators.minLength(8)]] }); + + this.formUtils = new FormUtils(this.form); + this.submitted = false; + this.formErrors = null; } } diff --git a/src/app/profile/admin-page/admin-page.component.html b/src/app/profile/admin-page/admin-page.component.html index 6d3e659..5996d72 100644 --- a/src/app/profile/admin-page/admin-page.component.html +++ b/src/app/profile/admin-page/admin-page.component.html @@ -1,5 +1,5 @@ -
-
+
+

Painel de Membros

diff --git a/src/app/profile/admin-page/admin-page.component.spec.ts b/src/app/profile/admin-page/admin-page.component.spec.ts index 2cd79a7..473d44d 100644 --- a/src/app/profile/admin-page/admin-page.component.spec.ts +++ b/src/app/profile/admin-page/admin-page.component.spec.ts @@ -1,11 +1,10 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { Angular2TokenService } from 'angular2-token'; -import { HttpModule } from '@angular/http'; -import { RouterTestingModule } from '@angular/router/testing'; - +import { RouterTestingModule } from '@angular/router/testing'; +import { HttpModule } from '@angular/http'; +import { Angular2TokenService } from 'angular2-token'; -import { AuthService } from "../../services/auth.service"; +import { AuthService } from "../../shared/services/auth.service"; import { AdminPageComponent } from './admin-page.component'; describe('AdminPageComponent', () => { diff --git a/src/app/profile/admin-page/admin-page.component.ts b/src/app/profile/admin-page/admin-page.component.ts index 5f3aa2c..b394ed8 100644 --- a/src/app/profile/admin-page/admin-page.component.ts +++ b/src/app/profile/admin-page/admin-page.component.ts @@ -1,33 +1,31 @@ import { Component, OnInit } from '@angular/core'; import { Router } from "@angular/router"; -import { Angular2TokenService} from "angular2-token"; -import { AuthService } from "../../services/auth.service"; -import { TeamMember } from "../../shared/models"; +import { AuthService } from "../../shared/services/auth.service"; +import { TeamMember } from "../../shared/models/team-member.model"; @Component({ selector: 'app-admin-page', templateUrl: './admin-page.component.html', styleUrls: ['./admin-page.component.css'] }) export class AdminPageComponent implements OnInit { + private teamMember: TeamMember[] = []; -private teamMember: TeamMember[] = []; constructor( - public authTokenService: Angular2TokenService, - public authService: AuthService, - private router: Router + public authService: AuthService, + private router: Router ) { } ngOnInit() { this.authService.getTeamMembers() - .subscribe( - data => this.teamMember = data, - response => {} - ); + .subscribe( + data => this.teamMember = data, + response => {} + ); } -getTeamMembers() { - return this.teamMember; + getTeamMembers() { + return this.teamMember; } deleteTeamMember(teamMember) { diff --git a/src/app/profile/profile.component.html b/src/app/profile/profile.component.html index 8cb7169..251ae2e 100644 --- a/src/app/profile/profile.component.html +++ b/src/app/profile/profile.component.html @@ -1,4 +1,4 @@ -
+

@@ -11,115 +11,79 @@

Perfil

-
- - -
- -
- - -
+
+ + +
-
-
- +
+ + +
- Salvar alterações - send - +
+
+ + + + Salvar alterações + send + -
-
-
+
+
+
-
diff --git a/src/app/profile/profile.component.spec.ts b/src/app/profile/profile.component.spec.ts index e2de8cf..f69498a 100644 --- a/src/app/profile/profile.component.spec.ts +++ b/src/app/profile/profile.component.spec.ts @@ -7,7 +7,7 @@ import { Angular2TokenService } from 'angular2-token'; import { MaterializeModule } from 'angular2-materialize'; import { ProfileComponent } from './profile.component'; -import { AuthService } from "../services/auth.service"; +import { AuthService } from "../shared/services/auth.service"; describe('ProfileComponent', () => { let component: ProfileComponent; diff --git a/src/app/profile/profile.component.ts b/src/app/profile/profile.component.ts index cce8b5d..ed774b4 100644 --- a/src/app/profile/profile.component.ts +++ b/src/app/profile/profile.component.ts @@ -1,10 +1,10 @@ import { Component, OnInit, EventEmitter } from '@angular/core'; import { Router } from "@angular/router"; -import { Angular2TokenService, UpdatePasswordData } from "angular2-token"; +import { UpdatePasswordData } from "angular2-token"; import { MaterializeAction } from "angular2-materialize" -import { AuthService } from "../services/auth.service"; +import { AuthService } from "../shared/services/auth.service"; @Component({ selector: 'app-profile', @@ -12,12 +12,10 @@ import { AuthService } from "../services/auth.service"; styleUrls: ['./profile.component.css'] }) export class ProfileComponent implements OnInit { - updatePasswordData: UpdatePasswordData = {}; modalActions = new EventEmitter(); constructor( - public authTokenService: Angular2TokenService, public authService: AuthService, private router: Router ) {} @@ -35,9 +33,9 @@ export class ProfileComponent implements OnInit { updatePassword(){ this.authService.updatePassword(this.updatePasswordData).subscribe( res => { - this.updatePasswordData = {}; + this.updatePasswordData = {}; } ); } - + } diff --git a/src/app/register/register-form/register-form.component.spec.ts b/src/app/register/register-form/register-form.component.spec.ts index e141dad..1efa9aa 100644 --- a/src/app/register/register-form/register-form.component.spec.ts +++ b/src/app/register/register-form/register-form.component.spec.ts @@ -6,7 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { Angular2TokenService } from 'angular2-token'; -import { AuthService } from "../../services/auth.service"; +import { AuthService } from "../../shared/services/auth.service"; import { RegisterFormComponent } from './register-form.component'; describe('RegisterFormComponent', () => { diff --git a/src/app/register/register-form/register-form.component.ts b/src/app/register/register-form/register-form.component.ts index fcc106e..cef1b80 100644 --- a/src/app/register/register-form/register-form.component.ts +++ b/src/app/register/register-form/register-form.component.ts @@ -4,7 +4,7 @@ import { FormBuilder, FormControl, FormGroup, Validators } from "@angular/forms" import { RegisterData } from "angular2-token"; import { MaterializeAction } from "angular2-materialize"; -import { AuthService } from "../../services/auth.service" +import { AuthService } from "../../shared/services/auth.service" import { FormUtils } from "../../shared/form.utils"; @Component({ diff --git a/src/app/guards/auth.guard.ts b/src/app/shared/guards/auth.guard.ts similarity index 100% rename from src/app/guards/auth.guard.ts rename to src/app/shared/guards/auth.guard.ts diff --git a/src/app/guards/login.guard.ts b/src/app/shared/guards/login.guard.ts similarity index 100% rename from src/app/guards/login.guard.ts rename to src/app/shared/guards/login.guard.ts diff --git a/src/app/shared/models.ts b/src/app/shared/models/models.ts similarity index 95% rename from src/app/shared/models.ts rename to src/app/shared/models/models.ts index 3995df7..bc63fb3 100644 --- a/src/app/shared/models.ts +++ b/src/app/shared/models/models.ts @@ -1,10 +1,3 @@ -export class TeamMember { - id: number; - name: string; - email: string; - admin: boolean; -} - export class Student { id: number; name: string; diff --git a/src/app/shared/models/team-member.model.ts b/src/app/shared/models/team-member.model.ts new file mode 100644 index 0000000..81aa32b --- /dev/null +++ b/src/app/shared/models/team-member.model.ts @@ -0,0 +1,5 @@ +import { UserData } from "angular2-token"; + +export interface TeamMember extends UserData { + admin: boolean; +} diff --git a/src/app/shared/filter.pipe.spec.ts b/src/app/shared/pipes/filter.pipe.spec.ts similarity index 100% rename from src/app/shared/filter.pipe.spec.ts rename to src/app/shared/pipes/filter.pipe.spec.ts diff --git a/src/app/shared/filter.pipe.ts b/src/app/shared/pipes/filter.pipe.ts similarity index 100% rename from src/app/shared/filter.pipe.ts rename to src/app/shared/pipes/filter.pipe.ts diff --git a/src/app/services/auth.service.spec.ts b/src/app/shared/services/auth.service.spec.ts similarity index 65% rename from src/app/services/auth.service.spec.ts rename to src/app/shared/services/auth.service.spec.ts index ef2c82d..6515129 100644 --- a/src/app/services/auth.service.spec.ts +++ b/src/app/shared/services/auth.service.spec.ts @@ -1,9 +1,10 @@ -import { TestBed, inject, async, ComponentFixture } from '@angular/core/testing'; -import { Angular2TokenService } from 'angular2-token'; -import { AuthService } from './auth.service'; -import { HttpModule } from '@angular/http'; +import { TestBed, inject, async, ComponentFixture } from '@angular/core/testing'; +import { HttpModule } from '@angular/http'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { RouterTestingModule } from '@angular/router/testing'; +import { RouterTestingModule } from '@angular/router/testing'; + +import { Angular2TokenService } from 'angular2-token'; +import { AuthService } from './auth.service'; describe('AuthService', () => { beforeEach(async() => { diff --git a/src/app/services/auth.service.ts b/src/app/shared/services/auth.service.ts similarity index 58% rename from src/app/services/auth.service.ts rename to src/app/shared/services/auth.service.ts index 9479e3f..8c64a6f 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/shared/services/auth.service.ts @@ -1,21 +1,23 @@ import { Injectable } from '@angular/core'; import { Response } from "@angular/http"; import { Http } from '@angular/http'; -//import { Subject, Observable } from "rxjs"; import { Subject } from "rxjs"; -import 'rxjs/add/operator/map'; -import { Observable } from "rxjs/Observable"; -//import { TokenService } from "token.service"; +import 'rxjs/add/operator/map'; +import { Observable } from 'rxjs/Observable'; +import { Angular2TokenService, UserData, SignInData, RegisterData, UpdatePasswordData} from "angular2-token"; -import { Angular2TokenService, SignInData, RegisterData, UpdatePasswordData} from "angular2-token"; +import { TeamMember } from "../models/team-member.model"; @Injectable() export class AuthService { private url: string = "http://localhost:3000/team_members"; - constructor(public _tokenService: Angular2TokenService,private http: Http) {} + constructor( + private http: Http, + public _tokenService: Angular2TokenService + ) {} public signIn(signInData: SignInData): Observable{ return this._tokenService.signIn(signInData) @@ -37,28 +39,37 @@ export class AuthService { .catch(this.handleErrors) } - public userSignedIn(): boolean{ + public deleteAccount(): Observable{ + return this._tokenService.deleteAccount(); + } + + public userSignedIn(): boolean { return this._tokenService.userSignedIn(); } - public deleteAccount(): Observable{ - return this._tokenService.deleteAccount(); + public userIsAdmin(): boolean { + var teamMember: TeamMember = this._tokenService.currentUserData as TeamMember; + if (teamMember !== undefined) return teamMember.admin; + } + + public currentUserData(): TeamMember{ + return this._tokenService.currentUserData as TeamMember; } - getTeamMembers(){ + public getTeamMembers(){ return this.http.get(this.url) - .map(res => res.json()); + .map(res => res.json()); } - deleteTeamMember(id){ + public deleteTeamMember(id){ return this.http.delete(this.url + '/' + id) - .map(res => res.json()); + .map(res => res.json()); } - + //Handling Errors private handleErrors(error: Response){ - console.log("SALVANDO O ERRO NUM ARQUIVO DE LOG - DETALHES DO ERRO => ", error); - return Observable.throw(error); - } + console.log("SALVANDO O ERRO NUM ARQUIVO DE LOG - DETALHES DO ERRO => ", error); + return Observable.throw(error); +} } diff --git a/src/app/services/students.service.spec.ts b/src/app/shared/services/students.service.spec.ts similarity index 99% rename from src/app/services/students.service.spec.ts rename to src/app/shared/services/students.service.spec.ts index 9577152..d484503 100644 --- a/src/app/services/students.service.spec.ts +++ b/src/app/shared/services/students.service.spec.ts @@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing'; import { HttpModule, XHRBackend, Response, ResponseOptions } from '@angular/http'; import { MockBackend, MockConnection } from '@angular/http/testing'; -import { Student, DailyLog, Report, Recommendation, Referral } from '../shared/models'; +import { Student, DailyLog, Report, Recommendation, Referral } from '../models/models'; import { StudentsService } from './students.service'; describe('StudentsService', () => { diff --git a/src/app/services/students.service.ts b/src/app/shared/services/students.service.ts similarity index 100% rename from src/app/services/students.service.ts rename to src/app/shared/services/students.service.ts diff --git a/src/app/sidenav/sidenav.component.ts b/src/app/sidenav/sidenav.component.ts deleted file mode 100644 index 29426e2..0000000 --- a/src/app/sidenav/sidenav.component.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; -import { Router } from "@angular/router"; - -import { MaterializeDirective } from "angular2-materialize"; -import { Angular2TokenService, UserData } from "angular2-token"; - -import { AuthService } from "../services/auth.service"; -import { RegisterFormComponent } from "../register/register-form/register-form.component"; - -@Component({ - selector: 'app-sidenav', - templateUrl: './sidenav.component.html', - styleUrls: ['./sidenav.component.css'] -}) -export class SidenavComponent implements OnInit { - memberData: UserData; - - @ViewChild('registerForm') registerForm: RegisterFormComponent; - - constructor( - public authService: AuthService, - public authTokenService: Angular2TokenService, - private router: Router - ) {} - - ngOnInit() {} - - refreshComponent(){ - this.ngOnInit(); - } - - presentAuthDialog(){ - this.registerForm.openDialog(); - } - - signOut(){ - this.authService.signOut() - .subscribe( - () => this.router.navigate(['/login']) - ) - } - -} diff --git a/src/app/students/daily-log-form/daily-log-form.component.spec.ts b/src/app/students/daily-log-form/daily-log-form.component.spec.ts index cd9cf34..c7658b3 100644 --- a/src/app/students/daily-log-form/daily-log-form.component.spec.ts +++ b/src/app/students/daily-log-form/daily-log-form.component.spec.ts @@ -6,7 +6,8 @@ import { HttpModule } from '@angular/http'; import { Angular2TokenService } from 'angular2-token'; import { DailyLogFormComponent } from './daily-log-form.component'; -import { StudentsService } from '../../services/students.service'; +import { AuthService } from '../../shared/services/auth.service'; +import { StudentsService } from '../../shared/services/students.service'; describe('DailyLogFormComponent', () => { let component: DailyLogFormComponent; @@ -24,6 +25,7 @@ describe('DailyLogFormComponent', () => { ], declarations: [ DailyLogFormComponent ], providers: [ + AuthService, StudentsService, {provide: Angular2TokenService, useValue: tokenMock} ] diff --git a/src/app/students/daily-log-form/daily-log-form.component.ts b/src/app/students/daily-log-form/daily-log-form.component.ts index 9d0f6af..b3fc4c4 100644 --- a/src/app/students/daily-log-form/daily-log-form.component.ts +++ b/src/app/students/daily-log-form/daily-log-form.component.ts @@ -3,8 +3,9 @@ import { Router, ActivatedRoute } from '@angular/router'; import { Angular2TokenService } from "angular2-token"; -import { DailyLog } from "../../shared/models"; -import { StudentsService } from '../../services/students.service'; +import { DailyLog } from "../../shared/models/models"; +import { AuthService } from '../../shared/services/auth.service'; +import { StudentsService } from '../../shared/services/students.service'; @Component({ selector: 'app-daily-log-form', @@ -19,8 +20,8 @@ export class DailyLogFormComponent implements OnInit { constructor( private router: Router, private route: ActivatedRoute, - private studentsService: StudentsService, - public authTokenService: Angular2TokenService + private authService: AuthService, + private studentsService: StudentsService ) { } ngOnInit() { @@ -35,8 +36,8 @@ export class DailyLogFormComponent implements OnInit { var result; this.daily_log.student_id = this.id - this.daily_log.created_by = this.authTokenService.currentUserData.name - this.daily_log.updated_by = this.authTokenService.currentUserData.name + this.daily_log.created_by = this.authService.currentUserData().name + this.daily_log.updated_by = this.authService.currentUserData().name if (this.daily_log.id) result = this.studentsService.updateDailyLog(this.daily_log); diff --git a/src/app/students/daily-log-panel/daily-log-panel.component.spec.ts b/src/app/students/daily-log-panel/daily-log-panel.component.spec.ts index 07aa000..a2966ae 100644 --- a/src/app/students/daily-log-panel/daily-log-panel.component.spec.ts +++ b/src/app/students/daily-log-panel/daily-log-panel.component.spec.ts @@ -4,7 +4,7 @@ import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { DailyLogPanelComponent } from './daily-log-panel.component'; -import { StudentsService } from '../../services/students.service'; +import { StudentsService } from '../../shared/services/students.service'; describe('DailyLogPanelComponent', () => { let component: DailyLogPanelComponent; diff --git a/src/app/students/daily-log-panel/daily-log-panel.component.ts b/src/app/students/daily-log-panel/daily-log-panel.component.ts index 59f7977..78f7ed3 100644 --- a/src/app/students/daily-log-panel/daily-log-panel.component.ts +++ b/src/app/students/daily-log-panel/daily-log-panel.component.ts @@ -1,8 +1,8 @@ import { Component, OnInit } from '@angular/core'; -import { StudentsService } from '../../services/students.service'; +import { StudentsService } from '../../shared/services/students.service'; -import { DailyLog } from "../../shared/models"; +import { DailyLog } from "../../shared/models/models"; import { Router, ActivatedRoute } from '@angular/router'; diff --git a/src/app/students/daily-log/daily-log.component.spec.ts b/src/app/students/daily-log/daily-log.component.spec.ts index 072f583..eef0742 100644 --- a/src/app/students/daily-log/daily-log.component.spec.ts +++ b/src/app/students/daily-log/daily-log.component.spec.ts @@ -6,7 +6,7 @@ import { HttpModule } from '@angular/http'; import { OrderPipe } from 'ngx-order-pipe'; import { DailyLogComponent } from './daily-log.component'; -import { StudentsService } from '../../services/students.service'; +import { StudentsService } from '../../shared/services/students.service'; describe('DailyLogComponent', () => { let component: DailyLogComponent; diff --git a/src/app/students/daily-log/daily-log.component.ts b/src/app/students/daily-log/daily-log.component.ts index 68b3919..53f8b77 100644 --- a/src/app/students/daily-log/daily-log.component.ts +++ b/src/app/students/daily-log/daily-log.component.ts @@ -1,8 +1,8 @@ import { Component, OnInit } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; -import { Student, DailyLog } from "../../shared/models"; -import { StudentsService } from '../../services/students.service'; +import { Student, DailyLog } from "../../shared/models/models"; +import { StudentsService } from '../../shared/services/students.service'; @Component({ selector: 'app-daily-log', diff --git a/src/app/students/recommendation-panel/recommendation-panel.component.spec.ts b/src/app/students/recommendation-panel/recommendation-panel.component.spec.ts index 870883c..4dc1f8f 100644 --- a/src/app/students/recommendation-panel/recommendation-panel.component.spec.ts +++ b/src/app/students/recommendation-panel/recommendation-panel.component.spec.ts @@ -5,7 +5,8 @@ import { HttpModule } from '@angular/http'; import { Angular2TokenService } from 'angular2-token'; -import { StudentsService } from '../../services/students.service' +import { StudentsService } from '../../shared/services/students.service' +import { AuthService } from '../../shared/services/auth.service'; import { RecommendationPanelComponent } from './recommendation-panel.component'; describe('RecommendationComponent', () => { @@ -25,6 +26,7 @@ describe('RecommendationComponent', () => { ], declarations: [ RecommendationPanelComponent ], providers: [ + AuthService, StudentsService, {provide: Angular2TokenService, useValue: tokenMock} ] diff --git a/src/app/students/recommendation-panel/recommendation-panel.component.ts b/src/app/students/recommendation-panel/recommendation-panel.component.ts index f62e32a..eec2640 100644 --- a/src/app/students/recommendation-panel/recommendation-panel.component.ts +++ b/src/app/students/recommendation-panel/recommendation-panel.component.ts @@ -4,8 +4,9 @@ import { Router, ActivatedRoute } from '@angular/router'; import { Angular2TokenService } from "angular2-token"; import * as jsPDF from 'jspdf'; -import { Recommendation } from "../../shared/models"; -import { StudentsService } from '../../services/students.service'; +import { Recommendation } from "../../shared/models/models"; +import { StudentsService } from '../../shared/services/students.service'; +import { AuthService } from '../../shared/services/auth.service'; @Component({ selector: 'app-recommendation-panel', @@ -19,7 +20,7 @@ export class RecommendationPanelComponent implements OnInit { idAux: number; constructor( - public authTokenService: Angular2TokenService, + public authService: AuthService, private recommendationService: StudentsService, private router: Router, private route: ActivatedRoute @@ -41,7 +42,7 @@ export class RecommendationPanelComponent implements OnInit { } updateRecommendation(recommendation){ - this.recommendation.updated_by = this.authTokenService.currentUserData.name + this.recommendation.updated_by = this.authService.currentUserData().name var result; result = this.recommendationService.updateRecommendation(this.recommendation); result.subscribe(data => this.router.navigate(['/recommendation'])); @@ -52,8 +53,8 @@ export class RecommendationPanelComponent implements OnInit { createRecommendation(){ this.recommendation.id = this.idAux this.recommendation.student_id = this.idAux - this.recommendation.created_by = this.authTokenService.currentUserData.name - this.recommendation.updated_by = this.authTokenService.currentUserData.name + this.recommendation.created_by = this.authService.currentUserData().name + this.recommendation.updated_by = this.authService.currentUserData().name var result; result = this.recommendationService.createRecommendation(this.recommendation); result.subscribe(data => this.router.navigate(['/recommendation'])); diff --git a/src/app/students/referral-form/referral-form.component.spec.ts b/src/app/students/referral-form/referral-form.component.spec.ts index f49a176..4746fa1 100644 --- a/src/app/students/referral-form/referral-form.component.spec.ts +++ b/src/app/students/referral-form/referral-form.component.spec.ts @@ -6,7 +6,8 @@ import { HttpModule } from '@angular/http'; import { Angular2TokenService } from 'angular2-token'; import { ReferralFormComponent } from './referral-form.component'; -import { StudentsService } from '../../services/students.service'; +import { AuthService } from '../../shared/services/auth.service'; +import { StudentsService } from '../../shared/services/students.service'; describe('ReferralFormComponent', () => { let component: ReferralFormComponent; @@ -25,6 +26,7 @@ describe('ReferralFormComponent', () => { ], declarations: [ ReferralFormComponent ], providers: [ + AuthService, StudentsService, {provide: Angular2TokenService, useValue: tokenMock} ] diff --git a/src/app/students/referral-form/referral-form.component.ts b/src/app/students/referral-form/referral-form.component.ts index bcc3370..0a43a5e 100644 --- a/src/app/students/referral-form/referral-form.component.ts +++ b/src/app/students/referral-form/referral-form.component.ts @@ -1,10 +1,9 @@ import { Component, OnInit } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; -import { Angular2TokenService } from "angular2-token"; - -import { Referral } from "../../shared/models"; -import { StudentsService } from '../../services/students.service'; +import { Referral } from "../../shared/models/models"; +import { AuthService } from '../../shared/services/auth.service'; +import { StudentsService } from '../../shared/services/students.service'; @Component({ selector: 'app-referral-form', @@ -20,7 +19,7 @@ export class ReferralFormComponent implements OnInit { private router: Router, private route: ActivatedRoute, private studentsService: StudentsService, - public authTokenService: Angular2TokenService + public authService: AuthService ) { } ngOnInit() { @@ -35,8 +34,8 @@ export class ReferralFormComponent implements OnInit { var result; this.referral.student_id = this.id - this.referral.created_by = this.authTokenService.currentUserData.name - this.referral.updated_by = this.authTokenService.currentUserData.name + this.referral.created_by = this.authService.currentUserData().name + this.referral.updated_by = this.authService.currentUserData().name if (this.referral.id) result = this.studentsService.updateReferral(this.referral); diff --git a/src/app/students/referral-panel/logoGDF.png b/src/app/students/referral-panel/logoGDF.png deleted file mode 100644 index d73c47f..0000000 Binary files a/src/app/students/referral-panel/logoGDF.png and /dev/null differ diff --git a/src/app/students/referral-panel/referral-panel.component.html b/src/app/students/referral-panel/referral-panel.component.html index e4a5efb..469dcc9 100644 --- a/src/app/students/referral-panel/referral-panel.component.html +++ b/src/app/students/referral-panel/referral-panel.component.html @@ -1,95 +1,70 @@ -
+
+
+
+
Painel do Encaminhamento
+
+ +
+
+ +
-

Painel do Encaminhamento

-
-
- -
-
-

Dados do Estudante

-

Estabelecimento de Ensino: Escola Classe 401

-

Nome: {{referral.student.name}}

-

Data de Nascimento: {{referral.student.birth_date}}

-

Ano: {{referral.student.year}}

-

Turno: {{referral.student.shift}}

-

Turma: {{referral.student.student_class}}

-

Naturalidade: {{referral.student.nationality}}

-

Sexo:

-

Filiação:

-

Endereço: {{referral.student.address}}

-

Telefone: {{referral.student.parent_telephone}}

+ +
+
+
+

Dados do Estudante

-

{{referral.title}}

-
- {{referral.body}} -
-
-
-
- - +

Estabelecimento de Ensino: Escola Classe 401

+

Nome: {{referral.student.name}}

+

Data de Nascimento: {{referral.student.birth_date}}

+

Ano: {{referral.student.year}}

+

Turno: {{referral.student.shift}}

+

Turma: {{referral.student.student_class}}

+

Naturalidade: {{referral.student.nationality}}

+

Filiação: {{referral.student.responsible}}

+

Endereço: {{referral.student.address}}

+

Telefone: {{referral.student.parent_telephone}}

+ +

{{referral.title}}

+
{{referral.body}}
-
- - +
+
+ + +
+
+ + +
+
+
+ + + + +
-
-
- -
- -
-
- -
- - - - -
-
diff --git a/src/app/students/referral-panel/referral-panel.component.spec.ts b/src/app/students/referral-panel/referral-panel.component.spec.ts index cc5e914..eab87a7 100644 --- a/src/app/students/referral-panel/referral-panel.component.spec.ts +++ b/src/app/students/referral-panel/referral-panel.component.spec.ts @@ -3,7 +3,7 @@ import { HttpModule } from '@angular/http'; import { RouterTestingModule } from '@angular/router/testing'; import { FormsModule } from '@angular/forms'; -import { StudentsService } from '../../services/students.service'; +import { StudentsService } from '../../shared/services/students.service'; import { ReferralPanelComponent } from './referral-panel.component'; diff --git a/src/app/students/referral-panel/referral-panel.component.ts b/src/app/students/referral-panel/referral-panel.component.ts index b908476..47b399f 100644 --- a/src/app/students/referral-panel/referral-panel.component.ts +++ b/src/app/students/referral-panel/referral-panel.component.ts @@ -3,8 +3,8 @@ import { Router, ActivatedRoute } from '@angular/router'; import * as jsPDF from 'jspdf'; -import { Referral } from "../../shared/models"; -import { StudentsService } from '../../services/students.service'; +import { Referral } from "../../shared/models/models"; +import { StudentsService } from '../../shared/services/students.service'; @Component({ selector: 'app-referral-panel', @@ -12,16 +12,16 @@ import { StudentsService } from '../../services/students.service'; styleUrls: ['./referral-panel.component.css'] }) export class ReferralPanelComponent implements OnInit { - - @ViewChild( 'content' ) content: ElementRef; name: string; editMode: boolean; referral: Referral = new Referral(); + @ViewChild('content') content: ElementRef; + constructor( private studentsService: StudentsService, - private router: Router, - private route: ActivatedRoute + private route: ActivatedRoute, + private router: Router ) { } ngOnInit() { @@ -38,20 +38,25 @@ export class ReferralPanelComponent implements OnInit { }); } + returnToList() { + this.router.navigate(['/referrals', this.referral.student.id]); + } + deleteReferral(referral) { if (confirm("Você tem certeza que quer deletar o encaminhamento " + referral.id + "?")) { - this.studentsService.deleteReferral(referral.id).subscribe(null); + var stId = referral.student.id; + this.studentsService.deleteReferral(referral.id) + .subscribe(data => this.router.navigate(['/referrals', stId])); } } updateReferral(referral){ var result; result = this.studentsService.updateReferral(this.referral); - - result.subscribe(data => this.router.navigate(['/referrals'])); + result.subscribe(data => this.router.navigate(['/referrals', this.referral.student.id])); } - public generatePDFReferral(){ + public generatePDFReferral(name){ let doc = new jsPDF(); let specialElementHandlers = { @@ -67,7 +72,7 @@ export class ReferralPanelComponent implements OnInit { 'elementHandlers': specialElementHandlers }); - doc.save('teste.pdf'); + doc.save('encaminhamento_' + name + '.pdf'); } } diff --git a/src/app/students/referral/referral.component.spec.ts b/src/app/students/referral/referral.component.spec.ts index 28754a3..5a8b96f 100644 --- a/src/app/students/referral/referral.component.spec.ts +++ b/src/app/students/referral/referral.component.spec.ts @@ -6,7 +6,7 @@ import { HttpModule } from '@angular/http'; import { OrderPipe } from 'ngx-order-pipe'; import { ReferralComponent } from './referral.component'; -import { StudentsService } from '../../services/students.service'; +import { StudentsService } from '../../shared/services/students.service'; describe('ReferralComponent', () => { let component: ReferralComponent; diff --git a/src/app/students/referral/referral.component.ts b/src/app/students/referral/referral.component.ts index 5d7ee77..d57ecdb 100644 --- a/src/app/students/referral/referral.component.ts +++ b/src/app/students/referral/referral.component.ts @@ -1,8 +1,8 @@ import { Component, OnInit } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; -import { Student, Referral } from "../../shared/models"; -import { StudentsService } from '../../services/students.service'; +import { Student, Referral } from "../../shared/models/models"; +import { StudentsService } from '../../shared/services/students.service'; @Component({ selector: 'app-referral', diff --git a/src/app/students/report-form/report-form.component.spec.ts b/src/app/students/report-form/report-form.component.spec.ts index 1ab922c..383ae2f 100644 --- a/src/app/students/report-form/report-form.component.spec.ts +++ b/src/app/students/report-form/report-form.component.spec.ts @@ -6,7 +6,8 @@ import { HttpModule } from '@angular/http'; import { Angular2TokenService } from 'angular2-token'; import { ReportFormComponent } from './report-form.component'; -import { StudentsService } from '../../services/students.service'; +import { AuthService } from '../../shared/services/auth.service'; +import { StudentsService } from '../../shared/services/students.service'; describe('ReportFormComponent', () => { let component: ReportFormComponent; @@ -25,6 +26,7 @@ describe('ReportFormComponent', () => { ], declarations: [ ReportFormComponent ], providers: [ + AuthService, StudentsService, {provide: Angular2TokenService, useValue: tokenMock} ] diff --git a/src/app/students/report-form/report-form.component.ts b/src/app/students/report-form/report-form.component.ts index 569ae46..0be25a7 100644 --- a/src/app/students/report-form/report-form.component.ts +++ b/src/app/students/report-form/report-form.component.ts @@ -1,10 +1,9 @@ import { Component, OnInit } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; -import { Angular2TokenService } from "angular2-token"; - -import { Report, Student } from "../../shared/models"; -import { StudentsService } from '../../services/students.service'; +import { Report, Student } from "../../shared/models/models"; +import { AuthService } from '../../shared/services/auth.service'; +import { StudentsService } from '../../shared/services/students.service'; @Component({ selector: 'app-report-form', @@ -18,7 +17,7 @@ export class ReportFormComponent implements OnInit { student: Student = new Student(); idC: number; constructor( - public authTokenService: Angular2TokenService, + public authService: AuthService, private reportService: StudentsService, private router: Router, private route: ActivatedRoute @@ -59,8 +58,8 @@ export class ReportFormComponent implements OnInit { save() { var result; this.report.student_id = this.student.id - this.report.created_by = this.authTokenService.currentUserData.name - this.report.updated_by = this.authTokenService.currentUserData.name + this.report.created_by = this.authService.currentUserData().name + this.report.updated_by = this.authService.currentUserData().name if (this.report.id){ result = this.reportService.updateReport(this.report); } else { diff --git a/src/app/students/report/report.component.spec.ts b/src/app/students/report/report.component.spec.ts index baadd57..5e21774 100644 --- a/src/app/students/report/report.component.spec.ts +++ b/src/app/students/report/report.component.spec.ts @@ -4,7 +4,7 @@ import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { ReportComponent } from './report.component'; -import { StudentsService } from '../../services/students.service'; +import { StudentsService } from '../../shared/services/students.service'; describe('ReportComponent', () => { let component: ReportComponent; diff --git a/src/app/students/report/report.component.ts b/src/app/students/report/report.component.ts index bb711ef..7c4b043 100644 --- a/src/app/students/report/report.component.ts +++ b/src/app/students/report/report.component.ts @@ -6,8 +6,8 @@ import * as JSZip from 'jszip'; import * as JSZipUtils from 'jszip-utils'; import * as FileSaver from 'file-saver'; -import { Report } from "../../shared/models"; -import { StudentsService } from '../../services/students.service'; +import { Report } from "../../shared/models/models"; +import { StudentsService } from '../../shared/services/students.service'; declare const require: any; @@ -66,7 +66,6 @@ export class ReportComponent implements OnInit { type: 'blob', mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' }) - FileSaver.saveAs(out, 'report_student_' + report.student_id + '.docx') }) } diff --git a/src/app/students/student-form/student-form.component.spec.ts b/src/app/students/student-form/student-form.component.spec.ts index b16a1b7..4eab89d 100644 --- a/src/app/students/student-form/student-form.component.spec.ts +++ b/src/app/students/student-form/student-form.component.spec.ts @@ -6,7 +6,7 @@ import { HttpModule } from '@angular/http'; import { MaterializeModule } from 'angular2-materialize'; import { StudentFormComponent } from './student-form.component'; -import { StudentsService } from '../../services/students.service'; +import { StudentsService } from '../../shared/services/students.service'; describe('StudentFormComponent', () => { let component: StudentFormComponent; diff --git a/src/app/students/student-form/student-form.component.ts b/src/app/students/student-form/student-form.component.ts index 14f4276..ccb27ec 100644 --- a/src/app/students/student-form/student-form.component.ts +++ b/src/app/students/student-form/student-form.component.ts @@ -3,8 +3,8 @@ import { Router, ActivatedRoute } from '@angular/router'; import { MaterializeDirective } from 'angular2-materialize'; -import { Student } from '../../shared/models'; -import { StudentsService } from '../../services/students.service'; +import { Student } from '../../shared/models/models'; +import { StudentsService } from '../../shared/services/students.service'; @Component({ selector: 'app-student-form', diff --git a/src/app/students/student-panel/student-panel.component.spec.ts b/src/app/students/student-panel/student-panel.component.spec.ts index 31ed294..e8ea056 100644 --- a/src/app/students/student-panel/student-panel.component.spec.ts +++ b/src/app/students/student-panel/student-panel.component.spec.ts @@ -4,7 +4,7 @@ import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { StudentPanelComponent } from './student-panel.component'; -import { StudentsService } from '../../services/students.service'; +import { StudentsService } from '../../shared/services/students.service'; describe('StudentPanelComponent', () => { let component: StudentPanelComponent; diff --git a/src/app/students/student-panel/student-panel.component.ts b/src/app/students/student-panel/student-panel.component.ts index 4085730..9560616 100644 --- a/src/app/students/student-panel/student-panel.component.ts +++ b/src/app/students/student-panel/student-panel.component.ts @@ -1,8 +1,8 @@ import { Component, OnInit } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; -import { Student } from "../../shared/models"; -import { StudentsService } from '../../services/students.service'; +import { Student } from "../../shared/models/models"; +import { StudentsService } from '../../shared/services/students.service'; @Component({ selector: 'app-student-panel', diff --git a/src/app/students/students.component.html b/src/app/students/students.component.html index 94a6325..f7fe587 100644 --- a/src/app/students/students.component.html +++ b/src/app/students/students.component.html @@ -20,7 +20,7 @@
Relação de Alunos
- diff --git a/src/app/students/students.component.spec.ts b/src/app/students/students.component.spec.ts index c9ef1c3..8892092 100644 --- a/src/app/students/students.component.spec.ts +++ b/src/app/students/students.component.spec.ts @@ -8,9 +8,9 @@ import { Angular2TokenService } from 'angular2-token'; import { MaterializeModule } from 'angular2-materialize'; import { StudentsComponent } from './students.component'; -import { AuthService } from "../services/auth.service"; -import { StudentsService } from '../services/students.service'; -import { FilterPipe } from "../shared/filter.pipe"; +import { AuthService } from "../shared/services/auth.service"; +import { StudentsService } from '../shared/services/students.service'; +import { FilterPipe } from "../shared/pipes/filter.pipe"; describe('StudentsComponent', () => { let component: StudentsComponent; diff --git a/src/app/students/students.component.ts b/src/app/students/students.component.ts index 384b81c..dd30108 100644 --- a/src/app/students/students.component.ts +++ b/src/app/students/students.component.ts @@ -5,8 +5,8 @@ import { FormsModule } from '@angular/forms'; import { MaterializeDirective } from 'angular2-materialize'; import { OrderPipe } from 'ngx-order-pipe'; -import { Student } from "../shared/models"; -import { StudentsService } from '../services/students.service'; +import { Student } from "../shared/models/models"; +import { StudentsService } from '../shared/services/students.service'; @Component({ selector: 'app-students', diff --git a/src/app/tutorial/tutorial-login/tutorial-login.component.css b/src/app/tutorial/tutorial-login/tutorial-login.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/tutorial/tutorial-login/tutorial-login.component.html b/src/app/tutorial/tutorial-login/tutorial-login.component.html new file mode 100644 index 0000000..8f7fe3d --- /dev/null +++ b/src/app/tutorial/tutorial-login/tutorial-login.component.html @@ -0,0 +1,52 @@ + diff --git a/src/app/tutorial/tutorial-login/tutorial-login.component.spec.ts b/src/app/tutorial/tutorial-login/tutorial-login.component.spec.ts new file mode 100644 index 0000000..ffe6ada --- /dev/null +++ b/src/app/tutorial/tutorial-login/tutorial-login.component.spec.ts @@ -0,0 +1,46 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { HttpModule } from '@angular/http'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { RouterTestingModule } from '@angular/router/testing'; + +import { Angular2TokenService } from 'angular2-token'; + +import { AuthService } from "../../shared/services/auth.service"; +import { TutorialLoginComponent } from './tutorial-login.component'; + +describe('TutorialLoginComponent', () => { + let component: TutorialLoginComponent; + let fixture: ComponentFixture; + + beforeEach(async( () => { + let tokenMock = jasmine.createSpyObj('tokenMock', ['validateToken', 'subscribe']); + tokenMock.validateToken.and.returnValue(tokenMock); + + TestBed.configureTestingModule({ + declarations: [ TutorialLoginComponent ], + schemas: [NO_ERRORS_SCHEMA], + imports: [ + HttpModule, + FormsModule, + ReactiveFormsModule, + RouterTestingModule + ], + providers: [ + AuthService, + { provide: Angular2TokenService, useValue: tokenMock} + ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TutorialLoginComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/tutorial/tutorial-login/tutorial-login.component.ts b/src/app/tutorial/tutorial-login/tutorial-login.component.ts new file mode 100644 index 0000000..d8df38f --- /dev/null +++ b/src/app/tutorial/tutorial-login/tutorial-login.component.ts @@ -0,0 +1,26 @@ +import { Component, OnInit, EventEmitter } from '@angular/core'; + +import { MaterializeAction } from "angular2-materialize"; + +@Component({ + selector: 'app-tutorial-login', + templateUrl: './tutorial-login.component.html', + styleUrls: ['./tutorial-login.component.css'] +}) + +export class TutorialLoginComponent implements OnInit { + + modalActions = new EventEmitter(); + + constructor() {} + + ngOnInit() {} + + openDialog(){ + this.modalActions.emit({action:"modal", params:['open']}); + } + + closeDialog(){ + this.modalActions.emit({action:"modal", params:['close']}); + } +} diff --git a/src/app/tutorial/tutorial.component.css b/src/app/tutorial/tutorial.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/tutorial/tutorial.component.html b/src/app/tutorial/tutorial.component.html new file mode 100644 index 0000000..26f85c5 --- /dev/null +++ b/src/app/tutorial/tutorial.component.html @@ -0,0 +1,83 @@ +
+
+
+
Tutorial IncluCare
+
+
+
+ +
+
+
+

+ Para acessar, digite seu email e sua senha.
+ +
+ Essa é a página da relação de todos os estudantes cadastrados no sistema.
+
+
Para cadastrar um novo estudante basta clicar no botão “ADICIONAR ALUNO” no canto superior direito da página.

+ +
Essa será a página aberta
+

+ + Pronto! Aluno Cadastrado
+ +
São possíveis quatro ações com o estudante. Que são elas:
+ Registros diários, Encaminhamentos, ver o relatório, e gerar recomendações.

+ Para qualquer dessas ações, basta clicar na seta azul ao lado do estudante desejado.
+ +
+ +
Essa será a janela aberta!
+
+

+ + Para adicionar um registro diário basta clicar no botão “REGISTROS DIÁRIOS”
+
+

+ A seguinte tela irá ser exibida
+
+ Clique em “NOVO REGISTRO” e preencha os campos, depois só clicar em “ENVIAR”
+

+ +
+
+ + Para ir para encaminhamento basta clicar em "ENCAMINHAMENTOS"

+ + A seguinte janela irá ser exibida
+

+ + Clique em "NOVO ENCAMINHAMENTO"

+ + Então preencha os campos conforme a figura a baixo:
+

+ +

+ + Para gerar um relatório, basta clicar em “RELATÓRIO”

+ + Com a tela seguinte, preencha os campos e em seguida clique em ‘ENVIAR”
+

+ + Para gerar recomendações basta clicar em “RECOMENDAÇÕES”
+ +

+ + Com a tela seguinte, preencha os campos e em seguida clique em ‘ENVIAR”
+

+ +

Alterar Perfil

+

+ Para alterar seus dados no sistema, basta você clicar no seu usário, localizado no menu lateral esquerdo
+

+ + E em seguida clicar em “Visitar Perfil”

+ + A seguinte tela irá ser exibida
+
+ Agora só editar as informações que queira e salvar!
+ +
+
+
diff --git a/src/app/tutorial/tutorial.component.spec.ts b/src/app/tutorial/tutorial.component.spec.ts new file mode 100644 index 0000000..094ad43 --- /dev/null +++ b/src/app/tutorial/tutorial.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TutorialComponent } from './tutorial.component'; + +describe('TutorialComponent', () => { + let component: TutorialComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TutorialComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TutorialComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/tutorial/tutorial.component.ts b/src/app/tutorial/tutorial.component.ts new file mode 100644 index 0000000..bbbff5c --- /dev/null +++ b/src/app/tutorial/tutorial.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-tutorial', + templateUrl: './tutorial.component.html', + styleUrls: ['./tutorial.component.css'] +}) +export class TutorialComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/src/assets/images/tutorial/AdicionarREgistroDiario.jpeg b/src/assets/images/tutorial/AdicionarREgistroDiario.jpeg new file mode 100644 index 0000000..3029746 Binary files /dev/null and b/src/assets/images/tutorial/AdicionarREgistroDiario.jpeg differ diff --git a/src/assets/images/tutorial/addStudent.jpeg b/src/assets/images/tutorial/addStudent.jpeg new file mode 100644 index 0000000..429830c Binary files /dev/null and b/src/assets/images/tutorial/addStudent.jpeg differ diff --git a/src/assets/images/tutorial/adicionarEncaminhamento.jpeg b/src/assets/images/tutorial/adicionarEncaminhamento.jpeg new file mode 100644 index 0000000..c3571ce Binary files /dev/null and b/src/assets/images/tutorial/adicionarEncaminhamento.jpeg differ diff --git a/src/assets/images/tutorial/encaminhamentos.jpeg b/src/assets/images/tutorial/encaminhamentos.jpeg new file mode 100644 index 0000000..aa89811 Binary files /dev/null and b/src/assets/images/tutorial/encaminhamentos.jpeg differ diff --git a/src/assets/images/tutorial/painelAluno.jpeg b/src/assets/images/tutorial/painelAluno.jpeg new file mode 100644 index 0000000..33040d1 Binary files /dev/null and b/src/assets/images/tutorial/painelAluno.jpeg differ diff --git a/src/assets/images/tutorial/painelRecomendacao.jpeg b/src/assets/images/tutorial/painelRecomendacao.jpeg new file mode 100644 index 0000000..da65ad6 Binary files /dev/null and b/src/assets/images/tutorial/painelRecomendacao.jpeg differ diff --git a/src/assets/images/tutorial/perfilAdmin.jpeg b/src/assets/images/tutorial/perfilAdmin.jpeg new file mode 100644 index 0000000..a47bdc8 Binary files /dev/null and b/src/assets/images/tutorial/perfilAdmin.jpeg differ diff --git a/src/assets/images/tutorial/relatorioAluno.jpeg b/src/assets/images/tutorial/relatorioAluno.jpeg new file mode 100644 index 0000000..773a36f Binary files /dev/null and b/src/assets/images/tutorial/relatorioAluno.jpeg differ diff --git a/src/assets/images/tutorial/relatorioDiario.jpeg b/src/assets/images/tutorial/relatorioDiario.jpeg new file mode 100644 index 0000000..33af904 Binary files /dev/null and b/src/assets/images/tutorial/relatorioDiario.jpeg differ diff --git a/src/assets/images/tutorial/tabelaAluno.jpeg b/src/assets/images/tutorial/tabelaAluno.jpeg new file mode 100644 index 0000000..17c610f Binary files /dev/null and b/src/assets/images/tutorial/tabelaAluno.jpeg differ