-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #327 from SharebookBR/develop
Promote develop to master
- Loading branch information
Showing
27 changed files
with
828 additions
and
209 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
3 changes: 3 additions & 0 deletions
3
src/app/components/book/donor-modal/donor-modal.component.css
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 @@ | ||
section { | ||
text-align: center; | ||
} |
34 changes: 34 additions & 0 deletions
34
src/app/components/book/donor-modal/donor-modal.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,34 @@ | ||
<div class="modal-header"> | ||
<h4 class="modal-title">Informações do doador do livro: <br> {{ bookTitle }}</h4> | ||
|
||
<button type="button" class="close" aria-label="Close" (click)="activeModal.dismiss('Cross click')"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
|
||
<div class="modal-body"> | ||
|
||
<section class="card-body"> | ||
|
||
<div [hidden]="!loading"> | ||
<div class="text-center"><em class="fa fa-spinner fa-spin"></em> Aguarde...</div> | ||
</div> | ||
|
||
<ng-container *ngIf="messageBody !== ''"> | ||
<h5 class="card-title">{{messageBody}}</h5> | ||
</ng-container> | ||
|
||
<ng-container *ngIf="(userInfo$ | async)?.donor as donor"> | ||
<h5 class="card-title">Doador</h5> | ||
<p class="card-text">Nome: {{ donor.name }}</p> | ||
<p class="card-text">E-mail: {{ donor.email }}</p> | ||
<p class="card-text">LinkedIn: {{ donor.linkedin }}</p> | ||
<p class="card-text">Telefone: {{ donor.phone }}</p> | ||
</ng-container> | ||
|
||
</section> | ||
</div> | ||
|
||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-outline-dark" (click)="activeModal.dismiss('Cross click')">Cancelar</button> | ||
</div> |
25 changes: 25 additions & 0 deletions
25
src/app/components/book/donor-modal/donor-modal.component.spec.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,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { DonorModalComponent } from './donor-modal.component'; | ||
|
||
describe('DonorModalComponent', () => { | ||
let component: DonorModalComponent; | ||
let fixture: ComponentFixture<DonorModalComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ DonorModalComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(DonorModalComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
44 changes: 44 additions & 0 deletions
44
src/app/components/book/donor-modal/donor-modal.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,44 @@ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { Observable } from 'rxjs'; | ||
import { map } from 'rxjs/operators'; | ||
|
||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; | ||
|
||
import { BookService } from 'src/app/core/services/book/book.service'; | ||
import { UserInfoBook } from 'src/app/core/models/UserInfoBook'; | ||
|
||
@Component({ | ||
selector: 'app-donor-modal', | ||
templateUrl: './donor-modal.component.html', | ||
styleUrls: ['./donor-modal.component.css'] | ||
}) | ||
export class DonorModalComponent implements OnInit { | ||
@Input() bookId; | ||
@Input() bookTitle; | ||
@Input() messageBody; | ||
loading: boolean; | ||
|
||
userInfo$: Observable<UserInfoBook>; | ||
|
||
constructor(public activeModal: NgbActiveModal, | ||
private readonly _bookService: BookService) { } | ||
|
||
ngOnInit() { | ||
this.loading = true; | ||
if (this.messageBody === '') { | ||
this.getDonor(); | ||
} else { | ||
this.loading = false; | ||
} | ||
} | ||
|
||
private getDonor() { | ||
|
||
this.userInfo$ = this._bookService.getMainUsers(this.bookId).pipe( | ||
map(userInfo => { | ||
this.loading = false; | ||
return userInfo; | ||
}) | ||
); | ||
} | ||
} |
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
11 changes: 7 additions & 4 deletions
11
src/app/components/book/requesteds/requesteds.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,13 +1,16 @@ | ||
<div class="container"> | ||
<h1 class="text-center display-4">Meus Pedidos</h1> | ||
<div [hidden]="!isLoading"> | ||
|
||
<ng-template #loading> | ||
<i class="fa fa-spinner fa-spin" style="position: absolute; left: 50%;"></i> | ||
</div> | ||
<div class="container mt-5 table-responsive" [hidden]="isLoading"> | ||
<ng2-smart-table [settings]="tableSettings" [source]="requestedBooks"></ng2-smart-table> | ||
</ng-template> | ||
|
||
<div class="container mt-5 table-responsive" *ngIf="(requestedBooks$ | async)?.items as items; else loading"> | ||
<ng2-smart-table [settings]="tableSettings" [source]="items" (custom)="onCustomActionColum($event)"> | ||
</ng2-smart-table> | ||
<p class="mt-2"> | ||
<a routerLink="/panel" class="btn btn-link">Voltar</a> | ||
</p> | ||
</div> | ||
|
||
</div> |
Oops, something went wrong.