Skip to content

Commit

Permalink
Merge pull request #218 from wantero/master
Browse files Browse the repository at this point in the history
Resolução das Issues #215 e #216 e outras melhorias
  • Loading branch information
raffacabofrio authored Apr 4, 2019
2 parents 16eeae5 + 0b46f33 commit 3e888b3
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 56 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@angular/platform-browser": "~7.2.0",
"@angular/platform-browser-dynamic": "~7.2.0",
"@angular/router": "~7.2.0",
"@ng-bootstrap/ng-bootstrap": "^4.1.0",
"@ng-bootstrap/ng-bootstrap": "^4.1.1",
"base64-img": "^1.0.4",
"core-js": "^2.5.4",
"moment-timezone": "^0.5.21",
Expand Down
60 changes: 32 additions & 28 deletions src/app/components/book/details/details.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,40 @@ <h1 class="text-center display-4">{{pageTitle}}</h1>
<i class="fa fa-spinner fa-spin"></i> Aguarde...
</div>

<div class="form-row" *ngIf="state == 'ready'">
<div class="col-3">
<img [src]="bookInfo.imageBytes?.length
? 'data:image/png;base64,' + bookInfo.imageBytes
: bookInfo.imageUrl ? bookInfo.imageUrl : 'assets/img/img-placeholder.png'"
class="img-thumbnail"
/>
<div class="container" *ngIf="state == 'ready'">
<div class="form-row">
<div class="form-group col-lg-4">
<img [src]="bookInfo.imageBytes?.length
? 'data:image/png;base64,' + bookInfo.imageBytes
: bookInfo.imageUrl ? bookInfo.imageUrl : 'assets/img/img-placeholder.png'"
class="img-thumbnail"
/>
</div>
<div class="form-group col-lg-8">
<p><b>Título:</b><br/>{{bookInfo.title}}</p>
<p><b>Autor:</b><br/>{{bookInfo.author}}</p>
<p><b>Categoria:</b><br/>{{bookInfo.category?.name}}</p>
<p *ngIf="!!bookInfo.synopsis" style="white-space: pre-wrap;"><b>Sinópse:</b><br/>{{bookInfo.synopsis}}</p>
<p *ngIf="available"><b>Quando será anunciado o ganhador desse livro?</b><br/>{{chooseDateInfo}}</p>
<p><b>Local de Origem</b><br/>{{bookInfo.user.address.city}} - {{bookInfo.user.address.state}}</p>
<p *ngIf="available && userProfile"><b>Frete grátis?</b><br/>{{isFreeFreight ? 'Sim' : 'Não'}}</p>
<div class="custom-control custom-checkbox" *ngIf="available && userProfile && !requested && !isFreeFreight ">
<input type="checkbox" class="custom-control-input" id="checkFreight" [(ngModel)]="isCheckedFreight">
<label class="custom-control-label" for="checkFreight">Estou ciente que o frete não é grátis. Caso seja escolhido, me comprometo a reembolsar o doador.</label>
</div>
</div>
</div>
<div class="col">
<p><b>Título:</b><br/>{{bookInfo.title}}</p>
<p><b>Autor:</b><br/>{{bookInfo.author}}</p>
<p><b>Categoria:</b><br/>{{bookInfo.category?.name}}</p>
<p *ngIf="!!bookInfo.synopsis" style="white-space: pre-wrap;"><b>Sinópse:</b><br/>{{bookInfo.synopsis}}</p>
<p><b>Quando será anunciado o ganhador desse livro?</b><br/>{{chooseDateInfo}}</p>
<p><b>Local de Origem</b><br/>{{bookInfo.user.address.city}} - {{bookInfo.user.address.state}}</p>
<p *ngIf="available && userProfile"><b>Frete grátis?</b><br/>{{isFreeFreight ? 'Sim' : 'Não'}}</p>
<div class="custom-control custom-checkbox" *ngIf="available && userProfile && !requested && !isFreeFreight ">
<input type="checkbox" class="custom-control-input" id="checkFreight" [(ngModel)]="isCheckedFreight">
<label class="custom-control-label" for="checkFreight">Estou ciente que o frete não é grátis. Caso seja escolhido, me comprometo a reembolsar o doador.</label>
</div>
<div class="form-group col-md-8">
<div class='form-row'>
<div class="form-group col-lg-12">
<div class="modal-footer">
<span class="badge badge-success mr-auto" *ngIf="requested">Você já solicitou. Aguarde e boa sorte!</span>

<span class="badge badge-danger mr-auto" *ngIf="!requested && !available">Não disponível.</span>
<input type="button" *ngIf="available && userProfile && !requested" class="btn btn-primary" value="Tenho interesse" style="padding-left: 50px; padding-right: 50px" (click)="onRequestBook()" [disabled]="!isFreeFreight && !isCheckedFreight">
<input type="button" *ngIf="available && !userProfile" class="btn btn-primary" value="Faça login para solicitar o livro" style="padding-left: 50px; padding-right: 50px" (click)="onLoginBook()">
<a [routerLink]="['/home']" class="btn btn-link" id="cancelButton">Cancelar</a>
<span class="badge badge-success" *ngIf="requested">Você já solicitou. Aguarde e boa sorte!</span>
<span class="badge badge-danger" *ngIf="!requested && !available">Não disponível.</span>

<input type="button" *ngIf="available && userProfile && !requested" class="btn btn-primary" value="Tenho interesse" (click)="onRequestBook()" [disabled]="!isFreeFreight && !isCheckedFreight">

<input type="button" *ngIf="available && !userProfile" class="btn btn-primary" value="Faça login para solicitar o livro" (click)="onLoginBook()">
<a [routerLink]="['/home']" class="btn btn-link" id="cancelButton">Cancelar</a>
</div>
</div>
</div>
Expand Down
18 changes: 10 additions & 8 deletions src/app/components/book/form/form.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,21 @@ <h1 class="text-center display-4">{{pageTitle}}</h1>
</div>
</div>

<div class="form-group col-md-8">

<ng-template #popContent>
<ng-template #popContent>
<p>Sabia que com o <b>registro módico</b> o envio de livros para todo Brasil fica baratinho? Em média apenas dez reais.</p>
<p>Mais detalhes, <a href="https://www.linkedin.com/feed/update/urn:li:activity:6447871003954540544" target="_blank">clique aqui.</a></p>
</ng-template>
<p>Mais detalhes,
<a href="https://www.linkedin.com/feed/update/urn:li:activity:6447871003954540544" target="_blank">clique aqui.</a></p>
</ng-template>

<div class="form-group col-md-8">

<label class="col-form-label" for="freightOption">Vc pagaria o frete? ❤️</label>
<div class="btn-group btn-block btn-group-toggle" data-toggle="buttons" #p="ngbPopover" placement="top" [ngbPopover]="popContent" triggers="manual" popoverTitle="Espere! 🙏" (click)="showFreightPopover(p)">
<div class="btn-group btn-block btn-group-toggle" data-toggle="buttons">
<label *ngFor="let option of freightOptions" [ngClass]="(formGroup.value.freightOption === option.value)
? 'btn btn-outline-secondary form-control active'
: 'btn btn-outline-secondary form-control'" (click)="onChangeFieldFreightOption(option.value)">
<input type="radio" name="freightOption" formControlName="freightOption" (blur)="p.close()"> {{option.text}}
: 'btn btn-outline-secondary form-control'" (click)="onChangeFieldFreightOption(option.value, p)"
#p="ngbPopover" placement="top" [autoClose]="'outside'" [ngbPopover]="popContent" triggers="manual" popoverTitle="Espere! 🙏">
<input type="radio" name="freightOption" formControlName="freightOption"> {{option.text}}
</label>
</div>

Expand Down
17 changes: 7 additions & 10 deletions src/app/components/book/form/form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,14 @@ export class FormComponent implements OnInit {
}
}

onChangeFieldFreightOption(freightOption: string) {
onChangeFieldFreightOption(freightOption: string, p) {
this.formGroup.controls['freightOption'].setValue(freightOption);

if (freightOption === 'WithoutFreight') {
p.open();
} else {
p.close();
}
}

onChangeFieldApproved(approved: boolean) {
Expand Down Expand Up @@ -212,15 +218,6 @@ export class FormComponent implements OnInit {
}
}

showFreightPopover(p) {
const freight = this.formGroup.controls['freightOption'].value;
if (freight === 'WithoutFreight') {
p.open();
} else {
p.close();
}
}

getAllFacilitators() {
this._scUser.getAllFacilitators(this.formGroup.get('userId').value).subscribe(data =>
this.facilitators = data
Expand Down
1 change: 1 addition & 0 deletions src/app/components/card-book/card-book.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
.card {
max-height: 330px;
min-height: 330px;
margin-bottom: 10px;
}

.card:hover {
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/card-book/card-book.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<img [src]="content.imageUrl" class="card-img-top" alt="Imagem do livro {{ content.title }}">
<div class="card-body">
<h5 class="card-title">{{ content.title }}</h5>
<!-- <p class="card-text">{{ content.synopsis }}</p> -->
<p class="{{isApprovedBadge}}">{{ isApprovedText }}</p>
</div>
</div>
15 changes: 13 additions & 2 deletions src/app/components/card-book/card-book.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, OnInit, Input } from '@angular/core';
import { Content } from '@angular/compiler/src/render3/r3_ast';

@Component({
selector: 'app-card-book',
Expand All @@ -7,12 +8,22 @@ import { Component, OnInit, Input } from '@angular/core';
})
export class CardBookComponent implements OnInit {

@Input()
public content: any;
@Input() content: any;

public isApprovedBadge: string;
public isApprovedText: string;

constructor() { }

ngOnInit() {

if ( this.content.approved ) {
this.isApprovedBadge = 'badge badge-success mr-auto';
this.isApprovedText = 'Disponível';
} else {
this.isApprovedBadge = 'badge badge-danger mr-auto';
this.isApprovedText = 'Não Disponível';
}
}

}
14 changes: 11 additions & 3 deletions src/app/core/services/contributors/contributors.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,19 @@ export class ContributorsService {
]
},
{
image: 'assets/img/top_contributors/rodrigo-barreto.jpg',
name: 'Rodrigo Barreto',
image: 'assets/img/top_contributors/montanha.jpg',
name: 'Roberto Montanha',
position: 'Facilitador',
links: [
{url: 'https://www.linkedin.com/in/rcbarreto/', content: 'Linkedin'}
{url: 'https://www.linkedin.com/in/robertomontanha/', content: 'Linkedin'}
]
},
{
image: 'assets/img/top_contributors/manoel-jr.jpg',
name: 'Manoel Júnior',
position: 'Facilitador',
links: [
{url: 'https://www.linkedin.com/in/msjunior/', content: 'Linkedin'}
]
},
{
Expand Down
Binary file added src/assets/img/top_contributors/manoel-jr.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/img/top_contributors/montanha.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@
<meta name="generator" content="Angular">
<meta name="author" content="ShareBook"/>
<meta name="copyright" content="© 2018 ShareBook"/>
<meta name="description" content="Sharebook é um projeto colaborativo de código aberto que é apoiado por muitos contribuidores. Você pode ser um deles. Vem pro time! Conheça alguns dos maiores contribuidores do projeto.">
<meta name="description" content="Sharebook é um projeto social. Um app livre e gratuito para ajudar as pessoas a doar ou ganhar livros. Doe um único livro para você sentir a experiência. Do início ao fim. Nossos usuários tem relatado que é emocionante. Apesar de ser no anonimato você se envolve com muitas histórias incríveis. Você não faz ideia de como tem pessoas que realmente precisam. E da força transformadora que um simples livro causa na vida de uma pessoa. E que você ao escolher um ganhador, passa a fazer parte dessa história.">
<meta name="keywords" content="ShareBook, Doe, Doar, Ganhe, Livros, Book,.Net core 2.x, C#, SQL Server, Web api, Angular, ionic">

<!-- Twitter Card tags -->
<meta name="twitter:card" content="Sharebook"/>
<meta name="twitter:site" content="@sharebook"/>
<meta name="twitter:title" content="ShareBook - Doe ou ganhe livros."/>
<meta name="twitter:description" content="Sharebook é um projeto colaborativo de código aberto que é apoiado por muitos contribuidores. Você pode ser um deles. Vem pro time! Conheça alguns dos maiores contribuidores do projeto."/>
<meta name="twitter:description" content="Sharebook é um projeto social. Um app livre e gratuito para ajudar as pessoas a doar ou ganhar livros. Doe um único livro para você sentir a experiência. Do início ao fim. Nossos usuários tem relatado que é emocionante. Apesar de ser no anonimato você se envolve com muitas histórias incríveis. Você não faz ideia de como tem pessoas que realmente precisam. E da força transformadora que um simples livro causa na vida de uma pessoa. E que você ao escolher um ganhador, passa a fazer parte dessa história."/>
<meta name="twitter:image" content="https://www.sharebook.com.br/assets/img/sharebook-share.png"/>

<!-- Facebook meta tags -->
<meta property="og:site_name" content="ShareBook"/>
<meta property="og:url" content="https://sharebook.com.br"/>
<meta property="og:type" content="article"/>
<meta property="og:title" content="ShareBook - Doe ou ganhe livros."/>
<meta property="og:description" content="Sharebook é um projeto colaborativo de código aberto que é apoiado por muitos contribuidores. Você pode ser um deles. Vem pro time! Conheça alguns dos maiores contribuidores do projeto."/>
<meta property="og:description" content="Sharebook é um projeto social. Um app livre e gratuito para ajudar as pessoas a doar ou ganhar livros. Doe um único livro para você sentir a experiência. Do início ao fim. Nossos usuários tem relatado que é emocionante. Apesar de ser no anonimato você se envolve com muitas histórias incríveis. Você não faz ideia de como tem pessoas que realmente precisam. E da força transformadora que um simples livro causa na vida de uma pessoa. E que você ao escolher um ganhador, passa a fazer parte dessa história."/>
<meta property="og:image" content="https://www.sharebook.com.br/assets/img/sharebook-share.png"/>

<title>ShareBook - Doe ou ganhe livros.</title>
Expand Down

0 comments on commit 3e888b3

Please sign in to comment.