mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-19 08:00:19 +00:00
New JSON routes and code.
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
$.getJSON('json/beneficiaries').success(function (data) {
|
$.getJSON('json/expense-accounts').success(function (data) {
|
||||||
$('input[name="beneficiary"]').typeahead({ source: data });
|
$('input[name="expense_account"]').typeahead({ source: data });
|
||||||
|
});
|
||||||
|
$.getJSON('json/revenue-accounts').success(function (data) {
|
||||||
|
$('input[name="revenue_account"]').typeahead({ source: data });
|
||||||
});
|
});
|
||||||
|
|
||||||
$.getJSON('json/categories').success(function (data) {
|
$.getJSON('json/categories').success(function (data) {
|
||||||
|
|||||||
@@ -34,9 +34,24 @@ class JsonController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* Returns a JSON list of all beneficiaries.
|
* Returns a JSON list of all beneficiaries.
|
||||||
*/
|
*/
|
||||||
public function beneficiaries()
|
public function expenseAccounts()
|
||||||
{
|
{
|
||||||
$list = $this->_accounts->getBeneficiaries();
|
$list = $this->_accounts->getOfTypes(['Expense account','Beneficiary account']);
|
||||||
|
$return = [];
|
||||||
|
foreach ($list as $entry) {
|
||||||
|
$return[] = $entry->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response::json($return);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a JSON list of all revenue accounts.
|
||||||
|
*/
|
||||||
|
public function revenueAccounts()
|
||||||
|
{
|
||||||
|
$list = $this->_accounts->getOfTypes(['Revenue account']);
|
||||||
$return = [];
|
$return = [];
|
||||||
foreach ($list as $entry) {
|
foreach ($list as $entry) {
|
||||||
$return[] = $entry->name;
|
$return[] = $entry->name;
|
||||||
|
|||||||
Reference in New Issue
Block a user