diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 04e45e5..b7290b3 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -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 diff --git a/backend/target/classes/META-INF/MANIFEST.MF b/backend/target/classes/META-INF/MANIFEST.MF index 7e36d92..0043377 100644 --- a/backend/target/classes/META-INF/MANIFEST.MF +++ b/backend/target/classes/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Implementation-Title: appSpring Implementation-Version: 0.0.1 -Built-By: c.vazquezlos +Built-By: jherel Implementation-Vendor-Id: es.urjc.daw Build-Jdk: 1.8.0_121 Implementation-URL: http://projects.spring.io/spring-boot/appSpring/ diff --git a/backend/target/classes/application.properties b/backend/target/classes/application.properties index 04e45e5..b7290b3 100644 --- a/backend/target/classes/application.properties +++ b/backend/target/classes/application.properties @@ -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 diff --git a/frontend/src/app/component/admin/admin.module.ts b/frontend/src/app/component/admin/admin.module.ts index 1b20954..2fa4ace 100644 --- a/frontend/src/app/component/admin/admin.module.ts +++ b/frontend/src/app/component/admin/admin.module.ts @@ -1,4 +1,5 @@ import { NgModule } from '@angular/core'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { CommonModule } from '@angular/common'; import { AdminComponent } from './admin.component'; @@ -16,7 +17,9 @@ import { DashboardComponent } from './dashboard/dashboard.component'; @NgModule({ imports: [ CommonModule, - AdminRoutingModule + AdminRoutingModule, + FormsModule, + ReactiveFormsModule ], declarations: [ AdminComponent, diff --git a/frontend/src/app/component/admin/manage-loans/manage-loans.component.html b/frontend/src/app/component/admin/manage-loans/manage-loans.component.html index 46deacc..0064c1c 100644 --- a/frontend/src/app/component/admin/manage-loans/manage-loans.component.html +++ b/frontend/src/app/component/admin/manage-loans/manage-loans.component.html @@ -1,3 +1,45 @@ -

- manage-loans works! -

+
+

Administración de préstamos Administra los préstamos de los recursos

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
IdentificadorUsuarioRecursoPeticiónPréstamoDevoluciónAdministrar
+ + + + + + + + + + + +
+ + + +
diff --git a/frontend/src/app/component/admin/manage-loans/manage-loans.component.ts b/frontend/src/app/component/admin/manage-loans/manage-loans.component.ts index 48a3c36..3a79347 100644 --- a/frontend/src/app/component/admin/manage-loans/manage-loans.component.ts +++ b/frontend/src/app/component/admin/manage-loans/manage-loans.component.ts @@ -1,15 +1,25 @@ import { Component, OnInit } from '@angular/core'; +import { ActionService } from 'app/service/action.service' + @Component({ - selector: 'app-manage-loans', templateUrl: './manage-loans.component.html', styleUrls: ['./manage-loans.component.css'] }) export class ManageLoansComponent implements OnInit { - constructor() { } + private loans: Object[] = []; - ngOnInit() { + constructor(private service: ActionService) { } + ngOnInit() { + this.service.getAllActions().subscribe( + loans => { + this.loans = loans; + console.log(this.loans); + }, + error => console.log(error) + ); + } } diff --git a/frontend/src/app/component/admin/manage-resources/edit/edit.component.1.html b/frontend/src/app/component/admin/manage-resources/edit/edit.component.1.html deleted file mode 100644 index 984e0f7..0000000 --- a/frontend/src/app/component/admin/manage-resources/edit/edit.component.1.html +++ /dev/null @@ -1,57 +0,0 @@ -
-

Administraión de recursosAdministra los libros o las revistas

-
- -
-
-
-

Editar {{ resource.title }}

-
-
-
-
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
-
-
-
-
-
-
diff --git a/frontend/src/app/component/admin/manage-resources/edit/edit.component.html b/frontend/src/app/component/admin/manage-resources/edit/edit.component.html index 14b689f..5f7038a 100644 --- a/frontend/src/app/component/admin/manage-resources/edit/edit.component.html +++ b/frontend/src/app/component/admin/manage-resources/edit/edit.component.html @@ -1,3 +1,59 @@

Administraión de recursosAdministra los libros o las revistas

+ +
+
+
+

Editar {{resource?.title}}

+
+
+
+
+
+
+ +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ +
+
--> +
+
+
+
+
diff --git a/frontend/src/app/component/admin/manage-resources/edit/edit.component.ts b/frontend/src/app/component/admin/manage-resources/edit/edit.component.ts index e277af3..e4103c4 100644 --- a/frontend/src/app/component/admin/manage-resources/edit/edit.component.ts +++ b/frontend/src/app/component/admin/manage-resources/edit/edit.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; import { Resource } from 'app/model/resource.model'; - import { ResourceService } from 'app/service/resource.service'; @Component({ @@ -14,21 +13,22 @@ export class EditResourceComponent implements OnInit { private resource: Resource; constructor(private router: Router, - activatedRoute: ActivatedRoute, service: ResourceService) { - let id = activatedRoute.snapshot.params['id']; + private activatedRoute: ActivatedRoute, + private service: ResourceService) { + } - service.getResource(id).subscribe( - resource => this.resource = resource, - error => console.error(error) + ngOnInit() { + let id = this.activatedRoute.snapshot.params['id']; + this.service.getResource(id).subscribe( + resource => { + this.resource = resource; + }, + error => console.log(error) ); - console.log(this.resource); } - ngOnInit() { } - gotoResources() { this.router.navigate(['/resources']); } saveResource() { } - } diff --git a/frontend/src/app/component/admin/manage-resources/manage-resources.component.html b/frontend/src/app/component/admin/manage-resources/manage-resources.component.html index a4c0c34..5d04ab7 100644 --- a/frontend/src/app/component/admin/manage-resources/manage-resources.component.html +++ b/frontend/src/app/component/admin/manage-resources/manage-resources.component.html @@ -26,7 +26,7 @@

Administración de recursos Administra los libros o las revistas{{ resource.genre.name }} {{ resource.resourceType.name }} - + diff --git a/frontend/src/app/component/admin/manage-resources/manage-resources.component.ts b/frontend/src/app/component/admin/manage-resources/manage-resources.component.ts index 7e23425..c0de606 100644 --- a/frontend/src/app/component/admin/manage-resources/manage-resources.component.ts +++ b/frontend/src/app/component/admin/manage-resources/manage-resources.component.ts @@ -1,8 +1,8 @@ import { Component, OnInit } from '@angular/core'; -import { Http } from '@angular/http'; + +import { ResourceService } from 'app/service/resource.service'; @Component({ - selector: 'app-manage-resources', templateUrl: './manage-resources.component.html', styleUrls: ['./manage-resources.component.css'] }) @@ -10,26 +10,15 @@ export class ManageResourcesComponent implements OnInit { private resources: Object[] = []; - constructor(private http: Http) { + constructor(private service: ResourceService) { } ngOnInit() { - this.getResources(); - } - - getResources() { - this.resources = []; - let url = "https://localhost:8443/api/resources"; - - this.http.get(url).subscribe( - response => { - let data = response.json().content; - data.forEach(element => { - this.resources.push(element); - }); + this.service.getAllResources().subscribe( + resources => { + this.resources = resources; }, - error => console.error(error) + error => console.log(error) ); } - } diff --git a/frontend/src/app/service/action.service.ts b/frontend/src/app/service/action.service.ts index 564e0ee..5b96f7f 100644 --- a/frontend/src/app/service/action.service.ts +++ b/frontend/src/app/service/action.service.ts @@ -16,11 +16,12 @@ export class ActionService { this.authCreds = authCreds; } - getAllActions(page: number, finished: boolean) { - + getAllActions(page?: number, finished?: boolean) { let headers: Headers = new Headers(); headers.append('Authorization', 'Basic ' + this.authCreds); - return this.http.get(ACTION_URL + '?page=' + page + '&finished=' + finished, {headers: headers}) + + let url = (page && finished) ? ACTION_URL + '?page=' + page + '&finished=' + finished : ACTION_URL; + return this.http.get(url, {headers: headers}) .map(response => response.json().content) .catch(error => Observable.throw('Server error')); } diff --git a/frontend/src/app/service/resource.service.ts b/frontend/src/app/service/resource.service.ts index e5607f8..13df1c3 100644 --- a/frontend/src/app/service/resource.service.ts +++ b/frontend/src/app/service/resource.service.ts @@ -16,15 +16,16 @@ export class ResourceService { .catch(error => Observable.throw('Server error')) } - getAllResources(type: string, page: number) { - return this.http.get(RESOURCES_URL + '?type=' + type + '&page=' + page) + getAllResources(type?: string, page?: number) { + let url = (type && page) ? RESOURCES_URL + '?type=' + type + '&page=' + page : RESOURCES_URL; + return this.http.get(url) .map(response => response.json().content) .catch(error => Observable.throw('Server error')); } - searchResources(name: string, page: number){ - return this.http.get(RESOURCES_URL + '?name=' + name + '&page=' + page) - .map(response => response.json().content) - .catch(error => Observable.throw('Server error')); - } + searchResources(name: string, page: number) { + return this.http.get(RESOURCES_URL + '?name=' + name + '&page=' + page) + .map(response => response.json().content) + .catch(error => Observable.throw('Server error')); + } }