Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Show "Free" instead of $0.00 in ticket price #5369

Merged
merged 8 commits into from
Nov 1, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/components/orders/ticket-price.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import classic from 'ember-classic-decorator';
import Component from '@ember/component';

@classic
export default class TicketPrice extends Component {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need of this file, please remove it

14 changes: 12 additions & 2 deletions app/templates/components/orders/order-summary.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@
{{ticket.name}}
</div>
</td>
<td>{{currency-symbol this.eventCurrency}} {{format-money ticket.price}}</td>
<td>
<Orders::TicketPrice
@ticket-type={{ticket.type}}
@display-symbol={{currency-symbol this.eventCurrency}}
@display-price={{format-money ticket.price}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simply pass the ticket. What's the point of creating a component if you'll be doing all calculations here

/>
</td>
{{#if this.data.discountCode}}
<td>{{currency-symbol this.eventCurrency}} {{format-money ticket.discount}}</td>
{{/if}}
Expand All @@ -107,7 +113,11 @@
</td>
{{/if}}
<td>
{{currency-symbol this.eventCurrency}} {{format-money (mult (sub ticket.price ticket.discount) (ticket-attendees this.data.attendees ticket.attendees))}}
<Orders::TicketPrice
@ticket-type={{ticket.type}}
@display-symbol={{currency-symbol this.eventCurrency}}
@display-price={{format-money (mult (sub ticket.price ticket.discount) (ticket-attendees this.data.attendees ticket.attendees))}}
/>
</td>
{{/if}}

Expand Down
5 changes: 5 additions & 0 deletions app/templates/components/orders/ticket-price.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{#if (eq ticket-type 'free')}}
{{t "Free"}}
{{else}}
{{display-symbol}} {{display-price}}
{{/if}}
12 changes: 10 additions & 2 deletions app/templates/components/public/ticket-list.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@
</div>
{{else}}
<div class="{{if ticket.discount 'strike text'}}">
{{currency-symbol this.eventCurrency}} {{format-money ticket.price}}
<Orders::TicketPrice
@ticket-type={{ticket.type}}
@display-symbol={{currency-symbol this.eventCurrency}}
@display-price={{format-money ticket.price}}
/>
</div>
{{#if ticket.discount}}
<div>
Expand Down Expand Up @@ -96,7 +100,11 @@
</div>
</td>
<td id='{{ticket.id}}_subtotal' class="ui right aligned">
{{currency-symbol this.eventCurrency}} {{format-money ticket.subTotal}}
<Orders::TicketPrice
@ticket-type={{ticket.type}}
@display-symbol={{currency-symbol this.eventCurrency}}
@display-price={{format-money ticket.subTotal}}
/>
</td>
</tr>
{{/unless}}
Expand Down