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: Hide currency when amount is 0 #5447

Merged
merged 11 commits into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
Changes from 7 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: 4 additions & 1 deletion app/helpers/currency-symbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { paymentCurrencies } from 'open-event-frontend/utils/dictionary/payment'

export function currencySymbol(params) {
const currency = find(paymentCurrencies, ['code', params[0]]);
return currency ? currency.symbol : params[0];
if(params[1])
divyamtayal marked this conversation as resolved.
Show resolved Hide resolved
return currency ? currency.symbol : params[0];
else
return null;
}

export default Helper.helper(currencySymbol);
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</tr>
<tr>
<td>{{t 'Sales (amount)'}}</td>
<td>{{currency-symbol this.data.event.paymentCurrency}} {{format-money this.sales}}</td>
<td>{{currency-symbol this.data.event.paymentCurrency this.sales}} {{format-money this.sales}}</td>
divyamtayal marked this conversation as resolved.
Show resolved Hide resolved
</tr>
</tbody>
</table>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/orders/ticket-price.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{#if (eq @ticket.type 'free')}}
{{t "Free"}}
{{else}}
{{currency-symbol @currency}} {{format-money @amount}}
{{currency-symbol @currency @amount}} {{format-money @amount}}
divyamtayal marked this conversation as resolved.
Show resolved Hide resolved
{{/if}}
4 changes: 2 additions & 2 deletions app/templates/components/public/ticket-list.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@
{{/if}}
<tr><td>{{t 'Total'}}</td>
{{#if this.amountEditable}}
<td>{{currency-symbol this.eventCurrency}}</td> <td><Input @value={{this.overridenAmount}} placeholder="Total" /></td>
<td>{{currency-symbol this.eventCurrency this.overridenAmount}}</td> <td><Input @value={{this.overridenAmount}} placeholder="Total" /></td>
{{else}}
<td>{{currency-symbol this.eventCurrency}} {{format-money this.orderAmount.total}}</td>
<td>{{currency-symbol this.eventCurrency this.orderAmount.total}} {{format-money this.orderAmount.total}}</td>
{{/if}}
</tr>
</tbody>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="weight-400">
{{currency-symbol this.extraRecords.event.paymentCurrency}} {{format-money this.record}}
{{currency-symbol this.extraRecords.event.paymentCurrency this.record}} {{format-money this.record}}
</div>
{{#if this.extraRecords.discountCode.code}}
<div class="ui mini yellow label">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{{#if (eq this.extraRecords.type 'percent')}}
{{this.record}} %
{{else if (eq this.extraRecords.type 'amount')}}
{{this.currency-symbol this.extraRecords.event.paymentCurrency}}{{this.record}}
{{currency-symbol this.extraRecords.event.paymentCurrency this.record}} {{this.record}}
{{/if}}
</span>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="weight-400">
{{currency-symbol this.extraRecords.event.paymentCurrency}} {{format-money this.record}}
{{currency-symbol this.extraRecords.event.paymentCurrency this.record}} {{format-money this.record}}
</div>
{{#if this.extraRecords.discountCode.code}}
<div class="ui mini yellow label">
Expand Down
10 changes: 5 additions & 5 deletions app/templates/events/view/tickets/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</div>
<div class="ui {{if this.device.isMobile 'horizontal'}} three statistics">
<div class="statistic"><div class="value">{{this.totalOrders}}</div><div class="label">{{t 'Orders'}}</div></div>
<div class="statistic"><div class="value">{{this.totalAmount}}</div><div class="label">{{t 'Sales'}}({{currency-symbol this.model.eventDetail.paymentCurrency}})</div></div>
<div class="statistic"><div class="value">{{this.totalAmount}}</div><div class="label">{{t 'Sales'}}({{currency-symbol this.model.eventDetail.paymentCurrency this.totalAmount}})</div></div>
<div class="statistic"><div class="value">{{this.totalSales}}</div><div class="label">{{t 'Tickets sold'}}</div></div>
</div>
</div>
Expand All @@ -22,7 +22,7 @@
<th>{{t 'Order Status'}}</th>
<th class="right aligned">{{t 'Total Tickets'}}</th>
<th class="right aligned">{{t 'Total Orders'}}</th>
<th class="right aligned">{{t 'Total Sales' }}({{currency-symbol this.model.eventDetail.paymentCurrency}}) </th>
<th class="right aligned">{{t 'Total Sales' }}({{currency-symbol this.model.eventDetail.paymentCurrency this.totalAmount}}) </th>
<th>{{t 'View Reports'}}</th>
</tr>
<tr>
Expand Down Expand Up @@ -144,15 +144,15 @@
{{#unless this.device.isMobile}}
<td class="right aligned">{{ticket.orderStatistics.tickets.completed}}</td>
{{/unless}}
<td class="right aligned">{{currency-symbol this.model.eventDetail.paymentCurrency}} {{mult ticket.orderStatistics.tickets.completed ticket.price}}</td>
<td class="right aligned">{{currency-symbol this.model.eventDetail.paymentCurrency (mult ticket.orderStatistics.tickets.completed ticket.price)}} {{mult ticket.orderStatistics.tickets.completed ticket.price}}</td>
{{#unless this.device.isMobile}}
<td class="right aligned">{{ticket.orderStatistics.tickets.placed}}</td>
{{/unless}}
<td class="right aligned">{{currency-symbol this.model.eventDetail.paymentCurrency}} {{mult ticket.orderStatistics.tickets.placed ticket.price}}</td>
<td class="right aligned">{{currency-symbol this.model.eventDetail.paymentCurrency (mult ticket.orderStatistics.tickets.placed ticket.price)}} {{mult ticket.orderStatistics.tickets.placed ticket.price}}</td>
{{#unless this.device.isMobile}}
<td class="right aligned">{{ticket.orderStatistics.tickets.pending}}</td>
{{/unless}}
<td class="right aligned">{{currency-symbol this.model.eventDetail.paymentCurrency}} {{mult ticket.orderStatistics.tickets.pending ticket.price}}</td>
<td class="right aligned">{{currency-symbol this.model.eventDetail.paymentCurrency (mult ticket.orderStatistics.tickets.pending ticket.price)}} {{mult ticket.orderStatistics.tickets.pending ticket.price}}</td>
</tr>
{{/each}}
</tbody>
Expand Down