mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-06 12:45:30 +00:00
New middleware that should make sure the new forms redirect as well.
This commit is contained in:
@@ -27,7 +27,6 @@ namespace FireflyIII\Http\Controllers\Transaction;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Class CreateController
|
||||
@@ -75,21 +74,19 @@ class CreateController extends Controller
|
||||
$subTitleIcon = 'fa-plus';
|
||||
$optionalFields = app('preferences')->get('transaction_journal_optional_fields', [])->data;
|
||||
$allowedOpposingTypes = config('firefly.allowed_opposing_types');
|
||||
$accountToTypes = config('firefly.account_to_transaction');
|
||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
||||
$accountToTypes = config('firefly.account_to_transaction');
|
||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
||||
$previousUri = $this->rememberPreviousUri('transactions.create.uri');
|
||||
|
||||
session()->put('preFilled', $preFilled);
|
||||
|
||||
// put previous url in session if not redirect from store (not "create another").
|
||||
if (true !== session('transactions.create.fromStore')) {
|
||||
$this->rememberPreviousUri('transactions.create.uri');
|
||||
}
|
||||
session()->forget('transactions.create.fromStore');
|
||||
|
||||
return view(
|
||||
'transactions.create',
|
||||
compact('subTitleIcon', 'cash',
|
||||
'objectType', 'subTitle', 'defaultCurrency',
|
||||
'optionalFields', 'preFilled', 'allowedOpposingTypes', 'accountToTypes')
|
||||
'transactions.create', compact(
|
||||
'subTitleIcon', 'cash', 'objectType', 'subTitle', 'defaultCurrency', 'previousUri', 'optionalFields', 'preFilled',
|
||||
'allowedOpposingTypes',
|
||||
'accountToTypes'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@@ -72,11 +72,9 @@ class EditController extends Controller
|
||||
$accountToTypes = config('firefly.account_to_transaction');
|
||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
||||
$cash = $repository->getCashAccount();
|
||||
$previousUri = $this->rememberPreviousUri('transactions.edit.uri');
|
||||
|
||||
return view('transactions.edit', compact('cash', 'transactionGroup', 'allowedOpposingTypes', 'accountToTypes', 'defaultCurrency'
|
||||
|
||||
));
|
||||
|
||||
return view('transactions.edit', compact('cash', 'transactionGroup', 'allowedOpposingTypes', 'accountToTypes', 'defaultCurrency', 'previousUri'));
|
||||
}
|
||||
|
||||
}
|
@@ -27,6 +27,7 @@ use FireflyIII\Http\Middleware\AuthenticateTwoFactor;
|
||||
use FireflyIII\Http\Middleware\Binder;
|
||||
use FireflyIII\Http\Middleware\EncryptCookies;
|
||||
use FireflyIII\Http\Middleware\Installer;
|
||||
use FireflyIII\Http\Middleware\InterestingMessage;
|
||||
use FireflyIII\Http\Middleware\IsAdmin;
|
||||
use FireflyIII\Http\Middleware\Range;
|
||||
use FireflyIII\Http\Middleware\RedirectIfAuthenticated;
|
||||
@@ -155,11 +156,11 @@ class Kernel extends HttpKernel
|
||||
ShareErrorsFromSession::class,
|
||||
VerifyCsrfToken::class,
|
||||
Authenticate::class,
|
||||
//AuthenticateTwoFactor::class,
|
||||
MFAMiddleware::class,
|
||||
Range::class,
|
||||
Binder::class,
|
||||
CreateFreshApiToken::class,
|
||||
InterestingMessage::class,
|
||||
],
|
||||
// MUST be logged in
|
||||
// MUST have 2fa
|
||||
|
118
app/Http/Middleware/InterestingMessage.php
Normal file
118
app/Http/Middleware/InterestingMessage.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* InterestingMessage.php
|
||||
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
*
|
||||
* Firefly III is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Firefly III 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace FireflyIII\Http\Middleware;
|
||||
|
||||
|
||||
use Closure;
|
||||
use FireflyIII\Models\TransactionGroup;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Illuminate\Http\Request;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class InterestingMessage
|
||||
*/
|
||||
class InterestingMessage
|
||||
{
|
||||
/**
|
||||
* Flashes the user an interesting message if the URL parameters warrant it.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
Log::debug(sprintf('Interesting Message middleware for URI %s', $request->url()));
|
||||
if ($this->testing()) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
if ($this->groupMessage($request)) {
|
||||
$this->handleGroupMessage($request);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function groupMessage(Request $request): bool
|
||||
{
|
||||
// get parameters from request.
|
||||
$transactionGroupId = $request->get('transaction_group_id');
|
||||
$message = $request->get('message');
|
||||
|
||||
return null !== $transactionGroupId && null !== $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*/
|
||||
private function handleGroupMessage(Request $request): void
|
||||
{
|
||||
|
||||
// get parameters from request.
|
||||
$transactionGroupId = $request->get('transaction_group_id');
|
||||
$message = $request->get('message');
|
||||
|
||||
// send message about newly created transaction group.
|
||||
/** @var TransactionGroup $group */
|
||||
$group = auth()->user()->transactionGroups()->with(['transactionJournals', 'transactionJournals.transactionType'])->find((int)$transactionGroupId);
|
||||
|
||||
if (null === $group) {
|
||||
return;
|
||||
}
|
||||
|
||||
$count = $group->transactionJournals->count();
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $group->transactionJournals->first();
|
||||
if (null === $journal) {
|
||||
return;
|
||||
}
|
||||
$title = $count > 1 ? $group->title : $journal->description;
|
||||
if ('created' === $message) {
|
||||
session()->flash('success_uri', route('transactions.show', [$transactionGroupId]));
|
||||
session()->flash('success', (string)trans('firefly.stored_journal', ['description' => $title]));
|
||||
}
|
||||
if ('updated' === $message) {
|
||||
$type = strtolower($journal->transactionType->type);
|
||||
session()->flash('success_uri', route('transactions.show', [$transactionGroupId]));
|
||||
session()->flash('success', (string)trans(sprintf('firefly.updated_%s', $type), ['description' => $title]));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
private function testing(): bool
|
||||
{
|
||||
// ignore middleware in test environment.
|
||||
return 'testing' === config('app.env') || !auth()->check();
|
||||
}
|
||||
}
|
@@ -149,20 +149,25 @@ trait UserNavigation
|
||||
}
|
||||
|
||||
/**
|
||||
* Remember previous URL.
|
||||
*
|
||||
* @param string $identifier
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
protected function rememberPreviousUri(string $identifier): void
|
||||
protected function rememberPreviousUri(string $identifier): ?string
|
||||
{
|
||||
$return = null;
|
||||
/** @var ViewErrorBag $errors */
|
||||
$errors = session()->get('errors');
|
||||
if (null === $errors || (null !== $errors && 0 === $errors->count())) {
|
||||
$url = app('url')->previous();
|
||||
session()->put($identifier, $url);
|
||||
$return = app('url')->previous();
|
||||
|
||||
// TODO URL might not be one we *want* to remember.
|
||||
|
||||
session()->put($identifier, $return);
|
||||
//Log::debug(sprintf('Will put previous URI in cache under key %s: %s', $identifier, $url));
|
||||
//return;
|
||||
}
|
||||
//Log::debug(sprintf('The users session contains errors somehow so we will not remember the URI!: %s', var_export($errors, true)));
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
2
public/v1/js/app.js
vendored
2
public/v1/js/app.js
vendored
File diff suppressed because one or more lines are too long
@@ -411,8 +411,9 @@
|
||||
button.prop("disabled", false);
|
||||
}
|
||||
} else {
|
||||
console.log('Will redirect to transaction.');
|
||||
window.location.href = 'transactions/show/' + groupId + '?message=created';
|
||||
console.log('Will redirect to previous URL. (' + previousUri + ')');
|
||||
window.location.href = window.previousUri + '?transaction_group_id=' + groupId+ '&message=created';
|
||||
//window.location.href = 'transactions/show/' + groupId + '?message=created';
|
||||
}
|
||||
},
|
||||
|
||||
|
@@ -627,7 +627,7 @@
|
||||
this.error_message = '';
|
||||
button.prop("disabled", false);
|
||||
} else {
|
||||
window.location.href = 'transactions/show/' + groupId + '?message=updated';
|
||||
window.location.href = window.previousUri + '?transaction_group_id=' + groupId+ '&message=updated';
|
||||
}
|
||||
},
|
||||
|
||||
|
@@ -39,6 +39,7 @@ return [
|
||||
'reports' => 'Reports',
|
||||
'search_result' => 'Search results for ":query"',
|
||||
'withdrawal_list' => 'Expenses',
|
||||
'Withdrawal_list' => 'Expenses',
|
||||
'deposit_list' => 'Revenue, income and deposits',
|
||||
'transfer_list' => 'Transfers',
|
||||
'transfers_list' => 'Transfers',
|
||||
|
@@ -5,252 +5,7 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{# TODO attachments #}
|
||||
|
||||
<create-transaction></create-transaction>
|
||||
|
||||
|
||||
{#
|
||||
<form method="POST" action="{{ route('transactions.store') }}" accept-charset="UTF-8" class="form-horizontal" id="store" enctype="multipart/form-data">
|
||||
<input name="_token" type="hidden" value="{{ csrf_token() }}">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">
|
||||
{{ 'split_transaction_title'|_ }}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<input type="text" class="form-control" name="group_title"
|
||||
title="{{ 'split_transaction_title'|_ }}" autocomplete="off" placeholder="{{ 'split_transaction_title'|_ }}">
|
||||
<p class="help-block">
|
||||
{{ 'split_title_help'|_ }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="transactions">
|
||||
<div class="row transactionRow">
|
||||
<div class="col-lg-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title splitTitle">
|
||||
{{ 'transaction_information'|_ }}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="col-lg-4">
|
||||
<div class="form-group transactionTypeIndicatorBlock" style="display:none;">
|
||||
<div class="col-sm-12">
|
||||
<label class="control-label transactionTypeIndicator text-info"></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" data-index="0" class="form-control indexField sourceAccountAC" name="source[]"
|
||||
title="{{ trans('form.source_account') }}" autocomplete="off"
|
||||
placeholder="{{ trans('form.source_account') }}">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default clearSource" type="button"><i class="fa fa-trash-o"></i></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<div class="input-group">
|
||||
<input data-index="0" type="text" class="form-control indexField destinationAccountAC" name="destination[]"
|
||||
title="{{ trans('form.destination_account') }}" autocomplete="off"
|
||||
placeholder="{{ trans('form.destination_account') }}">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default clearDestination" type="button"><i class="fa fa-trash-o"></i></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<input type="text" class="form-control" name="description[]"
|
||||
title="{{ trans('form.description') }}" autocomplete="off" placeholder="{{ trans('form.description') }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<input type="date" class="form-control" name="date[]"
|
||||
title="{{ trans('form.date') }}" value="{{ phpdate('Y-m-d') }}" autocomplete="off"
|
||||
placeholder="{{ trans('form.date') }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">$</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="number" step="any" class="form-control" name="amount[]"
|
||||
title="{{ trans('form.amount') }}" autocomplete="off" placeholder="{{ trans('form.amount') }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-3">
|
||||
<select name="foreign_amount">
|
||||
<option>none</option>
|
||||
<option>USD</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<input type="number" step="any" class="form-control" name="amount[]"
|
||||
title="Foreign amount" autocomplete="off" placeholder="Foreign amount">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<select name="budget">
|
||||
<option>budget</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<input type="text" class="form-control" name="category[]"
|
||||
title="Category" autocomplete="off" placeholder="Category">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<input type="text" class="form-control" name="tags[]"
|
||||
title="Tags" autocomplete="off" placeholder="Tags">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<select name="piggy">
|
||||
<option>Piggy</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% if
|
||||
optionalFields.interest_date or optionalFields.book_date or optionalFields.process_date
|
||||
or optionalFields.due_date or optionalFields.payment_date
|
||||
or optionalFields.invoice_date %}
|
||||
{% for field in ['interest_date','book_date','process_date','due_date','payment_date','invoice_date'] %}
|
||||
{% if optionalFields[field] %}
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<input type="text" class="form-control" name="{{ field }}[]"
|
||||
title="{{ field }}" autocomplete="off" placeholder="{{ field }}">
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if optionalFields.internal_reference or optionalFields.notes %}
|
||||
|
||||
{% if optionalFields.internal_reference %}
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<input type="text" class="form-control" name="internal_reference[]"
|
||||
title="internal_reference" autocomplete="off" placeholder="internal_reference">
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if optionalFields.notes %}
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<textarea></textarea>
|
||||
<br>
|
||||
{{ trans('firefly.field_supports_markdown')|raw }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if optionalFields.attachments %}
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
|
||||
<input multiple="multiple" class="form-control"
|
||||
autocomplete="off" placeholder="Attachments" name="attachments[]" type="file">
|
||||
<p class="help-block">
|
||||
{{ trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if
|
||||
not optionalFields.interest_date or
|
||||
not optionalFields.book_date or
|
||||
not optionalFields.process_date or
|
||||
not optionalFields.due_date or
|
||||
not optionalFields.payment_date or
|
||||
not optionalFields.invoice_date or
|
||||
not optionalFields.internal_reference or
|
||||
not optionalFields.notes or
|
||||
not optionalFields.attachments %}
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<p class="text-success"><i class="fa fa-info-circle"></i>
|
||||
<em>{{ trans('firefly.hidden_fields_preferences', {link: route('preferences.index')})|raw }}</em></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<p>
|
||||
<button id="addSplitButton" class="btn btn-primary">Add another split</button>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'options'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{{ ExpandedForm.optionsList('create','transaction') }}
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="transaction-btn btn btn-success pull-right">
|
||||
{{ trans('form.store_new_transaction') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
#}
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script type="text/javascript">
|
||||
@@ -258,34 +13,6 @@
|
||||
var accountToTypes = {{ accountToTypes|json_encode|raw }};
|
||||
var defaultCurrency = {{ defaultCurrency.toArray()|json_encode|raw }};
|
||||
var cashAccountId = {{ cash.id }};
|
||||
var previousUri = '{{ previousUri }}';
|
||||
</script>
|
||||
<!--
|
||||
<script type="text/javascript">
|
||||
var transactionType = 'none';
|
||||
|
||||
var accountToTypes = {{ accountToTypes|json_encode|raw }};
|
||||
|
||||
var creatingTypes = {
|
||||
Transfer: "{{ 'you_create_transfer'|_ }}",
|
||||
Withdrawal: "{{ 'you_create_withdrawal'|_ }}",
|
||||
Deposit: "{{ 'you_create_deposit'|_ }}",
|
||||
};
|
||||
|
||||
// options for source account selection.
|
||||
var sourceAccount = null;
|
||||
var sourceAllowedAccountTypes = [];
|
||||
|
||||
// options for destination account selection.
|
||||
var destinationAccount = null;
|
||||
var destAllowedAccountTypes = [];
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="v1/js/lib/modernizr-custom.js?v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript" src="v1/js/lib/jquery.autocomplete.min.js?v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript" src="v1/js/ff/transactions/create.js?v={{ FF_VERSION }}"></script>
|
||||
-->
|
||||
{% endblock %}
|
||||
|
||||
{% block styles %}
|
||||
{% endblock %}
|
||||
|
@@ -6,250 +6,6 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{#
|
||||
<form method="POST" action="{{ route('transactions.update',journal.id) }}" accept-charset="UTF-8" class="form-horizontal" id="update"
|
||||
enctype="multipart/form-data">
|
||||
|
||||
<input name="_token" type="hidden" value="{{ csrf_token() }}">
|
||||
<input type="hidden" name="id" value="{{ journal.id }}"/>
|
||||
<input type="hidden" name="what" value="{{ what }}"/>
|
||||
|
||||
{% if errors.all|length > 0 %}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h3 class="text-danger">{{ 'errors'|_ }}</h3>
|
||||
<ul>
|
||||
{% for err in errors.all %}
|
||||
<li class="text-danger">{{ err }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'mandatoryFields'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
|
||||
<!-- ALWAYS AVAILABLE -->
|
||||
{{ ExpandedForm.text('description',journal.description) }}
|
||||
|
||||
<!-- SELECTABLE SOURCE ACCOUNT ONLY FOR WITHDRAWALS AND TRANSFERS -->
|
||||
{% if what == 'transfer' or what == 'withdrawal' %}
|
||||
{{ ExpandedForm.longAccountList('source_id', data.source_id, {label: trans('form.asset_source_account')}) }}
|
||||
{% endif %}
|
||||
|
||||
<!-- FREE FORMAT SOURCE ACCOUNT ONLY FOR DEPOSITS -->
|
||||
{% if what == 'deposit' %}
|
||||
{{ ExpandedForm.text('source_name',data.source_name, {label: trans('form.revenue_account')}) }}
|
||||
{% endif %}
|
||||
|
||||
<!-- FREE FORMAT DESTINATION ACCOUNT ONLY FOR EXPENSES -->
|
||||
{% if what == 'withdrawal' %}
|
||||
{{ ExpandedForm.text('destination_name',data.destination_name, {label: trans('form.expense_account')}) }}
|
||||
{% endif %}
|
||||
|
||||
<!-- SELECTABLE DESTINATION ACCOUNT ONLY FOR TRANSFERS AND DEPOSITS -->
|
||||
{% if what == 'transfer' or what == 'deposit' %}
|
||||
{{ ExpandedForm.longAccountList('destination_id', data.destination_id, {label: trans('form.asset_destination_account')} ) }}
|
||||
{% endif %}
|
||||
|
||||
<!-- ALWAYS SHOW AMOUNT -->
|
||||
{{ ExpandedForm.amount('amount',data.amount, {'currency' : data.currency}) }}
|
||||
|
||||
<!-- INSTRUCTIONS FOR EXCHANGE RATES -->
|
||||
{{ ExpandedForm.staticText('exchange_rate_instruction','(here be text)') }}
|
||||
|
||||
{{ ExpandedForm.nonSelectableAmount('native_amount', data.native_amount, {currency: data.native_currency}) }}
|
||||
|
||||
{{ ExpandedForm.nonSelectableAmount('source_amount', data.source_amount, {currency: data.source_currency }) }}
|
||||
|
||||
{{ ExpandedForm.nonSelectableAmount('destination_amount', data.destination_amount, {currency: data.destination_currency }) }}
|
||||
|
||||
<!-- ALWAYS SHOW DATE -->
|
||||
{{ ExpandedForm.date('date',data['date']) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'optionalFields'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{% if what == 'withdrawal' %}
|
||||
{% if budgetList|length > 1 %}
|
||||
{{ ExpandedForm.select('budget_id', budgetList, data['budget_id']) }}
|
||||
{% else %}
|
||||
{{ ExpandedForm.select('budget_id', budgetList, data['budget_id'], {helpText: trans('firefly.no_budget_pointer', {link: route('budgets.index')})}) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{{ ExpandedForm.text('category',data['category']) }}
|
||||
{{ ExpandedForm.text('tags') }}
|
||||
|
||||
{% if data.bill_id != null %}
|
||||
{{ ExpandedForm.checkbox('keep_bill_id',1,true, {'helpText': trans('firefly.journal_link_bill', {name: data.bill_name,route: route('bills.show', [data.bill_id])})} ) }}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% if
|
||||
not optionalFields.interest_date or
|
||||
not optionalFields.book_date or
|
||||
not optionalFields.process_date or
|
||||
not optionalFields.due_date or
|
||||
not optionalFields.payment_date or
|
||||
not optionalFields.invoice_date or
|
||||
not optionalFields.internal_reference or
|
||||
not optionalFields.notes or
|
||||
not optionalFields.attachments %}
|
||||
<p class="text-center text-success"><i class="fa fa-info-circle"></i>
|
||||
<em>{{ trans('firefly.hidden_fields_preferences', {link: route('preferences.index')})|raw }}</em></p>
|
||||
{% endif %}
|
||||
{% if
|
||||
optionalFields.interest_date or
|
||||
optionalFields.book_date or
|
||||
optionalFields.process_date or
|
||||
optionalFields.due_date or
|
||||
optionalFields.payment_date or
|
||||
optionalFields.invoice_date or
|
||||
data.interest_date or
|
||||
data.book_date or
|
||||
data.process_date or
|
||||
data.due_date or
|
||||
data.payment_date %}
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'optional_field_meta_dates'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
|
||||
{% if optionalFields.interest_date or data['interest_date'] %}
|
||||
{{ ExpandedForm.date('interest_date',data['interest_date']) }}
|
||||
{% endif %}
|
||||
|
||||
{% if optionalFields.book_date or data['book_date'] %}
|
||||
{{ ExpandedForm.date('book_date',data['book_date']) }}
|
||||
{% endif %}
|
||||
|
||||
{% if optionalFields.process_date or data['process_date'] %}
|
||||
{{ ExpandedForm.date('process_date',data['process_date']) }}
|
||||
{% endif %}
|
||||
|
||||
{% if optionalFields.due_date or data['due_date'] %}
|
||||
{{ ExpandedForm.date('due_date',data['due_date']) }}
|
||||
{% endif %}
|
||||
|
||||
{% if optionalFields.payment_date or data['payment_date'] %}
|
||||
{{ ExpandedForm.date('payment_date',data['payment_date']) }}
|
||||
{% endif %}
|
||||
|
||||
{% if optionalFields.invoice_date or data['invoice_date'] %}
|
||||
{{ ExpandedForm.date('invoice_date',data['invoice_date']) }}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if
|
||||
optionalFields.internal_reference or
|
||||
optionalFields.notes or
|
||||
data['interal_reference'] or
|
||||
data['notes'] %}
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'optional_field_meta_business'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{% if optionalFields.internal_reference or data['interal_reference'] %}
|
||||
{{ ExpandedForm.text('internal_reference', data['interal_reference']) }}
|
||||
{% endif %}
|
||||
|
||||
{% if optionalFields.notes or data['notes'] %}
|
||||
{{ ExpandedForm.textarea('notes', data['notes'], {helpText: trans('firefly.field_supports_markdown')}) }}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if optionalFields.attachments or journal.attachments|length > 0 %}
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'optional_field_attachments'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{% if journal.attachments|length > 0 %}
|
||||
<div id="att_holder_attachments" class="form-group">
|
||||
<label class="col-sm-4 control-label">
|
||||
{{ trans('form.existing_attachments') }}
|
||||
</label>
|
||||
<div class="col-sm-8">
|
||||
{% for att in journal.attachments %}
|
||||
<div class="row att_row" data-id="{{ att.id }}">
|
||||
<div class="col-lg-1"><a href="{{ route('attachments.delete', att.id) }}" data-id="{{ att.id }}" class="del_att btn btn-danger btn-xs"><i class="fa fa-trash"></i></a></div>
|
||||
<div class="col-lg-11">
|
||||
<a href="{{ route('attachments.view', att.id) }}" title="{{ att.filename }}">
|
||||
{% if att.title %}
|
||||
{{ att.title }} ({{ att.filename }})
|
||||
{% else %}
|
||||
{{ att.filename }}
|
||||
{% endif %}
|
||||
</a>
|
||||
({{ att.size|filesize }})
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- panel for options -->
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'options'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{{ ExpandedForm.optionsList('update','transaction') }}
|
||||
|
||||
<div class="form-group" id="do_split_holder">
|
||||
<label for="ffInput_do_split" class="col-sm-4 control-label">{{ 'do_split'|_ }}</label>
|
||||
|
||||
<div class="col-sm-8">
|
||||
<p class="form-control-static">
|
||||
<a href="{{ route('transactions.split.edit', journal.id) }}">{{ ('split_this_'~what)|_ }}</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="pull-right btn btn-success">{{ ('update_' ~ what)|_ }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="source_account_currency" value="0"/>
|
||||
<input type="hidden" name="destination_account_currency" value="0"/>
|
||||
</form>
|
||||
#}
|
||||
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script type="text/javascript">
|
||||
@@ -257,32 +13,8 @@
|
||||
var accountToTypes = {{ accountToTypes|json_encode|raw }};
|
||||
var defaultCurrency = {{ defaultCurrency.toArray()|json_encode|raw }};
|
||||
var cashAccountId = {{ cash.id }};
|
||||
var previousUri = '{{ previousUri }}';
|
||||
</script>
|
||||
{#
|
||||
<script type="text/javascript">
|
||||
var what = "{{ what }}";
|
||||
</script>
|
||||
<script type="text/javascript" src="v1/js/lib/typeahead/typeahead.bundle.min.js?v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript" src="v1/js/ff/common/autocomplete.js?v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript" src="v1/js/lib/bootstrap-tagsinput.min.js?v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript" src="v1/js/lib/jquery-ui.min.js?v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript" src="v1/js/lib/modernizr-custom.js?v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript" src="v1/jscript/accounts?ext=.js&v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript" src="v1/jscript/currencies?ext=.js&v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript">
|
||||
var journal = {{ journal.toArray()|json_encode|raw }};
|
||||
var journalData = {{ data|json_encode|raw }};
|
||||
var exchangeRateInstructions = "{{ 'exchange_rate_instructions'|_|escape('js') }}";
|
||||
var transferInstructions = "{{ 'transfer_exchange_rate_instructions'|_|escape('js') }}";
|
||||
</script>
|
||||
<script type="text/javascript" src="v1/js/ff/transactions/single/common.js?v={{ FF_VERSION }}"></script>
|
||||
<script type="text/javascript" src="v1/js/ff/transactions/single/edit.js?v={{ FF_VERSION }}"></script>
|
||||
#}
|
||||
{% endblock %}
|
||||
{% block styles %}
|
||||
{#
|
||||
<link href="v1/css/bootstrap-tagsinput.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all">
|
||||
<link href="v1/css/jquery-ui/jquery-ui.structure.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all">
|
||||
<link href="v1/css/jquery-ui/jquery-ui.theme.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all">
|
||||
#}
|
||||
{% endblock %}
|
||||
|
Reference in New Issue
Block a user