mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 01:42:32 +00:00
Update meta files for new release.
This commit is contained in:
35
resources/assets/v2/api/v2/model/currency/get.js
Normal file
35
resources/assets/v2/api/v2/model/currency/get.js
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* list.js
|
||||
* Copyright (c) 2022 james@firefly-iii.org
|
||||
*
|
||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {api} from "../../../../boot/axios";
|
||||
import format from "date-fns/format";
|
||||
|
||||
export default class Get {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param params
|
||||
* @returns {Promise<AxiosResponse<any>>}
|
||||
*/
|
||||
list(params) {
|
||||
return api.get('/api/v2/currencies', {params: params});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,7 +28,7 @@ export default class Get {
|
||||
* @param params
|
||||
* @returns {Promise<AxiosResponse<any>>}
|
||||
*/
|
||||
get(params) {
|
||||
list(params) {
|
||||
return api.get('/api/v2/piggy-banks', {params: params});
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ export default class Get {
|
||||
* @param params
|
||||
* @returns {Promise<AxiosResponse<any>>}
|
||||
*/
|
||||
get(params) {
|
||||
list(params) {
|
||||
return api.get('/api/v2/subscriptions', {params: params});
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ export default class Get {
|
||||
* @param params
|
||||
* @returns {Promise<AxiosResponse<any>>}
|
||||
*/
|
||||
get(params) {
|
||||
list(params) {
|
||||
return api.get('/api/v2/transactions', {params: params});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ export default () => ({
|
||||
const end = new Date(window.store.get('end'));
|
||||
const cacheKey = getCacheKey(PIGGY_CACHE_KEY, start, end);
|
||||
const getter = new Get();
|
||||
getter.get(params).then((response) => {
|
||||
getter.list(params).then((response) => {
|
||||
apiData = [...apiData, ...response.data.data];
|
||||
if (parseInt(response.data.meta.pagination.total_pages) > params.page) {
|
||||
params.page++;
|
||||
|
||||
@@ -318,7 +318,7 @@ export default () => ({
|
||||
|
||||
//console.log('Downloading page ' + params.page + '...');
|
||||
const getter = new Get();
|
||||
getter.get(params).then((response) => {
|
||||
getter.list(params).then((response) => {
|
||||
transactions = [...transactions, ...response.data.data];
|
||||
//this.drawChart(this.generateOptions(response.data));
|
||||
//this.loading = false;
|
||||
|
||||
@@ -36,7 +36,7 @@ let subscriptionData = {};
|
||||
|
||||
function downloadSubscriptions(params) {
|
||||
const getter = new Get();
|
||||
return getter.get(params)
|
||||
return getter.list(params)
|
||||
// first promise: parse the data:
|
||||
.then((response) => {
|
||||
let data = response.data.data;
|
||||
|
||||
@@ -25,6 +25,7 @@ import {parseFromEntries} from "./shared/parse-from-entries.js";
|
||||
import formatMoney from "../../util/format-money.js";
|
||||
import Autocomplete from "bootstrap5-autocomplete";
|
||||
import Post from "../../api/v2/model/transaction/post.js";
|
||||
import Get from "../../api/v2/model/currency/get.js";
|
||||
import {getVariable} from "../../store/get-variable.js";
|
||||
import {I18n} from "i18n-js";
|
||||
import {loadTranslations} from "../../support/load-translations.js";
|
||||
@@ -45,6 +46,7 @@ let transactions = function () {
|
||||
showErrorMessage: false,
|
||||
entries: [],
|
||||
loadingCurrencies: true,
|
||||
defaultCurrency: {},
|
||||
enabledCurrencies: [],
|
||||
nativeCurrencies: [],
|
||||
foreignCurrencies: [],
|
||||
@@ -52,6 +54,7 @@ let transactions = function () {
|
||||
source: [],
|
||||
destination: [],
|
||||
},
|
||||
errorMessageText: '',
|
||||
detectTransactionType() {
|
||||
const sourceType = this.entries[0].source_account.type ?? 'unknown';
|
||||
const destType = this.entries[0].destination_account.type ?? 'unknown';
|
||||
@@ -129,6 +132,37 @@ let transactions = function () {
|
||||
},
|
||||
loadCurrencies() {
|
||||
console.log('Loading user currencies.');
|
||||
let params = {
|
||||
page: 1,
|
||||
limit: 1337
|
||||
};
|
||||
let getter = new Get();
|
||||
getter.list({}).then((response) => {
|
||||
for(let i in response.data.data) {
|
||||
if(response.data.data.hasOwnProperty(i)) {
|
||||
let current = response.data.data[i];
|
||||
if(current.attributes.enabled) {
|
||||
let obj =
|
||||
|
||||
{
|
||||
id: current.id,
|
||||
name: current.attributes.name,
|
||||
code: current.attributes.code,
|
||||
default: current.attributes.default,
|
||||
symbol: current.attributes.symbol,
|
||||
decimal_places: current.attributes.decimal_places,
|
||||
|
||||
};
|
||||
if(obj.default) {
|
||||
this.defaultCurrency = obj;
|
||||
}
|
||||
this.enabledCurrencies.push(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.loadingCurrencies = false;
|
||||
console.log(this.enabledCurrencies);
|
||||
});
|
||||
},
|
||||
changeSourceAccount(item, ac) {
|
||||
if (typeof item === 'undefined') {
|
||||
@@ -275,7 +309,7 @@ let transactions = function () {
|
||||
this.showErrorMessage = true;
|
||||
// todo create error banner.
|
||||
// todo release form
|
||||
console.error(error);
|
||||
this.errorMessageText = error.response.data.message;
|
||||
});
|
||||
},
|
||||
addSplit() {
|
||||
|
||||
@@ -33,9 +33,16 @@ export function createEmptySplit() {
|
||||
let formatted = format(now, 'yyyy-MM-dd HH:mm');
|
||||
return {
|
||||
description: '',
|
||||
|
||||
// amount information:
|
||||
amount: '',
|
||||
currency_code: 'EUR',
|
||||
|
||||
// source and destination
|
||||
source_account: getAccount(),
|
||||
destination_account: getAccount(),
|
||||
|
||||
// date and time
|
||||
date: formatted
|
||||
};
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ export function parseFromEntries(entries, transactionType) {
|
||||
current.destination_name = entry.destination_account.name;
|
||||
current.amount = entry.amount;
|
||||
current.date = entry.date;
|
||||
current.currency_code = entry.currency_code;
|
||||
|
||||
// if ID is set:
|
||||
if ('' !== entry.source_account.id.toString()) {
|
||||
|
||||
@@ -17,10 +17,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<template x-if="showErrorMessage">
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
A simple ERROR alert with <a href="#" class="alert-link">an example link</a>. Give it a
|
||||
click
|
||||
if you like.
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert" x-text="errorMessageText">
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -38,7 +35,7 @@
|
||||
type="button" role="tab"
|
||||
:aria-controls="'split-'+index+'-pane'"
|
||||
aria-selected="true">{{ __('firefly.single_split') }} #
|
||||
<span x-text="index"></span>
|
||||
<span x-text="index+1"></span>
|
||||
</button>
|
||||
</li>
|
||||
</template>
|
||||
@@ -125,7 +122,7 @@
|
||||
<i class="fa-solid fa-calendar"></i>
|
||||
</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="datetime-local" class="form-control" id="date_0"
|
||||
<input type="datetime-local" class="form-control" :id="'date_' + index"
|
||||
@change="detectTransactionType"
|
||||
x-model="transaction.date"
|
||||
>
|
||||
@@ -148,16 +145,12 @@
|
||||
<span class="form-control-plaintext"><em class="fa-solid fa-spinner fa-spin"></em></span>
|
||||
</template>
|
||||
<template x-if="!loadingCurrencies">
|
||||
<select class="form-control">
|
||||
<option>
|
||||
Euro
|
||||
</option>
|
||||
<option>
|
||||
Euro
|
||||
</option>
|
||||
<option>
|
||||
Euro
|
||||
</option>
|
||||
<select class="form-control" :id="'currency_code_' + index"
|
||||
x-model="transaction.currency_code"
|
||||
>
|
||||
<template x-for="currency in enabledCurrencies">
|
||||
<option :selected="currency.id == defaultCurrency.id" :label="currency.name" :value="currency.code" x-text="currency.name"></option>
|
||||
</template>
|
||||
</select>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user