Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into dev
  • Loading branch information
cvazquezlos committed Apr 22, 2017
2 parents d2e8086 + 2a323af commit 856353c
Show file tree
Hide file tree
Showing 26 changed files with 853 additions and 204 deletions.
2 changes: 1 addition & 1 deletion backend/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spring.h2.console.enabled=true

spring.datasource.url = jdbc:mysql://localhost/brems?verifyServerCertificate=false&useSSL=true
spring.datasource.username = root
spring.datasource.password = 1234
spring.datasource.password = root
spring.datasource.driverClassName = com.mysql.jdbc.Driver
spring.jpa.hibernate.ddl-auto = create-drop

Expand Down
11 changes: 11 additions & 0 deletions backend/target/classes/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Manifest-Version: 1.0
Implementation-Title: appSpring
Implementation-Version: 0.0.1
Built-By: jherel
Implementation-Vendor-Id: es.urjc.daw
Build-Jdk: 1.8.0_121
Implementation-URL: http://projects.spring.io/spring-boot/appSpring/
Created-By: Maven Integration for Eclipse
Implementation-Vendor: Pivotal Software, Inc.
Main-Class: appSpring.Application

Binary file modified backend/target/classes/appSpring/service/LogicService.class
Binary file not shown.
23 changes: 23 additions & 0 deletions backend/target/classes/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
server.port = 8443
server.ssl.key-store = classpath:keystore.jks
server.ssl.key-store-password = password
server.ssl.key-password = secret
spring.h2.console.enabled=true

spring.datasource.url = jdbc:mysql://localhost/brems?verifyServerCertificate=false&useSSL=true
spring.datasource.username = root
spring.datasource.password = root
spring.datasource.driverClassName = com.mysql.jdbc.Driver
spring.jpa.hibernate.ddl-auto = create-drop

spring.mail.host = smtp.gmail.com
spring.mail.port = 587
spring.mail.username = bremslibrerias@gmail.com
spring.mail.password = BrEmSbReMs7102

spring.mail.properties.mail.smtp.auth = true
spring.mail.properties.mail.smtp.socketFactory.port = 465
spring.mail.properties.mail.smtp.starttls.required = false
spring.mail.properties.mail.smtp.starttls.enable = true
spring.mail.properties.mail.smtp.socketFactory.class = javax.net.ssl.SSLSocketFactory
spring.mail.properties.mail.smtp.socketFactory.fallback = false
42 changes: 23 additions & 19 deletions frontend/src/app/component/admin/admin-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

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

import {DashboardComponent} from './dashboard/dashboard.component';
import { DashboardComponent } from './dashboard/dashboard.component';

import {ManageResourcesComponent} from './manage-resources/manage-resources.component';
import {EditResourceComponent} from './manage-resources/edit/edit.component';
import { ManageResourcesComponent } from './manage-resources/manage-resources.component';
import { EditResourceComponent } from './manage-resources/edit/edit.component';
import { CreateResourceComponent } from './manage-resources/create/create.component';

import {ManageLoansComponent} from './manage-loans/manage-loans.component';
import { ManageLoansComponent } from './manage-loans/manage-loans.component';
import { CreateLoanComponent } from './manage-loans/create/create.component';

import {ManageFinesComponent} from './manage-fines/manage-fines.component';
import { ManageFinesComponent } from './manage-fines/manage-fines.component';

import {CreateUserComponent} from './manage-users/create/create.component';
import {EditUserComponent} from './manage-users/edit/edit.component';
import {ManageUsersComponent} from './manage-users/manage-users.component';
import { CreateUserComponent } from './manage-users/create/create.component';
import { EditUserComponent } from './manage-users/edit/edit.component';
import { ManageUsersComponent } from './manage-users/manage-users.component';


const adminRoutes: Routes = [
Expand All @@ -25,14 +27,16 @@ const adminRoutes: Routes = [
{
path: '',
children: [
{path: 'resources', component: ManageResourcesComponent},
{path: 'resource/:id', component: EditResourceComponent},
{path: 'loans', component: ManageLoansComponent},
{path: 'fines', component: ManageFinesComponent},
{path: 'users', component: ManageUsersComponent},
{path: 'users/new', component: CreateUserComponent},
{path: 'users/:id', component: EditUserComponent},
{path: '', component: DashboardComponent}
{ path: 'resources', component: ManageResourcesComponent },
{ path: 'resources/new', component: CreateResourceComponent },
{ path: 'resources/:id', component: EditResourceComponent },
{ path: 'loans', component: ManageLoansComponent },
{ path: 'loans/new', component: CreateLoanComponent },
{ path: 'fines', component: ManageFinesComponent },
{ path: 'users', component: ManageUsersComponent },
{ path: 'users/new', component: CreateUserComponent },
{ path: 'users/:id', component: EditUserComponent },
{ path: '', component: DashboardComponent }
]
}
]
Expand Down
76 changes: 41 additions & 35 deletions frontend/src/app/component/admin/admin.module.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,48 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
import {FormsModule} from '@angular/forms';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';

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

import {AdminRoutingModule} from './admin-routing.module';
import {HeaderComponent} from './header/header.component';
import {SidebarComponent} from './sidebar/sidebar.component';
import {ManageResourcesComponent} from './manage-resources/manage-resources.component';
import {EditResourceComponent} from './manage-resources/edit/edit.component';
import {EditUserComponent} from './manage-users/edit/edit.component';
import {ManageLoansComponent} from './manage-loans/manage-loans.component';
import {ManageFinesComponent} from './manage-fines/manage-fines.component';
import {CreateUserComponent} from './manage-users/create/create.component';
import {ManageUsersComponent} from './manage-users/manage-users.component';
import {DashboardComponent} from './dashboard/dashboard.component';
import { AdminRoutingModule } from './admin-routing.module';
import { HeaderComponent } from './header/header.component';
import { SidebarComponent } from './sidebar/sidebar.component';

import { ManageResourcesComponent } from './manage-resources/manage-resources.component';
import { EditResourceComponent } from './manage-resources/edit/edit.component';
import { CreateResourceComponent } from './manage-resources/create/create.component';

import { EditUserComponent } from './manage-users/edit/edit.component';
import { ManageLoansComponent } from './manage-loans/manage-loans.component';
import { CreateLoanComponent } from './manage-loans/create/create.component';
import { ManageFinesComponent } from './manage-fines/manage-fines.component';
import { CreateUserComponent } from './manage-users/create/create.component';
import { ManageUsersComponent } from './manage-users/manage-users.component';
import { DashboardComponent } from './dashboard/dashboard.component';

@NgModule({
imports: [
CommonModule,
AdminRoutingModule,
NgbModule,
FormsModule
],
declarations: [
AdminComponent,
HeaderComponent,
SidebarComponent,
ManageResourcesComponent,
EditResourceComponent,
ManageLoansComponent,
ManageFinesComponent,
CreateUserComponent,
EditUserComponent,
ManageUsersComponent,
DashboardComponent
]
imports: [
CommonModule,
AdminRoutingModule,
FormsModule,
ReactiveFormsModule
],
declarations: [
AdminComponent,
HeaderComponent,
SidebarComponent,
DashboardComponent,
ManageResourcesComponent,
EditResourceComponent,
ManageLoansComponent,
CreateLoanComponent,
ManageFinesComponent,
ManageUsersComponent,
CreateUserComponent,
EditUserComponent,
CreateResourceComponent
]
})
export class AdminModule {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<div *ngIf="errorMessage" class="alert alert-danger">
<strong>Algo ha ido mal...</strong> {{message}}
</div>

<section class="content-header">
<h1>Administración de préstamos <small>Administra los préstamos de los recursos</small></h1>
<ol class="breadcrumb">
<li><a [routerLink]="['/admin']"><i class="fa fa-dashboard"></i> Inicio</a></li>
<li><a [routerLink]="['/admin/loans']">Préstamo</a></li>
<li class="active">Añadir préstamo</li>
</ol>
</section>

<section class="content">
<div class="box box-default">
<div class="box-header with-border">
<h3 class="box-title">Nuevo préstamo</h3>
</div>
<div class="box-body">
<div class="row">
<div class="col-lg-8">
<div class="form-group">
<label>Recursos disponibles a prestar</label>
<br>
<select [(ngModel)]="resourceSelect">
<ng-template ngFor let-resource [ngForOf]="resources">
<option *ngIf="resource.noReservedCopies.length > 0" [ngValue]="resource">{{resource.title}}</option>
</ng-template>
</select>
</div>
<div class="form-group">
<label>Usuario</label>
<br>
<select [(ngModel)]="userSelect">
<option *ngFor="let user of users" [ngValue]="user">{{user.name}}</option>
</select>
</div>
<br>
<div class="pull-left">
<input type="submit" class="btn btn-success" (click)="createLoan()">
</div>
</div>
</div>
</div>
</div>
</section>
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs/Observable';

import { Action } from 'app/model/action.model';
import { User } from 'app/model/user.model';
import { Resource } from 'app/model/resource.model';
import { ResourceCopy } from 'app/model/resource-copy.model';

import { SessionService } from 'app/service/session.service';
import { ActionService } from 'app/service/action.service';
import { UserService } from 'app/service/user.service';
import { ResourceService } from 'app/service/resource.service';

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

loan: Action = null;
users: User[];
resources: Resource[];

userSelect: User = null;
resourceSelect: Resource = null;

errorMessage: boolean;
message: String;

constructor(private router: Router,
private activatedRoute: ActivatedRoute,
private sessionService: SessionService,
private actionService: ActionService,
private userService: UserService,
private resourceService: ResourceService) {
this.errorMessage = false;

}

ngOnInit() {
if (!this.sessionService.checkCredentials()) {
this.router.navigate(["/login"]);
} else {
this.userService.getUsers().subscribe(
users => this.users = users,
error => console.log(error)
);
this.resourceService.getAllResources().subscribe(
resources => this.resources = resources,
error => console.log(error)
);
}
}

createLoan() {
let copy: ResourceCopy;

if (this.resourceSelect.noReservedCopies.length != 0) {
copy = this.resourceSelect.copies.find(x => x.locationCode == this.resourceSelect.noReservedCopies[0]);
copy.resource = {
id: this.resourceSelect.id,
title: this.resourceSelect.title,
author: this.resourceSelect.author,
editorial: this.resourceSelect.editorial,
avaiblereserve: this.resourceSelect.avaiblereserve,
description: this.resourceSelect.description,
hasPhoto: this.resourceSelect.hasPhoto,
noReservedCopies: this.resourceSelect.noReservedCopies
};

this.loan = { copy: copy, user: this.userSelect };

this.actionService.postAction(this.loan).subscribe(
response => this.router.navigate(["/admin/loans"]),
error => {
this.errorMessage = true;
this.message = 'No se ha podido realizar la acción.'
}
);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
table {
background-color: white !important;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,69 @@
<p>
manage-loans works!
</p>
<div *ngIf="successMessage" class="alert alert-success">
<strong>¡Eliminado!</strong> {{message}}
</div>
<div *ngIf="errorMessage" class="alert alert-danger">
<strong>Algo ha ido mal...</strong> {{message}}
</div>

<section class="content-header">
<h1>Administración de préstamos <small>Administra los préstamos de los recursos</small></h1>
<ol class="breadcrumb">
<li><a [routerLink]="['/admin']"><i class="fa fa-dashboard"></i> Inicio</a></li>
<li class="active">Prestamos</li>
</ol>
</section>

<section class="content">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th width="10%">Identificador</th>
<th width="15%">Usuario</th>
<th>Recurso</th>
<th>Petición</th>
<th>Préstamo</th>
<th>Devolución</th>
<th>Administrar</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let loan of loans">
<td>{{ loan.copy.locationCode }}</td>
<td>{{ loan.user.name }}</td>
<td>{{ loan.copy.resource.title }}</td>
<td>{{ loan.dateLoanInit }}</td>
<td>
<div *ngIf="loan.dateLoanGiven != null ; else elseBlockLoanGiven">{{ loan.dateLoanGiven }}</div>
<ng-template #elseBlockLoanGiven>
<button type="button" class="btn btn-primary" (click)="updateLoan(loan.id, 'give')"><span class="fa fa-bookmark-o"></span> &nbsp; Prestar</button>
</ng-template>
</td>
<td>
<div *ngIf="loan.dateLoanReturn != null ; else elseBlockLoanReturn">{{ loan.dateLoanReturn }}</div>
<ng-template #elseBlockLoanReturn>
<button type="button" class="btn btn-primary" (click)="updateLoan(loan.id, 'return')"><span class="fa fa-bookmark"></span> &nbsp; Devolución</button>
</ng-template>
</td>
<td>
<button type="button" class="btn btn-warning" (click)="deleteLoan(loan.id)"><span class="fa fa-trash"></span></button>
</td>
</tr>
</tbody>
</table>

<div>
<div class="pull-left">
<a [routerLink]="['/admin/loans/new']">
<button type="button" class="btn btn-primary"><span class="fa fa-plus-circle"> </span>&nbsp;Añadir préstamo</button>
</a>
</div>
<div class="pull-right">
<button *ngIf="showPreviousPage" type="button" class="btn btn-primary" (click)="previousPage()">
<i class="fa fa-arrow-left" aria-hidden="true"></i>
</button>
<button *ngIf="showNextPage" type="button" class="btn btn-primary" (click)="nextPage()">
<i class="fa fa-arrow-right" aria-hidden="true"></i>
</button>
</div>
</div>
</section>
Loading

0 comments on commit 856353c

Please sign in to comment.