mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 10:53:37 +00:00
Fix JS views.
This commit is contained in:
@@ -46,7 +46,7 @@ class ChartData
|
|||||||
if (array_key_exists('native_currency_id', $data)) {
|
if (array_key_exists('native_currency_id', $data)) {
|
||||||
$data['native_currency_id'] = (string) $data['native_currency_id'];
|
$data['native_currency_id'] = (string) $data['native_currency_id'];
|
||||||
}
|
}
|
||||||
$required = ['start', 'date', 'end', 'entries', 'native_entries'];
|
$required = ['start', 'date', 'end', 'entries'];
|
||||||
foreach ($required as $field) {
|
foreach ($required as $field) {
|
||||||
if (!array_key_exists($field, $data)) {
|
if (!array_key_exists($field, $data)) {
|
||||||
throw new FireflyException(sprintf('Data-set is missing the "%s"-variable.', $field));
|
throw new FireflyException(sprintf('Data-set is missing the "%s"-variable.', $field));
|
||||||
|
@@ -25,7 +25,7 @@ export default class Dashboard {
|
|||||||
dashboard(start, end) {
|
dashboard(start, end) {
|
||||||
let startStr = format(start, 'y-MM-dd');
|
let startStr = format(start, 'y-MM-dd');
|
||||||
let endStr = format(end, 'y-MM-dd');
|
let endStr = format(end, 'y-MM-dd');
|
||||||
return api.get('/api/v1/chart/account/dashboard', {params: {filter: {start: startStr, end: endStr}}});
|
return api.get('/api/v1/chart/account/dashboard', {params: {fix: true, start: startStr, end: endStr}});
|
||||||
}
|
}
|
||||||
|
|
||||||
expense(start, end) {
|
expense(start, end) {
|
||||||
|
@@ -37,6 +37,18 @@ export default class Get {
|
|||||||
return api.get('/api/v1/accounts/' + identifier, {params: params});
|
return api.get('/api/v1/accounts/' + identifier, {params: params});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param identifier
|
||||||
|
* @param params
|
||||||
|
* @returns {Promise<AxiosResponse<any>>}
|
||||||
|
*/
|
||||||
|
show(identifier, params) {
|
||||||
|
return api.get('/api/v1/accounts/' + identifier, {params: params});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param identifier
|
* @param identifier
|
||||||
|
@@ -29,12 +29,9 @@ export default class Get {
|
|||||||
* @returns {Promise<AxiosResponse<any>>}
|
* @returns {Promise<AxiosResponse<any>>}
|
||||||
*/
|
*/
|
||||||
list(params) {
|
list(params) {
|
||||||
return api.get('/api/v2/transactions', {params: params});
|
return api.get('/api/v1/transactions', {params: params});
|
||||||
}
|
|
||||||
infiniteList(params) {
|
|
||||||
return api.get('/api/v2/infinite/transactions', {params: params});
|
|
||||||
}
|
}
|
||||||
show(id, params){
|
show(id, params){
|
||||||
return api.get('/api/v2/transactions/' + id, {params: params});
|
return api.get('/api/v1/transactions/' + id, {params: params});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ import {api} from "../../../../boot/axios";
|
|||||||
|
|
||||||
export default class Post {
|
export default class Post {
|
||||||
post(submission) {
|
post(submission) {
|
||||||
let url = '/api/v2/transactions';
|
let url = '/api/v1/transactions';
|
||||||
return api.post(url, submission);
|
return api.post(url, submission);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ import {api} from "../../../../boot/axios";
|
|||||||
|
|
||||||
export default class Put {
|
export default class Put {
|
||||||
put(submission, params) {
|
put(submission, params) {
|
||||||
let url = '/api/v2/transactions/' + parseInt(params.id);
|
let url = '/api/v1/transactions/' + parseInt(params.id);
|
||||||
return api.put(url, submission);
|
return api.put(url, submission);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,7 @@ export default class Dashboard {
|
|||||||
dashboard(start, end) {
|
dashboard(start, end) {
|
||||||
let startStr = format(start, 'y-MM-dd');
|
let startStr = format(start, 'y-MM-dd');
|
||||||
let endStr = format(end, 'y-MM-dd');
|
let endStr = format(end, 'y-MM-dd');
|
||||||
return api.get('/api/v2/chart/account/dashboard', {params: {filter: {start: startStr, end: endStr}}});
|
return api.get('/api/v2/chart/account/dashboard', {params: {start: startStr, end: endStr}});
|
||||||
}
|
}
|
||||||
|
|
||||||
expense(start, end) {
|
expense(start, end) {
|
||||||
|
@@ -42,7 +42,7 @@ export default () => ({
|
|||||||
convertToNative: false,
|
convertToNative: false,
|
||||||
convertToNativeAvailable: false,
|
convertToNativeAvailable: false,
|
||||||
chartOptions: null,
|
chartOptions: null,
|
||||||
switchconvertToNative() {
|
switchConvertToNative() {
|
||||||
this.convertToNative = !this.convertToNative;
|
this.convertToNative = !this.convertToNative;
|
||||||
setVariable('convertToNative', this.convertToNative);
|
setVariable('convertToNative', this.convertToNative);
|
||||||
},
|
},
|
||||||
@@ -90,18 +90,18 @@ export default () => ({
|
|||||||
dataset.label = current.label;
|
dataset.label = current.label;
|
||||||
|
|
||||||
// use the "native" currency code and use the "native_entries" as array
|
// use the "native" currency code and use the "native_entries" as array
|
||||||
if (this.convertToNative) {
|
// if (this.convertToNative) {
|
||||||
currencies.push(current.native_currency_code);
|
// currencies.push(current.native_currency_code);
|
||||||
dataset.currency_code = current.native_currency_code;
|
// dataset.currency_code = current.native_currency_code;
|
||||||
collection = Object.values(current.native_entries);
|
// collection = Object.values(current.native_entries);
|
||||||
yAxis = 'y' + current.native_currency_code;
|
// yAxis = 'y' + current.native_currency_code;
|
||||||
}
|
// }
|
||||||
if (!this.convertToNative) {
|
// if (!this.convertToNative) {
|
||||||
yAxis = 'y' + current.currency_code;
|
yAxis = 'y' + current.currency_code;
|
||||||
dataset.currency_code = current.currency_code;
|
dataset.currency_code = current.currency_code;
|
||||||
currencies.push(current.currency_code);
|
currencies.push(current.currency_code);
|
||||||
collection = Object.values(current.entries);
|
collection = Object.values(current.entries);
|
||||||
}
|
// }
|
||||||
dataset.yAxisID = yAxis;
|
dataset.yAxisID = yAxis;
|
||||||
dataset.data = collection;
|
dataset.data = collection;
|
||||||
|
|
||||||
@@ -217,12 +217,12 @@ export default () => ({
|
|||||||
for (let iii = 0; iii < current.attributes.transactions.length; iii++) {
|
for (let iii = 0; iii < current.attributes.transactions.length; iii++) {
|
||||||
let currentTransaction = current.attributes.transactions[iii];
|
let currentTransaction = current.attributes.transactions[iii];
|
||||||
//console.log(currentTransaction);
|
//console.log(currentTransaction);
|
||||||
let nativeAmountRaw = 'withdrawal' === currentTransaction.type ? parseFloat(currentTransaction.native_amount) * -1 : parseFloat(currentTransaction.native_amount);
|
//let nativeAmountRaw = 'withdrawal' === currentTransaction.type ? parseFloat(currentTransaction.native_amount) * -1 : parseFloat(currentTransaction.native_amount);
|
||||||
let amountRaw = 'withdrawal' === currentTransaction.type ? parseFloat(currentTransaction.amount) * -1 : parseFloat(currentTransaction.amount);
|
let amountRaw = 'withdrawal' === currentTransaction.type ? parseFloat(currentTransaction.amount) * -1 : parseFloat(currentTransaction.amount);
|
||||||
|
|
||||||
// if transfer and source is this account, multiply again
|
// if transfer and source is this account, multiply again
|
||||||
if('transfer' === currentTransaction.type && parseInt(currentTransaction.source_id) === accountId) { //
|
if('transfer' === currentTransaction.type && parseInt(currentTransaction.source_id) === accountId) { //
|
||||||
nativeAmountRaw = nativeAmountRaw * -1;
|
// nativeAmountRaw = nativeAmountRaw * -1;
|
||||||
amountRaw = amountRaw * -1;
|
amountRaw = amountRaw * -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,8 +232,8 @@ export default () => ({
|
|||||||
type: currentTransaction.type,
|
type: currentTransaction.type,
|
||||||
amount_raw: amountRaw,
|
amount_raw: amountRaw,
|
||||||
amount: formatMoney(amountRaw, currentTransaction.currency_code),
|
amount: formatMoney(amountRaw, currentTransaction.currency_code),
|
||||||
native_amount_raw: nativeAmountRaw,
|
// native_amount_raw: nativeAmountRaw,
|
||||||
native_amount: formatMoney(nativeAmountRaw, currentTransaction.native_currency_code),
|
// native_amount: formatMoney(nativeAmountRaw, currentTransaction.native_currency_code),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
groups.push(group);
|
groups.push(group);
|
||||||
@@ -244,7 +244,7 @@ export default () => ({
|
|||||||
order: parent.attributes.order,
|
order: parent.attributes.order,
|
||||||
id: parent.id,
|
id: parent.id,
|
||||||
balance: parent.attributes.balance,
|
balance: parent.attributes.balance,
|
||||||
native_balance: parent.attributes.native_balance,
|
//native_balance: parent.attributes.native_balance,
|
||||||
groups: groups,
|
groups: groups,
|
||||||
});
|
});
|
||||||
// console.log(parent.attributes);
|
// console.log(parent.attributes);
|
||||||
|
@@ -76,68 +76,9 @@ export default () => ({
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let key = current.key;
|
let key = current.key;
|
||||||
// native (auto conversion):
|
|
||||||
if (this.convertToNative) {
|
|
||||||
console.error('convertToNative does not work in boxes.');
|
|
||||||
if (key.startsWith('balance-in-native')) {
|
|
||||||
this.balanceBox.amounts.push(formatMoney(current.value, current.currency_code));
|
|
||||||
// prep subtitles (for later)
|
|
||||||
if (!subtitles.hasOwnProperty(current.currency_code)) {
|
|
||||||
subtitles[current.currency_code] = '';
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// spent info is used in subtitle:
|
|
||||||
if (key.startsWith('spent-in-native')) {
|
|
||||||
// prep subtitles (for later)
|
|
||||||
if (!subtitles.hasOwnProperty(current.currency_code)) {
|
|
||||||
subtitles[current.currency_code] = '';
|
|
||||||
}
|
|
||||||
// append the amount spent.
|
|
||||||
subtitles[current.currency_code] =
|
|
||||||
subtitles[current.currency_code] +
|
|
||||||
formatMoney(current.value, current.currency_code);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// earned info is used in subtitle:
|
|
||||||
if (key.startsWith('earned-in-native')) {
|
|
||||||
// prep subtitles (for later)
|
|
||||||
if (!subtitles.hasOwnProperty(current.currency_code)) {
|
|
||||||
subtitles[current.currency_code] = '';
|
|
||||||
}
|
|
||||||
// prepend the amount earned.
|
|
||||||
subtitles[current.currency_code] =
|
|
||||||
formatMoney(current.value, current.currency_code) + ' + ' +
|
|
||||||
subtitles[current.currency_code];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key.startsWith('bills-unpaid-in-native')) {
|
|
||||||
this.billBox.unpaid.push(formatMoney(current.value, current.currency_code));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (key.startsWith('bills-paid-in-native')) {
|
|
||||||
this.billBox.paid.push(formatMoney(current.value, current.currency_code));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (key.startsWith('left-to-spend-in-native')) {
|
|
||||||
this.leftBox.left.push(formatMoney(current.value, current.currency_code));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (key.startsWith('left-per-day-to-spend-in-native')) { // per day
|
|
||||||
this.leftBox.perDay.push(formatMoney(current.value, current.currency_code));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (key.startsWith('net-worth-in-native')) {
|
|
||||||
this.netBox.net.push(formatMoney(current.value, current.currency_code));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// not native
|
|
||||||
if (!this.convertToNative && !key.endsWith('native')) {
|
|
||||||
console.log('NOT NATIVE');
|
console.log('NOT NATIVE');
|
||||||
if (key.startsWith('balance-in-')) {
|
if (key.startsWith('balance-in-')) {
|
||||||
this.balanceBox.amounts.push(formatMoney(current.monetary_value , current.currency_code));
|
this.balanceBox.amounts.push(formatMoney(current.monetary_value, current.currency_code));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// spent info is used in subtitle:
|
// spent info is used in subtitle:
|
||||||
@@ -149,7 +90,7 @@ export default () => ({
|
|||||||
// append the amount spent.
|
// append the amount spent.
|
||||||
subtitles[current.currency_code] =
|
subtitles[current.currency_code] =
|
||||||
subtitles[current.currency_code] +
|
subtitles[current.currency_code] +
|
||||||
formatMoney(current.monetary_value , current.currency_code);
|
formatMoney(current.monetary_value, current.currency_code);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// earned info is used in subtitle:
|
// earned info is used in subtitle:
|
||||||
@@ -160,35 +101,34 @@ export default () => ({
|
|||||||
}
|
}
|
||||||
// prepend the amount earned.
|
// prepend the amount earned.
|
||||||
subtitles[current.currency_code] =
|
subtitles[current.currency_code] =
|
||||||
formatMoney(current.monetary_value , current.currency_code) + ' + ' +
|
formatMoney(current.monetary_value, current.currency_code) + ' + ' +
|
||||||
subtitles[current.currency_code];
|
subtitles[current.currency_code];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (key.startsWith('bills-unpaid-in-')) {
|
if (key.startsWith('bills-unpaid-in-')) {
|
||||||
this.billBox.unpaid.push(formatMoney(current.monetary_value , current.currency_code));
|
this.billBox.unpaid.push(formatMoney(current.monetary_value, current.currency_code));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (key.startsWith('bills-paid-in-')) {
|
if (key.startsWith('bills-paid-in-')) {
|
||||||
this.billBox.paid.push(formatMoney(current.monetary_value , current.currency_code));
|
this.billBox.paid.push(formatMoney(current.monetary_value, current.currency_code));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (key.startsWith('left-to-spend-in-')) {
|
if (key.startsWith('left-to-spend-in-')) {
|
||||||
this.leftBox.left.push(formatMoney(current.monetary_value , current.currency_code));
|
this.leftBox.left.push(formatMoney(current.monetary_value, current.currency_code));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (key.startsWith('left-per-day-to-spend-in-')) {
|
if (key.startsWith('left-per-day-to-spend-in-')) {
|
||||||
this.leftBox.perDay.push(formatMoney(current.monetary_value , current.currency_code));
|
this.leftBox.perDay.push(formatMoney(current.monetary_value, current.currency_code));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (key.startsWith('net-worth-in-')) {
|
if (key.startsWith('net-worth-in-')) {
|
||||||
this.netBox.net.push(formatMoney(current.monetary_value , current.currency_code));
|
this.netBox.net.push(formatMoney(current.monetary_value, current.currency_code));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for (let i in subtitles) {
|
for (let i in subtitles) {
|
||||||
if (subtitles.hasOwnProperty(i)) {
|
if (subtitles.hasOwnProperty(i)) {
|
||||||
this.balanceBox.subtitles.push(subtitles[i]);
|
this.balanceBox.subtitles.push(subtitles[i]);
|
||||||
|
@@ -66,10 +66,10 @@ function downloadSubscriptions(params) {
|
|||||||
currency_code: current.attributes.currency_code,
|
currency_code: current.attributes.currency_code,
|
||||||
|
|
||||||
// native amount
|
// native amount
|
||||||
native_amount_min: current.attributes.native_amount_min,
|
// native_amount_min: current.attributes.native_amount_min,
|
||||||
native_amount_max: current.attributes.native_amount_max,
|
// native_amount_max: current.attributes.native_amount_max,
|
||||||
native_amount: (parseFloat(current.attributes.native_amount_max) + parseFloat(current.attributes.native_amount_min)) / 2,
|
// native_amount: (parseFloat(current.attributes.native_amount_max) + parseFloat(current.attributes.native_amount_min)) / 2,
|
||||||
native_currency_code: current.attributes.native_currency_code,
|
// native_currency_code: current.attributes.native_currency_code,
|
||||||
|
|
||||||
// paid transactions:
|
// paid transactions:
|
||||||
transactions: [],
|
transactions: [],
|
||||||
@@ -79,8 +79,7 @@ function downloadSubscriptions(params) {
|
|||||||
paid: current.attributes.paid_dates.length > 0,
|
paid: current.attributes.paid_dates.length > 0,
|
||||||
};
|
};
|
||||||
// set variables
|
// set variables
|
||||||
bill.expected_amount = params.convertToNative ? formatMoney(bill.native_amount, bill.native_currency_code) :
|
bill.expected_amount = formatMoney(bill.amount, bill.currency_code);
|
||||||
formatMoney(bill.amount, bill.currency_code);
|
|
||||||
bill.expected_times = i18next.t('firefly.subscr_expected_x_times', {
|
bill.expected_times = i18next.t('firefly.subscr_expected_x_times', {
|
||||||
times: current.attributes.pay_dates.length,
|
times: current.attributes.pay_dates.length,
|
||||||
amount: bill.expected_amount
|
amount: bill.expected_amount
|
||||||
@@ -98,16 +97,19 @@ function downloadSubscriptions(params) {
|
|||||||
if (!params.convertToNative) {
|
if (!params.convertToNative) {
|
||||||
percentage = Math.round(-100 + ((parseFloat(currentPayment.amount) * -1) / parseFloat(bill.amount)) * 100);
|
percentage = Math.round(-100 + ((parseFloat(currentPayment.amount) * -1) / parseFloat(bill.amount)) * 100);
|
||||||
}
|
}
|
||||||
|
// TODO fix me
|
||||||
|
currentPayment.currency_code = 'EUR';
|
||||||
|
console.log('Currency code: "'+currentPayment+'"');
|
||||||
|
console.log(currentPayment);
|
||||||
let currentTransaction = {
|
let currentTransaction = {
|
||||||
amount: params.convertToNative ? formatMoney(currentPayment.native_amount, currentPayment.native_currency_code) : formatMoney(currentPayment.amount, currentPayment.currency_code),
|
amount: formatMoney(currentPayment.amount, currentPayment.currency_code),
|
||||||
percentage: percentage,
|
percentage: percentage,
|
||||||
date: format(new Date(currentPayment.date), 'PP'),
|
date: format(new Date(currentPayment.date), 'PP'),
|
||||||
foreign_amount: null,
|
foreign_amount: null,
|
||||||
};
|
};
|
||||||
if (null !== currentPayment.foreign_currency_code) {
|
if (null !== currentPayment.foreign_currency_code) {
|
||||||
currentTransaction.foreign_amount = params.convertToNative ? currentPayment.foreign_native_amount : currentPayment.foreign_amount;
|
currentTransaction.foreign_amount = currentPayment.foreign_amount;
|
||||||
currentTransaction.foreign_currency_code = params.convertToNative ? currentPayment.native_currency_code : currentPayment.foreign_currency_code;
|
currentTransaction.foreign_currency_code = currentPayment.foreign_currency_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
bill.transactions.push(currentTransaction);
|
bill.transactions.push(currentTransaction);
|
||||||
@@ -119,7 +121,7 @@ function downloadSubscriptions(params) {
|
|||||||
// bill is unpaid, count the "pay_dates" and multiply with the "amount".
|
// bill is unpaid, count the "pay_dates" and multiply with the "amount".
|
||||||
// since bill is unpaid, this can only be in currency amount and native currency amount.
|
// since bill is unpaid, this can only be in currency amount and native currency amount.
|
||||||
const totalAmount = current.attributes.pay_dates.length * bill.amount;
|
const totalAmount = current.attributes.pay_dates.length * bill.amount;
|
||||||
const totalNativeAmount = current.attributes.pay_dates.length * bill.native_amount;
|
// const totalNativeAmount = current.attributes.pay_dates.length * bill.native_amount;
|
||||||
// for bill's currency
|
// for bill's currency
|
||||||
if (!subscriptionData[objectGroupId].payment_info.hasOwnProperty(bill.currency_code)) {
|
if (!subscriptionData[objectGroupId].payment_info.hasOwnProperty(bill.currency_code)) {
|
||||||
subscriptionData[objectGroupId].payment_info[bill.currency_code] = {
|
subscriptionData[objectGroupId].payment_info[bill.currency_code] = {
|
||||||
@@ -128,11 +130,11 @@ function downloadSubscriptions(params) {
|
|||||||
unpaid: 0,
|
unpaid: 0,
|
||||||
native_currency_code: bill.native_currency_code,
|
native_currency_code: bill.native_currency_code,
|
||||||
native_paid: 0,
|
native_paid: 0,
|
||||||
native_unpaid: 0,
|
//native_unpaid: 0,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
subscriptionData[objectGroupId].payment_info[bill.currency_code].unpaid += totalAmount;
|
subscriptionData[objectGroupId].payment_info[bill.currency_code].unpaid += totalAmount;
|
||||||
subscriptionData[objectGroupId].payment_info[bill.currency_code].native_unpaid += totalNativeAmount;
|
//subscriptionData[objectGroupId].payment_info[bill.currency_code].native_unpaid += totalNativeAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current.attributes.paid_dates.length > 0) {
|
if (current.attributes.paid_dates.length > 0) {
|
||||||
@@ -149,15 +151,15 @@ function downloadSubscriptions(params) {
|
|||||||
currency_code: bill.currency_code,
|
currency_code: bill.currency_code,
|
||||||
paid: 0,
|
paid: 0,
|
||||||
unpaid: 0,
|
unpaid: 0,
|
||||||
native_currency_code: bill.native_currency_code,
|
// native_currency_code: bill.native_currency_code,
|
||||||
native_paid: 0,
|
// native_paid: 0,
|
||||||
native_unpaid: 0,
|
//native_unpaid: 0,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const amount = parseFloat(currentJournal.amount) * -1;
|
const amount = parseFloat(currentJournal.amount) * -1;
|
||||||
const nativeAmount = parseFloat(currentJournal.native_amount) * -1;
|
// const nativeAmount = parseFloat(currentJournal.native_amount) * -1;
|
||||||
subscriptionData[objectGroupId].payment_info[currentJournal.currency_code].paid += amount;
|
subscriptionData[objectGroupId].payment_info[currentJournal.currency_code].paid += amount;
|
||||||
subscriptionData[objectGroupId].payment_info[currentJournal.currency_code].native_paid += nativeAmount;
|
// subscriptionData[objectGroupId].payment_info[currentJournal.currency_code].native_paid += nativeAmount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,7 +200,7 @@ export default () => ({
|
|||||||
let params = {
|
let params = {
|
||||||
start: format(start, 'y-MM-dd'),
|
start: format(start, 'y-MM-dd'),
|
||||||
end: format(end, 'y-MM-dd'),
|
end: format(end, 'y-MM-dd'),
|
||||||
convertToNative: this.convertToNative,
|
// convertToNative: this.convertToNative,
|
||||||
page: 1
|
page: 1
|
||||||
};
|
};
|
||||||
downloadSubscriptions(params).then(() => {
|
downloadSubscriptions(params).then(() => {
|
||||||
@@ -226,9 +228,9 @@ export default () => ({
|
|||||||
drawPieChart(groupId, groupTitle, data) {
|
drawPieChart(groupId, groupTitle, data) {
|
||||||
let id = '#pie_' + groupId + '_' + data.currency_code;
|
let id = '#pie_' + groupId + '_' + data.currency_code;
|
||||||
//console.log(data);
|
//console.log(data);
|
||||||
const unpaidAmount = this.convertToNative ? data.native_unpaid : data.unpaid;
|
const unpaidAmount = data.unpaid;
|
||||||
const paidAmount = this.convertToNative ? data.native_paid : data.paid;
|
const paidAmount = data.paid;
|
||||||
const currencyCode = this.convertToNative ? data.native_currency_code : data.currency_code;
|
const currencyCode = data.currency_code;
|
||||||
const chartData = {
|
const chartData = {
|
||||||
labels: [
|
labels: [
|
||||||
i18next.t('firefly.paid'),
|
i18next.t('firefly.paid'),
|
||||||
|
@@ -12,14 +12,14 @@
|
|||||||
<template x-if="convertToNativeAvailable">
|
<template x-if="convertToNativeAvailable">
|
||||||
<div class="card-footer text-end">
|
<div class="card-footer text-end">
|
||||||
<template x-if="convertToNative">
|
<template x-if="convertToNative">
|
||||||
<button type="button" @click="switchconvertToNative"
|
<button type="button" @click="switchConvertToNative"
|
||||||
class="btn btn-outline-info btm-sm">
|
class="btn btn-outline-info btm-sm">
|
||||||
<span
|
<span
|
||||||
class="fa-solid fa-comments-dollar"></span> {{ __('firefly.disable_auto_convert') }}
|
class="fa-solid fa-comments-dollar"></span> {{ __('firefly.disable_auto_convert') }}
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
<template x-if="!convertToNative">
|
<template x-if="!convertToNative">
|
||||||
<button type="button" @click="switchconvertToNative"
|
<button type="button" @click="switchConvertToNative"
|
||||||
class="btn btn-outline-info btm-sm">
|
class="btn btn-outline-info btm-sm">
|
||||||
<span
|
<span
|
||||||
class="fa-solid fa-comments-dollar"></span> {{ __('firefly.enable_auto_convert') }}
|
class="fa-solid fa-comments-dollar"></span> {{ __('firefly.enable_auto_convert') }}
|
||||||
|
@@ -337,9 +337,33 @@ Route::group(
|
|||||||
],
|
],
|
||||||
static function (): void {
|
static function (): void {
|
||||||
Route::get('overview', ['uses' => 'AccountController@overview', 'as' => 'overview']);
|
Route::get('overview', ['uses' => 'AccountController@overview', 'as' => 'overview']);
|
||||||
|
Route::get('dashboard', ['uses' => 'AccountController@dashboard', 'as' => 'dashboard']);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Route::group(
|
||||||
|
[
|
||||||
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Chart',
|
||||||
|
'prefix' => 'v1/chart/budget',
|
||||||
|
'as' => 'api.v1.chart.budget.',
|
||||||
|
],
|
||||||
|
static function (): void {
|
||||||
|
Route::get('dashboard', ['uses' => 'BudgetController@dashboard', 'as' => 'dashboard']);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
Route::group(
|
||||||
|
[
|
||||||
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Chart',
|
||||||
|
'prefix' => 'v1/chart/category',
|
||||||
|
'as' => 'api.v1.chart.category.',
|
||||||
|
],
|
||||||
|
static function (): void {
|
||||||
|
Route::get('dashboard', ['uses' => 'CategoryController@dashboard', 'as' => 'dashboard']);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// DATA ROUTES
|
// DATA ROUTES
|
||||||
// Export data API routes
|
// Export data API routes
|
||||||
Route::group(
|
Route::group(
|
||||||
@@ -351,6 +375,7 @@ Route::group(
|
|||||||
static function (): void {
|
static function (): void {
|
||||||
Route::get('accounts', ['uses' => 'ExportController@accounts', 'as' => 'accounts']);
|
Route::get('accounts', ['uses' => 'ExportController@accounts', 'as' => 'accounts']);
|
||||||
Route::get('bills', ['uses' => 'ExportController@bills', 'as' => 'bills']);
|
Route::get('bills', ['uses' => 'ExportController@bills', 'as' => 'bills']);
|
||||||
|
Route::get('subscriptions', ['uses' => 'ExportController@bills', 'as' => 'subscriptions']);
|
||||||
Route::get('budgets', ['uses' => 'ExportController@budgets', 'as' => 'budgets']);
|
Route::get('budgets', ['uses' => 'ExportController@budgets', 'as' => 'budgets']);
|
||||||
Route::get('categories', ['uses' => 'ExportController@categories', 'as' => 'categories']);
|
Route::get('categories', ['uses' => 'ExportController@categories', 'as' => 'categories']);
|
||||||
Route::get('piggy-banks', ['uses' => 'ExportController@piggyBanks', 'as' => 'piggy-banks']);
|
Route::get('piggy-banks', ['uses' => 'ExportController@piggyBanks', 'as' => 'piggy-banks']);
|
||||||
@@ -556,6 +581,24 @@ Route::group(
|
|||||||
Route::get('{bill}/transactions', ['uses' => 'ListController@transactions', 'as' => 'transactions']);
|
Route::get('{bill}/transactions', ['uses' => 'ListController@transactions', 'as' => 'transactions']);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Route::group(
|
||||||
|
[
|
||||||
|
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\Bill',
|
||||||
|
'prefix' => 'v1/subscriptions',
|
||||||
|
'as' => 'api.v1.subscriptions.',
|
||||||
|
],
|
||||||
|
static function (): void {
|
||||||
|
Route::get('', ['uses' => 'ShowController@index', 'as' => 'index']);
|
||||||
|
Route::post('', ['uses' => 'StoreController@store', 'as' => 'store']);
|
||||||
|
Route::get('{bill}', ['uses' => 'ShowController@show', 'as' => 'show']);
|
||||||
|
Route::put('{bill}', ['uses' => 'UpdateController@update', 'as' => 'update']);
|
||||||
|
Route::delete('{bill}', ['uses' => 'DestroyController@destroy', 'as' => 'delete']);
|
||||||
|
|
||||||
|
Route::get('{bill}/attachments', ['uses' => 'ListController@attachments', 'as' => 'attachments']);
|
||||||
|
Route::get('{bill}/rules', ['uses' => 'ListController@rules', 'as' => 'rules']);
|
||||||
|
Route::get('{bill}/transactions', ['uses' => 'ListController@transactions', 'as' => 'transactions']);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// Available Budget API routes:
|
// Available Budget API routes:
|
||||||
Route::group(
|
Route::group(
|
||||||
|
Reference in New Issue
Block a user