Skip to content

Commit

Permalink
fix: add currency component to show translated currency symbol (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
saimonh3 authored and sabbir1991 committed Oct 26, 2018
1 parent a084b73 commit 16b2909
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
15 changes: 15 additions & 0 deletions src/admin/components/Currency.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<div v-html="formattedPrice( amount )"></div>
</template>

<script>
export default {
props : ['amount'],
methods: {
formattedPrice(value) {
return accounting.formatMoney( value, dokan.currency );
}
}
};
</script>
16 changes: 11 additions & 5 deletions src/admin/pages/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
<li class="sale">
<div class="dashicons dashicons-chart-bar"></div>
<a href="#">
<strong>{{ overview.orders.this_month | currency }}</strong>
<strong>
<currency :amount="overview.orders.this_month"></currency>
</strong>
<div class="details">
{{ __( 'net sales this month', 'dokan-lite' ) }} <span :class="overview.orders.class">{{ overview.orders.parcent }}</span>
</div>
Expand All @@ -19,7 +21,9 @@
<li class="commission">
<div class="dashicons dashicons-chart-pie"></div>
<a href="#">
<strong>{{ overview.earning.this_month | currency }}</strong>
<strong>
<currency :amount="overview.earning.this_month"></currency>
</strong>
<div class="details">
{{ __( 'commission earned', 'dokan-lite' ) }} <span :class="overview.earning.class">{{ overview.earning.parcent }}</span>
</div>
Expand Down Expand Up @@ -109,8 +113,9 @@
</template>

<script>
let Postbox = dokan_get_lib('Postbox');
let Loading = dokan_get_lib('Loading');
let Postbox = dokan_get_lib('Postbox');
let Loading = dokan_get_lib('Loading');
let Currency = dokan_get_lib('Currency');
import Chart from "admin/components/Chart.vue"
Expand All @@ -121,7 +126,8 @@ export default {
components: {
Postbox,
Loading,
Chart
Chart,
Currency
},
data () {
Expand Down
6 changes: 4 additions & 2 deletions src/admin/pages/Withdraw.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</template>

<template slot="amount" slot-scope="data">
{{ data.row.amount | currency }}
<currency :amount="data.row.amount"></currency>
</template>

<template slot="status" slot-scope="data">
Expand Down Expand Up @@ -85,7 +85,8 @@

<script>
let ListTable = dokan_get_lib('ListTable');
let Modal = dokan_get_lib('Modal');
let Modal = dokan_get_lib('Modal');
let Currency = dokan_get_lib('Currency');
export default {
Expand All @@ -94,6 +95,7 @@ export default {
components: {
ListTable,
Modal,
Currency
},
data () {
Expand Down
6 changes: 2 additions & 4 deletions src/utils/Bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import Chart from "admin/components/Chart.vue"
import Modal from "admin/components/Modal.vue"
import Switches from "admin/components/Switches.vue"
import TextEditor from "admin/components/TextEditor.vue"
import Currency from "admin/components/Currency.vue"

import "vue-multiselect/dist/vue-multiselect.min.css"

Expand All @@ -37,10 +38,6 @@ Vue.component('multiselect', Multiselect)

Vue.mixin( Mixin );

Vue.filter('currency', function (value) {
return accounting.formatMoney(value, dokan.currency);
})

Vue.filter('capitalize', function (value) {
if (!value) return ''
value = value.toString()
Expand Down Expand Up @@ -72,6 +69,7 @@ window.dokan.libs['Router'] = Router;
window.dokan.libs['moment'] = Moment;

window.dokan.libs['ListTable'] = ListTable;
window.dokan.libs['Currency'] = Currency;
window.dokan.libs['Postbox'] = Postbox;
window.dokan.libs['Loading'] = Loading;
window.dokan.libs['ChartJS'] = ChartJS;
Expand Down

0 comments on commit 16b2909

Please sign in to comment.