Skip to content

Commit

Permalink
Merge pull request #139 from cvazquezlos/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
cvazquezlos authored Apr 18, 2017
2 parents 9127c49 + bf07092 commit ec0365e
Show file tree
Hide file tree
Showing 34 changed files with 577 additions and 384 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
public class UserRestController {

public interface UserDetail extends User.Basic, User.Act, User.Fin, Fine.Basic, Action.Basic {}
public interface UserBasic extends User.LoginInt {}

@Autowired
private UserService userService;
Expand Down Expand Up @@ -84,7 +85,7 @@ public ResponseEntity<User> getUser(@PathVariable int id, Authentication authent
}

@CrossOrigin(origins = "http://localhost:4200")
@JsonView(UserDetail.class)
@JsonView(UserBasic.class)
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public ResponseEntity<User> deleteUser(@PathVariable Integer id, HttpSession session,
Authentication authentication) {
Expand Down
Binary file modified backend/target/appSpring-0.0.1.jar
Binary file not shown.
Binary file modified backend/target/appSpring-0.0.1.jar.original
Binary file not shown.
10 changes: 7 additions & 3 deletions frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { Component } from '@angular/core';
import {Component, OnDestroy} from '@angular/core';


@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
export class AppComponent implements OnDestroy {

constructor() {
localStorage.clear();
}

ngOnDestroy() {
console.log('Killing proccesses...');
}

}
4 changes: 2 additions & 2 deletions frontend/src/app/component/admin/admin-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const adminRoutes: Routes = [
{path: 'loans', component: ManageLoansComponent},
{path: 'fines', component: ManageFinesComponent},
{path: 'users', component: ManageUsersComponent},
{path: 'user/:id', component: EditUserComponent},
{path: 'user/new', component: CreateUserComponent},
{path: 'users/new', component: CreateUserComponent},
{path: 'users/:id', component: EditUserComponent},
{path: '', component: DashboardComponent}
]
}
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/app/component/admin/admin.component.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<div class="wrapper">
<app-admin-header></app-admin-header>

<app-admin-sidebar></app-admin-sidebar>

<div class="content-wrapper">
<router-outlet></router-outlet>
</div>

<footer class="main-footer ">
<footer class="main-footer">
<strong>Copyright &copy; 2017 <a href="/">BREMS</a>.</strong> Todos los derechos reservados.
</footer>
</div>
14 changes: 12 additions & 2 deletions frontend/src/app/component/admin/admin.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import { Component } from '@angular/core';
import {Component, OnInit} from '@angular/core';

import {SessionService} from '../../service/session.service';
import {UserService} from '../../service/user.service';

@Component({
templateUrl: './admin.component.html'
})
export class AdminComponent {
export class AdminComponent implements OnInit {

constructor(private sessionService: SessionService) {
}

ngOnInit() {
}

}
6 changes: 5 additions & 1 deletion frontend/src/app/component/admin/admin.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
import {FormsModule} from '@angular/forms';

import {AdminComponent} from './admin.component';

Expand All @@ -18,7 +20,9 @@ import {DashboardComponent} from './dashboard/dashboard.component';
@NgModule({
imports: [
CommonModule,
AdminRoutingModule
AdminRoutingModule,
NgbModule,
FormsModule
],
declarations: [
AdminComponent,
Expand Down
Empty file.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import { Component, OnInit } from '@angular/core';
import {Router} from '@angular/router';

import {SessionService} from '../../../service/session.service';

@Component({
selector: 'app-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.css']
templateUrl: 'dashboard.component.html'
})
export class DashboardComponent implements OnInit {

constructor() { }
constructor(private router: Router, private sessionService: SessionService) { }

ngOnInit() {
if (!this.sessionService.checkCredentials()) {
this.router.navigate(["/login"]);
}
}

}
35 changes: 0 additions & 35 deletions frontend/src/app/component/admin/header/header.component.css

This file was deleted.

26 changes: 16 additions & 10 deletions frontend/src/app/component/admin/header/header.component.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<header class="main-header">

<a [routerLink]="['']" class="logo">
<img [src]="imgLogo" width="50" height="50">
<span class="logo-mini">Book Reserve System</span>
<span class="logo-mini br">Management</span>
<a [routerLink]="['/admin']" class="logo" height="40px">
<img [src]="imgLogo">
<span class="logo-mini">BREMS</span>
</a>

<nav class="navbar navbar-static-top" role="navigation">
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Menú</span>
Expand All @@ -14,14 +11,23 @@
<ul class="nav navbar-nav">
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src="img/icon-profile.png" class="user-image" alt="User Image">
<span class="hidden-xs"></span>
<div *ngIf="userImage == undefined; else chargedImage">
<img src="../../../../assets/img/loadingImages.svg" width="20px" height="20px" align="middle">
</div>
<ng-template #chargedImage>
<img [src]="sanitizer.bypassSecurityTrustUrl(userImage)" class="user-image" />
</ng-template>
<span class="hidden-xs">{{user?.firstName}} {{user?.lastName1}}</span>
</a>
<ul class="dropdown-menu">
<li class="user-header">
<div class="imgUploaderr">
<img id="myImg" src="img/icon-profile.png" alt="Tu imagen" />
<input type='file' />
<div *ngIf="userImage == undefined; else chargedImage">
<img src="../../../../assets/img/loadingImages.svg" width="50px" height="50px" align="middle">
</div>
<ng-template #chargedImage>
<img [src]="sanitizer.bypassSecurityTrustUrl(userImage)" class="user-image" />
</ng-template>
</div>
<p>
</p>
Expand Down
25 changes: 0 additions & 25 deletions frontend/src/app/component/admin/header/header.component.spec.ts

This file was deleted.

28 changes: 23 additions & 5 deletions frontend/src/app/component/admin/header/header.component.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,37 @@
import { Component, OnInit } from '@angular/core';
import {IMG_URL} from "../../../util";
import {DomSanitizer} from '@angular/platform-browser';
import {ADMIN_IMG_URL} from '../../../util';

import {User} from '../../../model/user.model';

import {FileService} from '../../../service/file.service';
import {UserService} from '../../../service/user.service';

@Component({
selector: 'app-admin-header',
templateUrl: 'header.component.html',
styleUrls: ['header.component.css']
templateUrl: 'header.component.html'
})
export class HeaderComponent implements OnInit {

public imgLogo = IMG_URL + "logo.png";
imgLogo = ADMIN_IMG_URL + 'logo.png';
user: User;
userImage: any;

constructor() { }
constructor(private fileService: FileService, private sanitizer: DomSanitizer, private userService: UserService) { }

ngOnInit() {
console.log(Number(localStorage.getItem('id')));
this.userService.getUser(Number(localStorage.getItem('id'))).subscribe(
user => this.user = user,
error => console.log("Fail trying to get user information.")
);
this.fileService.getUserFile(Number(localStorage.getItem('id'))).subscribe(
data => {
let dataRecieved: string[] = data.split('"');
this.userImage = 'data:image/png;base64,' + dataRecieved[3];
},
error => console.log("Fail trying to charge " + this.user.name + " image.")
);
}

}
Loading

0 comments on commit ec0365e

Please sign in to comment.