-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/cvazquezlos/BREMS-Library-App …
…into dev
- Loading branch information
Showing
26 changed files
with
853 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
BIN
+1.06 KB
(110%)
backend/target/classes/appSpring/service/LogicService.class
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
} |
46 changes: 46 additions & 0 deletions
46
frontend/src/app/component/admin/manage-loans/create/create.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
82 changes: 82 additions & 0 deletions
82
frontend/src/app/component/admin/manage-loans/create/create.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.' | ||
} | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
table { | ||
background-color: white !important; | ||
} |
72 changes: 69 additions & 3 deletions
72
frontend/src/app/component/admin/manage-loans/manage-loans.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> 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> 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> 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> |
Oops, something went wrong.