mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Better routes and titles.
This commit is contained in:
parent
1c93d8bf79
commit
823839fbf6
@ -58,6 +58,8 @@ class SplitController extends Controller
|
|||||||
$uploadSize = min(Steam::phpBytes(ini_get('upload_max_filesize')), Steam::phpBytes(ini_get('post_max_size')));
|
$uploadSize = min(Steam::phpBytes(ini_get('upload_max_filesize')), Steam::phpBytes(ini_get('post_max_size')));
|
||||||
$currencies = ExpandedForm::makeSelectList($currencyRepository->get());
|
$currencies = ExpandedForm::makeSelectList($currencyRepository->get());
|
||||||
$budgets = ExpandedForm::makeSelectListWithEmpty($budgetRepository->getActiveBudgets());
|
$budgets = ExpandedForm::makeSelectListWithEmpty($budgetRepository->getActiveBudgets());
|
||||||
|
$subTitle = trans('form.add_new_' . $sessionData['what']);
|
||||||
|
$subTitleIcon = 'fa-plus';
|
||||||
$preFilled = [
|
$preFilled = [
|
||||||
'what' => $sessionData['what'] ?? 'withdrawal',
|
'what' => $sessionData['what'] ?? 'withdrawal',
|
||||||
'journal_amount' => $sessionData['amount'] ?? 0,
|
'journal_amount' => $sessionData['amount'] ?? 0,
|
||||||
@ -71,7 +73,9 @@ class SplitController extends Controller
|
|||||||
'category' => [$sessionData['category']],
|
'category' => [$sessionData['category']],
|
||||||
];
|
];
|
||||||
|
|
||||||
return view('split.journals.create', compact('journal', 'preFilled', 'assetAccounts', 'currencies', 'budgets', 'uploadSize'));
|
return view(
|
||||||
|
'split.journals.create', compact('journal', 'subTitle', 'subTitleIcon', 'preFilled', 'assetAccounts', 'currencies', 'budgets', 'uploadSize')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -90,6 +94,8 @@ class SplitController extends Controller
|
|||||||
$assetAccounts = ExpandedForm::makeSelectList($accountRepository->getAccountsByType(['Default account', 'Asset account']));
|
$assetAccounts = ExpandedForm::makeSelectList($accountRepository->getAccountsByType(['Default account', 'Asset account']));
|
||||||
$budgets = ExpandedForm::makeSelectListWithEmpty($budgetRepository->getActiveBudgets());
|
$budgets = ExpandedForm::makeSelectListWithEmpty($budgetRepository->getActiveBudgets());
|
||||||
$preFilled = $this->arrayFromJournal($request, $journal);
|
$preFilled = $this->arrayFromJournal($request, $journal);
|
||||||
|
$subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]);
|
||||||
|
$subTitleIcon = 'fa-pencil';
|
||||||
|
|
||||||
Session::flash('gaEventCategory', 'transactions');
|
Session::flash('gaEventCategory', 'transactions');
|
||||||
Session::flash('gaEventAction', 'edit-split-' . $preFilled['what']);
|
Session::flash('gaEventAction', 'edit-split-' . $preFilled['what']);
|
||||||
@ -102,7 +108,10 @@ class SplitController extends Controller
|
|||||||
|
|
||||||
return view(
|
return view(
|
||||||
'split.journals.edit',
|
'split.journals.edit',
|
||||||
compact('currencies', 'preFilled', 'amount', 'sourceAccounts', 'uploadSize', 'destinationAccounts', 'assetAccounts', 'budgets', 'journal')
|
compact(
|
||||||
|
'subTitleIcon', 'currencies', 'preFilled', 'subTitle', 'amount', 'sourceAccounts', 'uploadSize', 'destinationAccounts', 'assetAccounts',
|
||||||
|
'budgets', 'journal'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +68,7 @@ class TransactionController extends Controller
|
|||||||
$piggies = ExpandedForm::makeSelectListWithEmpty($piggyBanks);
|
$piggies = ExpandedForm::makeSelectListWithEmpty($piggyBanks);
|
||||||
$preFilled = Session::has('preFilled') ? session('preFilled') : [];
|
$preFilled = Session::has('preFilled') ? session('preFilled') : [];
|
||||||
$subTitle = trans('form.add_new_' . $what);
|
$subTitle = trans('form.add_new_' . $what);
|
||||||
|
$subTitleIcon = 'fa-plus';
|
||||||
|
|
||||||
Session::put('preFilled', $preFilled);
|
Session::put('preFilled', $preFilled);
|
||||||
|
|
||||||
@ -84,7 +85,7 @@ class TransactionController extends Controller
|
|||||||
asort($piggies);
|
asort($piggies);
|
||||||
|
|
||||||
|
|
||||||
return view('transactions.create', compact('assetAccounts', 'uploadSize', 'budgets', 'what', 'piggies', 'subTitle'));
|
return view('transactions.create', compact('assetAccounts', 'subTitleIcon', 'uploadSize', 'budgets', 'what', 'piggies', 'subTitle'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -502,6 +502,7 @@ Breadcrumbs::register(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TAGS
|
* TAGS
|
||||||
*/
|
*/
|
||||||
@ -579,3 +580,20 @@ Breadcrumbs::register(
|
|||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SPLIT
|
||||||
|
*/
|
||||||
|
Breadcrumbs::register(
|
||||||
|
'split.journal.edit', function (BreadCrumbGenerator $breadcrumbs, TransactionJournal $journal) {
|
||||||
|
$breadcrumbs->parent('transactions.show', $journal);
|
||||||
|
$breadcrumbs->push(trans('breadcrumbs.edit_journal', ['description' => $journal->description]), route('split.journal.edit', [$journal->id]));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
Breadcrumbs::register(
|
||||||
|
'split.journal.create', function (BreadCrumbGenerator $breadcrumbs, string $what) {
|
||||||
|
$breadcrumbs->parent('transactions.index', $what);
|
||||||
|
$breadcrumbs->push(trans('breadcrumbs.create_' . e($what)), route('split.journal.create', [$what]));
|
||||||
|
}
|
||||||
|
);
|
@ -482,6 +482,70 @@ class TestData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function createMultiTransfers()
|
||||||
|
{
|
||||||
|
foreach ($this->data['multi-transfers'] as $transfer) {
|
||||||
|
$journalId = DB::table('transaction_journals')->insertGetId(
|
||||||
|
[
|
||||||
|
'created_at' => DB::raw('NOW()'),
|
||||||
|
'updated_at' => DB::raw('NOW()'),
|
||||||
|
'user_id' => $transfer['user_id'],
|
||||||
|
'transaction_type_id' => 3,
|
||||||
|
'transaction_currency_id' => 1,
|
||||||
|
'description' => Crypt::encrypt($transfer['description']),
|
||||||
|
'completed' => 1,
|
||||||
|
'date' => $transfer['date'],
|
||||||
|
'interest_date' => $transfer['interest_date'] ?? null,
|
||||||
|
'book_date' => $transfer['book_date'] ?? null,
|
||||||
|
'process_date' => $transfer['process_date'] ?? null,
|
||||||
|
'encrypted' => 1,
|
||||||
|
'order' => 0,
|
||||||
|
'tag_count' => 0,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
foreach ($transfer['destination_ids'] as $index => $destination) {
|
||||||
|
$description = $transfer['description'] . ' (#' . ($index + 1) . ')';
|
||||||
|
$amount = $transfer['amounts'][$index];
|
||||||
|
$source = $transfer['source_ids'][$index];
|
||||||
|
$first = DB::table('transactions')->insertGetId(
|
||||||
|
[
|
||||||
|
'created_at' => DB::raw('NOW()'),
|
||||||
|
'updated_at' => DB::raw('NOW()'),
|
||||||
|
'account_id' => $source,
|
||||||
|
'transaction_journal_id' => $journalId,
|
||||||
|
'description' => $description,
|
||||||
|
'amount' => $amount * -1,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$second = DB::table('transactions')->insertGetId(
|
||||||
|
[
|
||||||
|
'created_at' => DB::raw('NOW()'),
|
||||||
|
'updated_at' => DB::raw('NOW()'),
|
||||||
|
'account_id' => $destination,
|
||||||
|
'transaction_journal_id' => $journalId,
|
||||||
|
'description' => $description,
|
||||||
|
'amount' => $amount,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isset($transfer['category_ids'][$index])) {
|
||||||
|
DB::table('category_transaction')->insert(
|
||||||
|
[
|
||||||
|
'category_id' => $transfer['category_ids'][$index],
|
||||||
|
'transaction_id' => $first,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
DB::table('category_transaction')->insert(
|
||||||
|
[
|
||||||
|
'category_id' => $transfer['category_ids'][$index],
|
||||||
|
'transaction_id' => $second,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -728,6 +792,7 @@ class TestData
|
|||||||
$this->createAttachments();
|
$this->createAttachments();
|
||||||
$this->createMultiWithdrawals();
|
$this->createMultiWithdrawals();
|
||||||
$this->createMultiDeposits();
|
$this->createMultiDeposits();
|
||||||
|
$this->createMultiTransfers();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,8 @@ return [
|
|||||||
'registered' => 'You have registered successfully!',
|
'registered' => 'You have registered successfully!',
|
||||||
'search' => 'Search',
|
'search' => 'Search',
|
||||||
'no_budget_pointer' => 'You seem to have no budgets yet. You should create some on the <a href="/budgets">budgets</a>-page. Budgets can help you keep track of expenses.',
|
'no_budget_pointer' => 'You seem to have no budgets yet. You should create some on the <a href="/budgets">budgets</a>-page. Budgets can help you keep track of expenses.',
|
||||||
|
'source_accounts' => 'Source account(s)',
|
||||||
|
'destination_accounts' => 'Destination account(s)',
|
||||||
|
|
||||||
// repeat frequencies:
|
// repeat frequencies:
|
||||||
'repeat_freq_monthly' => 'monthly',
|
'repeat_freq_monthly' => 'monthly',
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{% extends "./layout/default.twig" %}
|
{% extends "./layout/default.twig" %}
|
||||||
|
|
||||||
{% block breadcrumbs %}
|
{% block breadcrumbs %}
|
||||||
{{ Breadcrumbs.renderIfExists }}
|
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, preFilled.what) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<form method="POST" action="{{ route('split.journal.store',journal.id) }}" accept-charset="UTF-8" class="form-horizontal" id="update"
|
<form method="POST" action="{{ route('split.journal.store',journal.id) }}" accept-charset="UTF-8" class="form-horizontal" id="update"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{% extends "./layout/default.twig" %}
|
{% extends "./layout/default.twig" %}
|
||||||
|
|
||||||
{% block breadcrumbs %}
|
{% block breadcrumbs %}
|
||||||
{{ Breadcrumbs.renderIfExists }}
|
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, journal) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<form method="POST" action="{{ route('split.journal.update',journal.id) }}" accept-charset="UTF-8" class="form-horizontal" id="update"
|
<form method="POST" action="{{ route('split.journal.update',journal.id) }}" accept-charset="UTF-8" class="form-horizontal" id="update"
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
<h3 class="box-title">Metadata</h3>
|
<h3 class="box-title">Metadata</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-body table-responsive no-padding">
|
<div class="box-body table-responsive no-padding">
|
||||||
<table class="table table-hover sortable">
|
<table class="table table-hover">
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ trans('list.date') }}</td>
|
<td style="width:30%;">{{ trans('list.date') }}</td>
|
||||||
<td>{{ journal.date.formatLocalized(monthAndDayFormat) }}</td>
|
<td>{{ journal.date.formatLocalized(monthAndDayFormat) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% if journal.interest_date %}
|
{% if journal.interest_date %}
|
||||||
@ -50,18 +50,22 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% for budget in journal.budgets %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ 'budget'|_ }}</td>
|
<td>{{ 'budgets'|_ }}</td>
|
||||||
<td><a href="{{ route('budgets.show',budget.id) }}">{{ budget.name }}</a></td>
|
<td>{{ journalBudgets(journal)|raw }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
|
||||||
{% for category in journal.categories %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ 'category'|_ }}</td>
|
<td>{{ 'categories'|_ }}</td>
|
||||||
<td><a href="{{ route('categories.show',category.id) }}">{{ category.name }}</a></td>
|
<td>{{ journalCategories(journal)|raw }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{ 'source_accounts'|_ }}</td>
|
||||||
|
<td>{{ sourceAccount(journal)|raw }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{ 'destination_accounts'|_ }}</td>
|
||||||
|
<td>{{ destinationAccount(journal)|raw }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
|
||||||
{% if journal.bill %}
|
{% if journal.bill %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ 'bill'|_ }}</td>
|
<td>{{ 'bill'|_ }}</td>
|
||||||
|
@ -959,5 +959,52 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"multi-transfers": []
|
"multi-transfers": [
|
||||||
|
{
|
||||||
|
"user_id": 1,
|
||||||
|
"date": "2016-03-02",
|
||||||
|
"description": "Even multi-transfer (50, 50)",
|
||||||
|
"source_ids": [
|
||||||
|
4,
|
||||||
|
4
|
||||||
|
],
|
||||||
|
"destination_ids": [
|
||||||
|
5,
|
||||||
|
5
|
||||||
|
],
|
||||||
|
"amounts": [
|
||||||
|
50,
|
||||||
|
50
|
||||||
|
],
|
||||||
|
"category_ids": [
|
||||||
|
7,
|
||||||
|
8
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"user_id": 1,
|
||||||
|
"date": "2016-05-02",
|
||||||
|
"description": "Uneven multi-transfer (15,34,51)",
|
||||||
|
"source_ids": [
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
4
|
||||||
|
],
|
||||||
|
"destination_ids": [
|
||||||
|
5,
|
||||||
|
5,
|
||||||
|
5
|
||||||
|
],
|
||||||
|
"amounts": [
|
||||||
|
14,
|
||||||
|
35,
|
||||||
|
51
|
||||||
|
],
|
||||||
|
"category_ids": [
|
||||||
|
7,
|
||||||
|
8,
|
||||||
|
9
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user