-
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.
Public and user private functionality finished.
- Loading branch information
1 parent
6a03435
commit 5bb3998
Showing
13 changed files
with
172 additions
and
31 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
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
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
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,9 +1,12 @@ | ||
import {ResourceCopy} from './resource-copy.model'; | ||
|
||
import {User} from './user.model'; | ||
|
||
export interface Action { | ||
id?: number; | ||
dateLoanInit: any; | ||
dateLoanGiven: any; | ||
dateLoanReturn: any; | ||
dateLoanInit?: any; | ||
dateLoanGiven?: any; | ||
dateLoanReturn?: any; | ||
copy: ResourceCopy; | ||
user: User; | ||
} |
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
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,47 @@ | ||
import {Injectable} from '@angular/core'; | ||
import {Headers, Http} from '@angular/http'; | ||
import 'rxjs/Rx'; | ||
import {Observable} from 'rxjs/Observable'; | ||
import {RESOURCECOPY_URL} from "../util"; | ||
|
||
import {ResourceCopy} from "../model/resource-copy.model"; | ||
|
||
@Injectable() | ||
export class ResourceCopyService { | ||
|
||
resourceCopy: ResourceCopy; | ||
resourceCopies: ResourceCopy[]; | ||
authCreds: string; | ||
|
||
constructor(private http: Http) { | ||
this.resourceCopies = []; | ||
} | ||
|
||
setAuthHeaders(authCreds: string) { | ||
this.authCreds = authCreds; | ||
} | ||
|
||
getResourceCopyByLocationCode(locationCode: string) { | ||
let page = 0; | ||
let morePages = true; | ||
let headers: Headers = new Headers(); | ||
headers.append('Authorization', 'Basic ' + this.authCreds); | ||
while (page <= 2) { | ||
this.http.get(RESOURCECOPY_URL + '?page=' + page, {headers: headers}) | ||
.map(response => response.json().content) | ||
.catch(error => Observable.throw('Server error') | ||
).subscribe( | ||
response => { | ||
this.resourceCopies = this.resourceCopies.concat(response); | ||
}, | ||
error => morePages = false | ||
); | ||
page++; | ||
} | ||
for(let copy of this.resourceCopies) { | ||
if (copy.locationCode === locationCode) | ||
return copy; | ||
} | ||
} | ||
|
||
} |
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
Oops, something went wrong.