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')));
|
||||
$currencies = ExpandedForm::makeSelectList($currencyRepository->get());
|
||||
$budgets = ExpandedForm::makeSelectListWithEmpty($budgetRepository->getActiveBudgets());
|
||||
$subTitle = trans('form.add_new_' . $sessionData['what']);
|
||||
$subTitleIcon = 'fa-plus';
|
||||
$preFilled = [
|
||||
'what' => $sessionData['what'] ?? 'withdrawal',
|
||||
'journal_amount' => $sessionData['amount'] ?? 0,
|
||||
@ -71,7 +73,9 @@ class SplitController extends Controller
|
||||
'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']));
|
||||
$budgets = ExpandedForm::makeSelectListWithEmpty($budgetRepository->getActiveBudgets());
|
||||
$preFilled = $this->arrayFromJournal($request, $journal);
|
||||
$subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]);
|
||||
$subTitleIcon = 'fa-pencil';
|
||||
|
||||
Session::flash('gaEventCategory', 'transactions');
|
||||
Session::flash('gaEventAction', 'edit-split-' . $preFilled['what']);
|
||||
@ -102,7 +108,10 @@ class SplitController extends Controller
|
||||
|
||||
return view(
|
||||
'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);
|
||||
$preFilled = Session::has('preFilled') ? session('preFilled') : [];
|
||||
$subTitle = trans('form.add_new_' . $what);
|
||||
$subTitleIcon = 'fa-plus';
|
||||
|
||||
Session::put('preFilled', $preFilled);
|
||||
|
||||
@ -84,7 +85,7 @@ class TransactionController extends Controller
|
||||
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
|
||||
*/
|
||||
@ -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->createMultiWithdrawals();
|
||||
$this->createMultiDeposits();
|
||||
$this->createMultiTransfers();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -70,6 +70,8 @@ return [
|
||||
'registered' => 'You have registered successfully!',
|
||||
'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.',
|
||||
'source_accounts' => 'Source account(s)',
|
||||
'destination_accounts' => 'Destination account(s)',
|
||||
|
||||
// repeat frequencies:
|
||||
'repeat_freq_monthly' => 'monthly',
|
||||
@ -811,7 +813,7 @@ return [
|
||||
'split_intro_three_withdrawal' => 'For example: you could split your :total groceries so you pay :split_one from your "daily groceries" budget and :split_two from your "cigarettes" budget.',
|
||||
'split_table_intro_withdrawal' => 'Split your withdrawal in as many things as you want. By default the transaction will not split, there is just one entry. Add as many splits as you want to, below. Remember that you should not deviate from your total amount. If you do, Firefly will warn you but not correct you.',
|
||||
'store_splitted_withdrawal' => 'Store splitted withdrawal',
|
||||
'update_splitted_withdrawal' => 'Update splitted withdrawal',
|
||||
'update_splitted_withdrawal' => 'Update splitted withdrawal',
|
||||
|
||||
'split_title_deposit' => 'Split your new deposit',
|
||||
'split_intro_one_deposit' => 'Firefly supports the "splitting" of a deposit.',
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% extends "./layout/default.twig" %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{{ Breadcrumbs.renderIfExists }}
|
||||
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, preFilled.what) }}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<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" %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{{ Breadcrumbs.renderIfExists }}
|
||||
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, journal) }}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<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>
|
||||
</div>
|
||||
<div class="box-body table-responsive no-padding">
|
||||
<table class="table table-hover sortable">
|
||||
<table class="table table-hover">
|
||||
<tr>
|
||||
<td>{{ trans('list.date') }}</td>
|
||||
<td style="width:30%;">{{ trans('list.date') }}</td>
|
||||
<td>{{ journal.date.formatLocalized(monthAndDayFormat) }}</td>
|
||||
</tr>
|
||||
{% if journal.interest_date %}
|
||||
@ -50,18 +50,22 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% for budget in journal.budgets %}
|
||||
<tr>
|
||||
<td>{{ 'budget'|_ }}</td>
|
||||
<td><a href="{{ route('budgets.show',budget.id) }}">{{ budget.name }}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% for category in journal.categories %}
|
||||
<tr>
|
||||
<td>{{ 'category'|_ }}</td>
|
||||
<td><a href="{{ route('categories.show',category.id) }}">{{ category.name }}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr>
|
||||
<td>{{ 'budgets'|_ }}</td>
|
||||
<td>{{ journalBudgets(journal)|raw }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ 'categories'|_ }}</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>
|
||||
{% if journal.bill %}
|
||||
<tr>
|
||||
<td>{{ 'bill'|_ }}</td>
|
||||
@ -114,43 +118,43 @@
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
{% if journal.attachments|length > 0 %}
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'attachments'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body table-responsive no-padding">
|
||||
<table class="table table-hover">
|
||||
{% for att in journal.attachments %}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="btn-group btn-group-xs">
|
||||
<a href="{{ route('attachments.edit', att.id) }}" class="btn btn-default"><i class="fa fa-pencil"></i></a>
|
||||
<a href="{{ route('attachments.delete', att.id) }}" class="btn btn-danger"><i class="fa fa-trash"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<i class="fa {{ att.mime|mimeIcon }}"></i>
|
||||
<a href="{{ route('attachments.download', att.id) }}" title="{{ att.filename }}">
|
||||
{% if att.title %}
|
||||
{{ att.title }}
|
||||
{% else %}
|
||||
{{ att.filename }}
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'attachments'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body table-responsive no-padding">
|
||||
<table class="table table-hover">
|
||||
{% for att in journal.attachments %}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="btn-group btn-group-xs">
|
||||
<a href="{{ route('attachments.edit', att.id) }}" class="btn btn-default"><i class="fa fa-pencil"></i></a>
|
||||
<a href="{{ route('attachments.delete', att.id) }}" class="btn btn-danger"><i class="fa fa-trash"></i></a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<i class="fa {{ att.mime|mimeIcon }}"></i>
|
||||
<a href="{{ route('attachments.download', att.id) }}" title="{{ att.filename }}">
|
||||
{% if att.title %}
|
||||
{{ att.title }}
|
||||
{% else %}
|
||||
{{ att.filename }}
|
||||
{% endif %}
|
||||
</a>
|
||||
({{ att.size|filesize }})
|
||||
{% if att.description %}
|
||||
<br/>
|
||||
<em>{{ att.description }}</em>
|
||||
{% endif %}
|
||||
</a>
|
||||
({{ att.size|filesize }})
|
||||
{% if att.description %}
|
||||
<br/>
|
||||
<em>{{ att.description }}</em>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td style="width:100px;">
|
||||
<img src="{{ route('attachments.preview', att.id) }}"/>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</td>
|
||||
<td style="width:100px;">
|
||||
<img src="{{ route('attachments.preview', att.id) }}"/>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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