Files
firefly-iii/resources/assets/js/app.js

70 lines
1.9 KiB
JavaScript
Raw Normal View History

/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
window.Vue = require('vue');
2018-02-06 07:51:28 +01:00
import moment from 'moment';
import accounting from 'accounting';
2018-02-06 10:56:37 +01:00
import Lang from './lang.js';
2018-02-06 07:51:28 +01:00
2018-02-06 10:56:37 +01:00
Vue.filter('trans', (...args) => {
return Lang.get(...args);
});
Vue.filter('formatDate', function (value) {
2018-02-06 07:51:28 +01:00
if (value) {
moment.locale(window.language);
return moment(String(value)).format(window.month_and_day_js);
}
});
2018-02-06 10:56:37 +01:00
Vue.filter('formatAmount', function (value) {
2018-02-06 07:51:28 +01:00
if (value) {
value = parseFloat(value);
2018-02-06 10:56:37 +01:00
let parsed = accounting.formatMoney(value, window.currencySymbol, window.frac_digits, window.mon_thousands_sep, window.mon_decimal_point, accountingConfig);
if (value < 0) {
2018-02-06 07:51:28 +01:00
return '<span class="text-danger">' + parsed + '</span>';
}
2018-02-06 10:56:37 +01:00
if (value > 0) {
return '<span class="text-success">' + parsed + '</span>';
2018-02-06 07:51:28 +01:00
}
return '<span style="color:#999;">' + parsed + '</span>';
}
});
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
Vue.component('example-component', require('./components/ExampleComponent.vue'));
2018-02-06 07:51:28 +01:00
Vue.component('bills-index', require('./components/bills/Index.vue'));
2018-02-04 08:15:20 +01:00
Vue.component(
'passport-clients',
require('./components/passport/Clients.vue')
);
Vue.component(
'passport-authorized-clients',
require('./components/passport/AuthorizedClients.vue')
);
Vue.component(
'passport-personal-access-tokens',
require('./components/passport/PersonalAccessTokens.vue')
);
const app = new Vue({
2018-02-06 10:56:37 +01:00
el: '#app'
});