Skip to content

Commit

Permalink
Merge pull request #207 from wantero/master
Browse files Browse the repository at this point in the history
 Melhoria no aviso de frete
  • Loading branch information
raffacabofrio authored Mar 21, 2019
2 parents 90847f0 + 0a52818 commit 99633be
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
15 changes: 9 additions & 6 deletions src/app/components/book/details/details.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,24 @@ <h1 class="text-center display-4">{{pageTitle}}</h1>
/>
</div>
<div class="col">
<p><b>Título do livro:</b><br/>{{bookInfo.title}}</p>
<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><b>Quando será anunciado o ganhador desse livro?</b><br/>{{chooseDateInfo}}</p>
<p><b>Doador paga o frete?</b><br/>{{freightName}}<b *ngIf="!!freightAlert"> ({{freightAlertMessage}})</b></p>
<p><b>Local de Origem</b><br/>{{bookInfo.user.address.city}} - {{bookInfo.user.address.state}}</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><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="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()">
<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>
Expand Down
16 changes: 6 additions & 10 deletions src/app/components/book/details/details.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ export class DetailsComponent implements OnInit {
bookInfo: Book = new Book();
categoryName: string;
freightName: string;
freightAlert: boolean;
freightAlertMessage: string;
isFreeFreight: boolean;
daysToChoose: number;
chooseDateInfo: string;
isCheckedFreight: boolean;

constructor(
private _scBook: BookService,
Expand Down Expand Up @@ -93,26 +93,22 @@ export class DetailsComponent implements OnInit {
switch (x.freightOption.toString()) {
case 'City': {
if (this.bookInfo.user.address.city !== this.myUser.address.city) {
this.freightAlert = true;
this.freightAlertMessage = 'O doador paga o frete somente para a cidade de origem';
this.isFreeFreight = false;
}
break;
}
case 'State': {
if (this.bookInfo.user.address.state !== this.myUser.address.state) {
this.freightAlert = true;
this.freightAlertMessage = 'O doador paga o frete somente para o estado de origem';
this.isFreeFreight = false;
}
break;
}
case 'WithoutFreight': {
this.freightAlert = true;
this.freightAlertMessage = 'O doador NÃO paga pelo frete';
this.isFreeFreight = false;
break;
}
default: {
this.freightAlert = false;
this.freightAlertMessage = '';
this.isFreeFreight = true;
}
}
}
Expand Down

0 comments on commit 99633be

Please sign in to comment.