Skip to content

Commit

Permalink
Ajuste da PR p/ ficar mais explicativa a variável
Browse files Browse the repository at this point in the history
  • Loading branch information
wantero committed Mar 21, 2019
1 parent e7999d5 commit 0a52818
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/app/components/book/details/details.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ <h1 class="text-center display-4">{{pageTitle}}</h1>
<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/>{{!freightAlert ? 'Sim' : 'Não'}}</p>
<div class="custom-control custom-checkbox" *ngIf="available && userProfile && !requested && !!freightAlert">
<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>
Expand All @@ -37,7 +37,7 @@ <h1 class="text-center display-4">{{pageTitle}}</h1>

<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]="!!freightAlert && !isCheckedFreight">
<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
15 changes: 5 additions & 10 deletions src/app/components/book/details/details.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ 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;
Expand Down Expand Up @@ -94,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 0a52818

Please sign in to comment.