Some code for new optional fields, see #301

Signed-off-by: James Cole <thegrumpydictator@gmail.com>
This commit is contained in:
James Cole 2016-09-04 16:21:51 +02:00
parent ce003f217b
commit 6c5cd705c0
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
11 changed files with 466 additions and 145 deletions

View File

@ -14,7 +14,7 @@ use Auth;
use FireflyIII\Crud\Account\AccountCrudInterface;
use FireflyIII\Http\Requests\TokenFormRequest;
use FireflyIII\Models\AccountType;
use Input;
use Illuminate\Http\Request;
use PragmaRX\Google2FA\Contracts\Google2FA;
use Preferences;
use Session;
@ -84,6 +84,7 @@ class PreferencesController extends Controller
$customFiscalYear = Preferences::get('customFiscalYear', 0)->data;
$fiscalYearStartStr = Preferences::get('fiscalYearStart', '01-01')->data;
$fiscalYearStart = date('Y') . '-' . $fiscalYearStartStr;
$tjOptionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
$is2faEnabled = Preferences::get('twoFactorAuthEnabled', 0)->data; // twoFactorAuthEnabled
$has2faSecret = !is_null(Preferences::get('twoFactorAuthSecret')); // hasTwoFactorAuthSecret
$showIncomplete = env('SHOW_INCOMPLETE_TRANSLATIONS', false) === true;
@ -91,7 +92,7 @@ class PreferencesController extends Controller
return view(
'preferences.index',
compact(
'language', 'accounts', 'frontPageAccounts',
'language', 'accounts', 'frontPageAccounts', 'tjOptionalFields',
'viewRange', 'customFiscalYear', 'transactionPageSize', 'fiscalYearStart', 'is2faEnabled',
'has2faSecret', 'showIncomplete'
)
@ -115,34 +116,36 @@ class PreferencesController extends Controller
}
/**
* @return \Illuminate\Http\RedirectResponse
* @param Request $request
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function postIndex()
public function postIndex(Request $request)
{
// front page accounts
$frontPageAccounts = [];
if (is_array(Input::get('frontPageAccounts'))) {
foreach (Input::get('frontPageAccounts') as $id) {
if (is_array($request->get('frontPageAccounts'))) {
foreach ($request->get('frontPageAccounts') as $id) {
$frontPageAccounts[] = intval($id);
}
Preferences::set('frontPageAccounts', $frontPageAccounts);
}
// view range:
Preferences::set('viewRange', Input::get('viewRange'));
Preferences::set('viewRange', $request->get('viewRange'));
// forget session values:
Session::forget('start');
Session::forget('end');
Session::forget('range');
// custom fiscal year
$customFiscalYear = intval(Input::get('customFiscalYear')) === 1;
$fiscalYearStart = date('m-d', strtotime(Input::get('fiscalYearStart')));
$customFiscalYear = intval($request->get('customFiscalYear')) === 1;
$fiscalYearStart = date('m-d', strtotime($request->get('fiscalYearStart')));
Preferences::set('customFiscalYear', $customFiscalYear);
Preferences::set('fiscalYearStart', $fiscalYearStart);
// save page size:
$transactionPageSize = intval(Input::get('transactionPageSize'));
$transactionPageSize = intval($request->get('transactionPageSize'));
if ($transactionPageSize > 0 && $transactionPageSize < 1337) {
Preferences::set('transactionPageSize', $transactionPageSize);
} else {
@ -150,7 +153,7 @@ class PreferencesController extends Controller
}
// two factor auth
$twoFactorAuthEnabled = intval(Input::get('twoFactorAuthEnabled'));
$twoFactorAuthEnabled = intval($request->get('twoFactorAuthEnabled'));
$hasTwoFactorAuthSecret = !is_null(Preferences::get('twoFactorAuthSecret'));
// If we already have a secret, just set the two factor auth enabled to 1, and let the user continue with the existing secret.
@ -159,11 +162,25 @@ class PreferencesController extends Controller
}
// language:
$lang = Input::get('language');
$lang = $request->get('language');
if (in_array($lang, array_keys(config('firefly.languages')))) {
Preferences::set('language', $lang);
}
// optional fields for transactions:
$setOptions = $request->get('tj');
$optionalTj = [
'interest_date' => isset($setOptions['interest_date']),
'book_date' => isset($setOptions['book_date']),
'process_date' => isset($setOptions['process_date']),
'due_date' => isset($setOptions['due_date']),
'payment_date' => isset($setOptions['payment_date']),
'internal_reference' => isset($setOptions['internal_reference']),
'notes' => isset($setOptions['notes']),
'attachments' => isset($setOptions['attachments']),
];
Preferences::set('transaction_journal_optional_fields', $optionalTj);
Session::flash('success', strval(trans('firefly.saved_preferences')));
Preferences::mark();

View File

@ -67,6 +67,7 @@ class SplitController extends Controller
$budgets = ExpandedForm::makeSelectListWithEmpty($budgetRepository->getActiveBudgets());
$piggyBanks = ExpandedForm::makeSelectListWithEmpty($piggyRepository->getPiggyBanksWithAmount());
$subTitle = trans('form.add_new_' . $sessionData['what']);
$optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
$subTitleIcon = 'fa-plus';
$preFilled = [
'what' => $sessionData['what'] ?? 'withdrawal',
@ -83,7 +84,7 @@ class SplitController extends Controller
return view(
'split.journals.create',
compact('journal', 'piggyBanks', 'subTitle', 'subTitleIcon', 'preFilled', 'assetAccounts', 'currencies', 'budgets', 'uploadSize')
compact('journal', 'piggyBanks', 'subTitle', 'optionalFields', 'subTitleIcon', 'preFilled', 'assetAccounts', 'currencies', 'budgets', 'uploadSize')
);
}
@ -101,6 +102,7 @@ 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());
$assetAccounts = ExpandedForm::makeSelectList($crud->getAccountsByType(['Default account', 'Asset account']));
$optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
$budgets = ExpandedForm::makeSelectListWithEmpty($budgetRepository->getActiveBudgets());
$preFilled = $this->arrayFromJournal($request, $journal);
$subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]);
@ -118,7 +120,8 @@ class SplitController extends Controller
return view(
'split.journals.edit',
compact(
'subTitleIcon', 'currencies', 'preFilled', 'subTitle', 'amount', 'sourceAccounts', 'uploadSize', 'destinationAccounts', 'assetAccounts',
'subTitleIcon', 'currencies', 'optionalFields',
'preFilled', 'subTitle', 'amount', 'sourceAccounts', 'uploadSize', 'destinationAccounts', 'assetAccounts',
'budgets', 'journal'
)
);

View File

@ -65,6 +65,7 @@ class TransactionController extends Controller
$preFilled = Session::has('preFilled') ? session('preFilled') : [];
$subTitle = trans('form.add_new_' . $what);
$subTitleIcon = 'fa-plus';
$optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
Session::put('preFilled', $preFilled);
@ -80,7 +81,7 @@ class TransactionController extends Controller
asort($piggies);
return view('transactions.create', compact('assetAccounts', 'subTitleIcon', 'uploadSize', 'budgets', 'what', 'piggies', 'subTitle'));
return view('transactions.create', compact('assetAccounts', 'subTitleIcon', 'uploadSize', 'budgets', 'what', 'piggies', 'subTitle', 'optionalFields'));
}
/**
@ -148,6 +149,7 @@ class TransactionController extends Controller
$subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]);
$sourceAccounts = TransactionJournal::sourceAccountList($journal);
$destinationAccounts = TransactionJournal::destinationAccountList($journal);
$optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
$preFilled = [
'date' => TransactionJournal::dateAsString($journal),
'interest_date' => TransactionJournal::dateAsString($journal, 'interest_date'),
@ -183,9 +185,10 @@ class TransactionController extends Controller
}
Session::forget('transactions.edit.fromUpdate');
return view('transactions.edit', compact('journal', 'uploadSize', 'assetAccounts', 'what', 'budgetList', 'piggyBankList', 'subTitle'))->with(
'data', $preFilled
);
return view(
'transactions.edit',
compact('journal', 'optionalFields', 'uploadSize', 'assetAccounts', 'what', 'budgetList', 'piggyBankList', 'subTitle')
)->with('data', $preFilled);
}
/**

View File

@ -283,6 +283,23 @@ return [
'transaction_page_size_label' => 'Page size',
'budget_maximum' => 'Budget maximum',
'between_dates' => '(:start and :end)',
'pref_optional_fields_transaction' => 'Optional fields for transactions',
'pref_optional_fields_transaction_help' => 'By default not all fields are enabled when creating a new transaction (because of the clutter). Below, you can enable these fields if you think they could be useful for you. Of course, any field that is disabled, but already filled in, will be visible regardless of the setting.',
'optional_tj_date_fields' => 'Date fields',
'optional_tj_business_fields' => 'Business fields',
'optional_tj_attachment_fields' => 'Attachment fields',
'pref_optional_tj_interest_date' => 'Interest date',
'pref_optional_tj_book_date' => 'Book date',
'pref_optional_tj_process_date' => 'Processing date',
'pref_optional_tj_due_date' => 'Due date',
'pref_optional_tj_payment_date' => 'Payment date',
'pref_optional_tj_internal_reference' => 'Internal reference',
'pref_optional_tj_notes' => 'Notes',
'pref_optional_tj_attachments' => 'Attachments',
'optional_field_meta_dates' => 'Dates',
'optional_field_meta_business' => 'Business',
'optional_field_attachments' => 'Attachments',
// profile:
'change_your_password' => 'Change your password',
@ -725,82 +742,82 @@ return [
'domain_is_now_blocked' => 'Domain :domain is now blocked',
'instance_configuration' => 'Configuration',
'firefly_instance_configuration' => 'Configuration options for Firefly III',
'setting_single_user_mode' => 'Single user mode',
'setting_single_user_mode_explain' => 'By default, Firefly III only accepts one (1) registration: you. This is a security measure, preventing others from using your instance unless you allow them to. Future registrations are blocked. When you uncheck this box, others can use your instance as wel, assuming they can reach it (when it is connected to the internet).',
'store_configuration' => 'Store configuration',
'setting_single_user_mode' => 'Single user mode',
'setting_single_user_mode_explain' => 'By default, Firefly III only accepts one (1) registration: you. This is a security measure, preventing others from using your instance unless you allow them to. Future registrations are blocked. When you uncheck this box, others can use your instance as wel, assuming they can reach it (when it is connected to the internet).',
'store_configuration' => 'Store configuration',
'hidden_fields_preferences' => 'Not all fields are visible right now. You must enable them in your <a href=":link">settings</a>.',
// split a transaction:
'transaction_meta_data' => 'Transaction meta-data',
'transaction_dates' => 'Transaction dates',
'splits' => 'Splits',
'split_title_withdrawal' => 'Split your new withdrawal',
'split_intro_one_withdrawal' => 'Firefly supports the "splitting" of a withdrawal.',
'split_intro_two_withdrawal' => 'It means that the amount of money you\'ve spent is divided between several destination expense accounts, budgets or categories.',
'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',
'split_title_deposit' => 'Split your new deposit',
'split_intro_one_deposit' => 'Firefly supports the "splitting" of a deposit.',
'split_intro_two_deposit' => 'It means that the amount of money you\'ve earned is divided between several source revenue accounts or categories.',
'split_intro_three_deposit' => 'For example: you could split your :total salary so you get :split_one as your base salary and :split_two as a reimbursment for expenses made.',
'split_table_intro_deposit' => 'Split your deposit 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_deposit' => 'Store splitted deposit',
'split_title_transfer' => 'Split your new transfer',
'split_intro_one_transfer' => 'Firefly supports the "splitting" of a transfer.',
'split_intro_two_transfer' => 'It means that the amount of money you\'re moving is divided between several categories or piggy banks.',
'split_intro_three_transfer' => 'For example: you could split your :total move so you get :split_one in one piggy bank and :split_two in another.',
'split_table_intro_transfer' => 'Split your transfer 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_transfer' => 'Store splitted transfer',
'add_another_split' => 'Add another split',
'split-transactions' => 'Split transactions',
'split-new-transaction' => 'Split a new transaction',
'do_split' => 'Do a split',
'split_this_withdrawal' => 'Split this withdrawal',
'split_this_deposit' => 'Split this deposit',
'split_this_transfer' => 'Split this transfer',
'cannot_edit_multiple_source' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple source accounts.',
'cannot_edit_multiple_dest' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple destination accounts.',
'no_edit_multiple_left' => 'You have selected no valid transactions to edit.',
'transaction_meta_data' => 'Transaction meta-data',
'transaction_dates' => 'Transaction dates',
'splits' => 'Splits',
'split_title_withdrawal' => 'Split your new withdrawal',
'split_intro_one_withdrawal' => 'Firefly supports the "splitting" of a withdrawal.',
'split_intro_two_withdrawal' => 'It means that the amount of money you\'ve spent is divided between several destination expense accounts, budgets or categories.',
'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',
'split_title_deposit' => 'Split your new deposit',
'split_intro_one_deposit' => 'Firefly supports the "splitting" of a deposit.',
'split_intro_two_deposit' => 'It means that the amount of money you\'ve earned is divided between several source revenue accounts or categories.',
'split_intro_three_deposit' => 'For example: you could split your :total salary so you get :split_one as your base salary and :split_two as a reimbursment for expenses made.',
'split_table_intro_deposit' => 'Split your deposit 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_deposit' => 'Store splitted deposit',
'split_title_transfer' => 'Split your new transfer',
'split_intro_one_transfer' => 'Firefly supports the "splitting" of a transfer.',
'split_intro_two_transfer' => 'It means that the amount of money you\'re moving is divided between several categories or piggy banks.',
'split_intro_three_transfer' => 'For example: you could split your :total move so you get :split_one in one piggy bank and :split_two in another.',
'split_table_intro_transfer' => 'Split your transfer 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_transfer' => 'Store splitted transfer',
'add_another_split' => 'Add another split',
'split-transactions' => 'Split transactions',
'split-new-transaction' => 'Split a new transaction',
'do_split' => 'Do a split',
'split_this_withdrawal' => 'Split this withdrawal',
'split_this_deposit' => 'Split this deposit',
'split_this_transfer' => 'Split this transfer',
'cannot_edit_multiple_source' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple source accounts.',
'cannot_edit_multiple_dest' => 'You cannot edit splitted transaction #:id with description ":description" because it contains multiple destination accounts.',
'no_edit_multiple_left' => 'You have selected no valid transactions to edit.',
// import
'configuration_file_help' => 'If you have previously imported data into Firefly III, you may have a configuration file, which will pre-set configuration values for you.',
'import_data_index' => 'Index',
'import_file_type_csv' => 'CSV (comma separated values)',
'import_file_type_help' => 'Select the type of file you will upload',
'import_start' => 'Start the import',
'configure_import' => 'Further configure your import',
'import_finish_configuration' => 'Finish configuration',
'settings_for_import' => 'Settings',
'import_status' => 'Import status',
'import_status_text' => 'The import is currently running, or will start momentarily.',
'import_complete' => 'Import configuration complete!',
'import_complete_text' => 'The import is ready to start. All the configuration you needed to do has been done. Please download the configuration file. It will help you with the import should it not go as planned. To actually run the import, you can either execute the following command in your console, or run the web-based import. Depending on your configuration, the console import will give you more feedback.',
'import_download_config' => 'Download configuration',
'import_start_import' => 'Start import',
'import_intro_beta' => 'The import function of Firefly III is in beta. Many users of Firefly III have tried many different files. Although each individual compontent of this import routine works (really), the combination might break. If your file cannot be imported by Firefly, please read <a href="https://github.com/JC5/firefly-iii/wiki/Submit-issues-with-sensitive-data-in-them">this wiki page</a> so I can fix the problem you have run into.',
'import_data' => 'Import data',
'import_data_full' => 'Import data into Firefly III',
'import' => 'Import',
'import_intro_text' => 'Welcome to the Firefly III data import routine. At the moment, this routine can help you import files into Firefly. To do so, you must download or export transactions from other systems or software, and upload them here. The next steps will let you help Firefly III determin what the content is of your file, and how to handle it. Please select a file, and read all instructions carefully.',
'import_file_help' => 'Select your file',
'import_status_settings_complete' => 'The import is ready to start.',
'import_status_import_complete' => 'The import has completed.',
'import_status_import_running' => 'The import is currently running. Please be patient.',
'import_status_header' => 'Import status and progress',
'import_status_errors' => 'Import errors',
'import_status_report' => 'Import report',
'import_finished' => 'Import has finished',
'import_error_single' => 'An error has occured during the import.',
'import_error_multi' => 'Some errors occured during the import.',
'import_error_fatal' => 'There was an error during the import routine. Please check the log files. The error seems to be:',
'import_error_timeout' => 'The import seems to have timed out. If this error persists, please import your data using the console command.',
'import_double' => 'Row #:row: This row has been imported before, and is stored in <a href=":link">:description</a>.',
'import_finished_all' => 'The import has finished. Please check out the results below.',
'import_with_key' => 'Import with key \':key\'',
'import_finished_report' => 'The import has finished. Please note any errors in the block above this line. All transactions imported during this particular session have been tagged, and you can check them out below. ',
'import_finished_link' => 'The transactions imported can be found in tag <a href=":link" class="label label-success" style="font-size:100%;font-weight:normal;">:tag</a>.',
'configuration_file_help' => 'If you have previously imported data into Firefly III, you may have a configuration file, which will pre-set configuration values for you.',
'import_data_index' => 'Index',
'import_file_type_csv' => 'CSV (comma separated values)',
'import_file_type_help' => 'Select the type of file you will upload',
'import_start' => 'Start the import',
'configure_import' => 'Further configure your import',
'import_finish_configuration' => 'Finish configuration',
'settings_for_import' => 'Settings',
'import_status' => 'Import status',
'import_status_text' => 'The import is currently running, or will start momentarily.',
'import_complete' => 'Import configuration complete!',
'import_complete_text' => 'The import is ready to start. All the configuration you needed to do has been done. Please download the configuration file. It will help you with the import should it not go as planned. To actually run the import, you can either execute the following command in your console, or run the web-based import. Depending on your configuration, the console import will give you more feedback.',
'import_download_config' => 'Download configuration',
'import_start_import' => 'Start import',
'import_intro_beta' => 'The import function of Firefly III is in beta. Many users of Firefly III have tried many different files. Although each individual compontent of this import routine works (really), the combination might break. If your file cannot be imported by Firefly, please read <a href="https://github.com/JC5/firefly-iii/wiki/Submit-issues-with-sensitive-data-in-them">this wiki page</a> so I can fix the problem you have run into.',
'import_data' => 'Import data',
'import_data_full' => 'Import data into Firefly III',
'import' => 'Import',
'import_intro_text' => 'Welcome to the Firefly III data import routine. At the moment, this routine can help you import files into Firefly. To do so, you must download or export transactions from other systems or software, and upload them here. The next steps will let you help Firefly III determin what the content is of your file, and how to handle it. Please select a file, and read all instructions carefully.',
'import_file_help' => 'Select your file',
'import_status_settings_complete' => 'The import is ready to start.',
'import_status_import_complete' => 'The import has completed.',
'import_status_import_running' => 'The import is currently running. Please be patient.',
'import_status_header' => 'Import status and progress',
'import_status_errors' => 'Import errors',
'import_status_report' => 'Import report',
'import_finished' => 'Import has finished',
'import_error_single' => 'An error has occured during the import.',
'import_error_multi' => 'Some errors occured during the import.',
'import_error_fatal' => 'There was an error during the import routine. Please check the log files. The error seems to be:',
'import_error_timeout' => 'The import seems to have timed out. If this error persists, please import your data using the console command.',
'import_double' => 'Row #:row: This row has been imported before, and is stored in <a href=":link">:description</a>.',
'import_finished_all' => 'The import has finished. Please check out the results below.',
'import_with_key' => 'Import with key \':key\'',
'import_finished_report' => 'The import has finished. Please note any errors in the block above this line. All transactions imported during this particular session have been tagged, and you can check them out below. ',
'import_finished_link' => 'The transactions imported can be found in tag <a href=":link" class="label label-success" style="font-size:100%;font-weight:normal;">:tag</a>.',
];

View File

@ -146,4 +146,8 @@ return [
'csv_import_account' => 'Default import account',
'csv_config' => 'CSV import configuration',
'due_date' => 'Due date',
'payment_date' => 'Payment date',
'internal_reference' => 'Internal reference',
];

View File

@ -1,7 +1,13 @@
<div class="{{ classes }}" id="{{ name }}_holder">
<label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>
<label for="{{ options.id }}" class="
{% if options.small %}
col-sm-8
{% else %}
col-sm-4
{% endif %}
control-label">{{ label }}</label>
<div class="col-sm-8">
<div class="{% if options.small %}col-sm-4{% else %}col-sm-8{% endif %}">
<div class="checkbox">
<label>
{{ Form.checkbox(name, value, options.checked, options) }}

View File

@ -48,6 +48,38 @@
</div>
</div>
<!-- transaction preferences -->
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'pref_optional_fields_transaction'|_ }}</h3>
</div>
<div class="box-body">
<p class="text-info">
{{ 'pref_optional_fields_transaction_help'|_ }}
</p>
<h4>{{ 'optional_tj_date_fields'|_ }}</h4>
{{ ExpandedForm.checkbox('tj[interest_date]','1', tjOptionalFields.interest_date,{ 'label' : 'pref_optional_tj_interest_date'|_ }) }}
{{ ExpandedForm.checkbox('tj[book_date]','1', tjOptionalFields.book_date,{ 'label' : 'pref_optional_tj_book_date'|_ }) }}
{{ ExpandedForm.checkbox('tj[process_date]','1', tjOptionalFields.process_date,{ 'label' : 'pref_optional_tj_process_date'|_ }) }}
{{ ExpandedForm.checkbox('tj[due_date]','1', tjOptionalFields.due_date,{ 'label' : 'pref_optional_tj_due_date'|_ }) }}
{{ ExpandedForm.checkbox('tj[payment_date]','1', tjOptionalFields.payment_date,{ 'label' : 'pref_optional_tj_payment_date'|_ }) }}
<h4>{{ 'optional_tj_business_fields'|_ }}</h4>
{{ ExpandedForm.checkbox('tj[internal_reference]','1', tjOptionalFields.internal_reference,{ 'label' : 'pref_optional_tj_internal_reference'|_ }) }}
{{ ExpandedForm.checkbox('tj[notes]','1', tjOptionalFields.notes,{ 'label' : 'pref_optional_tj_notes'|_ }) }}
<h4>{{ 'optional_tj_attachment_fields'|_ }}</h4>
{{ ExpandedForm.checkbox('tj[attachments]','1', tjOptionalFields.attachments,{ 'label' : 'pref_optional_tj_attachments'|_ }) }}
</div>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="box">

View File

@ -44,7 +44,7 @@
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'transaction_meta_data'|_ }}</h3>
<h3 class="box-title">{{ 'transaction_data'|_ }}</h3>
</div>
<div class="box-body">
{{ ExpandedForm.text('journal_description', journal.description) }}
@ -72,16 +72,45 @@
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'transaction_dates'|_ }}</h3>
<h3 class="box-title">{{ 'transaction_meta_data'|_ }}</h3>
</div>
<div class="box-body">
{{ ExpandedForm.date('date', journal.date) }}
{{ ExpandedForm.date('interest_date', journal.interest_date) }}
{% if optionalFields.interest_date or journal.interest_date %}
<!-- INTEREST DATE -->
{{ ExpandedForm.date('interest_date', journal.interest_date) }}
{% endif %}
{{ ExpandedForm.date('book_date', journal.book_date) }}
{% if optionalFields.book_date or journal.book_date %}
<!-- BOOK DATE -->
{{ ExpandedForm.date('book_date', journal.book_date) }}
{% endif %}
{{ ExpandedForm.date('process_date', journal.process_date) }}
{% if optionalFields.process_date or journal.process_date %}
<!-- PROCESSING DATE -->
{{ ExpandedForm.date('process_date', journal.process_date) }}
{% endif %}
{% if optionalFields.due_date or journal.due_date %}
<!-- DUE DATE -->
{{ ExpandedForm.date('due_date', journal.due_date) }}
{% endif %}
{% if optionalFields.payment_date or journal.payment_date %}
<!-- PAYMENT DATE -->
{{ ExpandedForm.date('payment_date', journal.payment_date) }}
{% endif %}
{% if optionalFields.internal_reference or journal.internal_reference %}
<!-- REFERENCE -->
{{ ExpandedForm.text('internal_reference', journal.internal_reference) }}
{% endif %}
{% if optionalFields.notes or journal.notes %}
<!-- NOTES -->
{{ ExpandedForm.textarea('notes', journal.notes) }}
{% endif %}
</div>
</div>
@ -194,18 +223,22 @@
</div>
</div>
<div class="row">
<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">
<!-- ATTACHMENTS -->
{{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
{% if optionalFields.attachments %}
<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">
<!-- ATTACHMENTS -->
{{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
</div>
</div>
</div>
</div>
{% endif %}
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<!-- panel for options -->
<div class="box">

View File

@ -33,7 +33,7 @@
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'transaction_meta_data'|_ }}</h3>
<h3 class="box-title">{{ 'transaction_data'|_ }}</h3>
</div>
<div class="box-body">
{{ ExpandedForm.text('journal_description', journal.description) }}
@ -61,16 +61,45 @@
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'transaction_dates'|_ }}</h3>
<h3 class="box-title">{{ 'transaction_meta_data'|_ }}</h3>
</div>
<div class="box-body">
{{ ExpandedForm.date('date', journal.date) }}
{{ ExpandedForm.date('interest_date', journal.interest_date) }}
{% if optionalFields.interest_date or journal.interest_date %}
<!-- INTEREST DATE -->
{{ ExpandedForm.date('interest_date', journal.interest_date) }}
{% endif %}
{{ ExpandedForm.date('book_date', journal.book_date) }}
{% if optionalFields.book_date or journal.book_date %}
<!-- BOOK DATE -->
{{ ExpandedForm.date('book_date', journal.book_date) }}
{% endif %}
{{ ExpandedForm.date('process_date', journal.process_date) }}
{% if optionalFields.process_date or journal.process_date %}
<!-- PROCESSING DATE -->
{{ ExpandedForm.date('process_date', journal.process_date) }}
{% endif %}
{% if optionalFields.due_date or journal.due_date %}
<!-- DUE DATE -->
{{ ExpandedForm.date('due_date', journal.due_date) }}
{% endif %}
{% if optionalFields.payment_date or journal.payment_date %}
<!-- PAYMENT DATE -->
{{ ExpandedForm.date('payment_date', journal.payment_date) }}
{% endif %}
{% if optionalFields.internal_reference or journal.internal_reference %}
<!-- REFERENCE -->
{{ ExpandedForm.text('internal_reference', journal.internal_reference) }}
{% endif %}
{% if optionalFields.notes or journal.notes %}
<!-- NOTES -->
{{ ExpandedForm.textarea('notes', journal.notes) }}
{% endif %}
</div>
</div>
@ -171,18 +200,19 @@
</div>
</div>
<div class="row">
<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">
<!-- ATTACHMENTS -->
{{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
{% if optionalFields.attachments %}
<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">
<!-- ATTACHMENTS -->
{{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
</div>
</div>
</div>
</div>
{% endif %}
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<!-- panel for options -->
<div class="box">

View File

@ -51,12 +51,17 @@
<!-- ALWAYS SHOW DATE -->
{{ ExpandedForm.date('date', phpdate('Y-m-d')) }}
</div>
<div class="box-footer">
<button type="submit" id="transaction-btn" class="btn btn-success pull-right">
{{ trans('form.store_new_'~what) }}
</button>
</div>
</div>
</div>
<div class="col-lg-6 col-md-12 col-sm-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'optionalFields'|_ }}</h3>
<h3 class="box-title">{{ 'optional_field_meta_data'|_ }}</h3>
</div>
<div class="box-body">
<!-- BUDGET ONLY WHEN CREATING A WITHDRAWAL -->
@ -66,32 +71,104 @@
{{ ExpandedForm.select('budget_id',budgets,0, {helpText: trans('firefly.no_budget_pointer')}) }}
{% endif %}
<!-- CATEGORY ALWAYS -->
{{ ExpandedForm.text('category') }}
<!-- INTEREST DATE -->
{{ ExpandedForm.date('interest_date') }}
<!-- BOOK DATE -->
{{ ExpandedForm.date('book_date') }}
<!-- PROCESSING DATE -->
{{ ExpandedForm.date('process_date') }}
<!-- TAGS -->
{{ ExpandedForm.text('tags') }}
<!-- RELATE THIS TRANSFER TO A PIGGY BANK -->
{{ ExpandedForm.select('piggy_bank_id',piggies) }}
<!-- ATTACHMENTS -->
{{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
</div>
</div>
<!-- explain if necessary -->
{% 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.internal_reference or
not optionalFields.notes or
not optionalFields.attachments
%}
<p class="text-center text-success"><i class="fa fa-info-circle" aria-hidden="true"></i> <em>{{ trans('firefly.hidden_fields_preferences', {link: route('preferences')})|raw }}</em></p>
{% endif %}
<!-- box for dates -->
{% if optionalFields.interest_date or optionalFields.book_date or optionalFields.process_date or optionalFields.due_date or optionalFields.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 %}
<!-- INTEREST DATE -->
{{ ExpandedForm.date('interest_date') }}
{% endif %}
{% if optionalFields.book_date %}
<!-- BOOK DATE -->
{{ ExpandedForm.date('book_date') }}
{% endif %}
{% if optionalFields.process_date %}
<!-- PROCESSING DATE -->
{{ ExpandedForm.date('process_date') }}
{% endif %}
{% if optionalFields.due_date %}
<!-- DUE DATE -->
{{ ExpandedForm.date('due_date') }}
{% endif %}
{% if optionalFields.payment_date %}
<!-- PAYMENT DATE -->
{{ ExpandedForm.date('payment_date') }}
{% endif %}
</div>
</div>
{% endif %}
<!-- box for business fields -->
{% if optionalFields.internal_reference or optionalFields.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 %}
<!-- REFERENCE -->
{{ ExpandedForm.text('internal_reference') }}
{% endif %}
{% if optionalFields.notes %}
<!-- NOTES -->
{{ ExpandedForm.textarea('notes') }}
{% endif %}
</div>
</div>
{% endif %}
<!-- box for attachments -->
{% if optionalFields.attachments %}
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'optional_field_attachments'|_ }}</h3>
</div>
<div class="box-body">
{% if optionalFields.attachments %}
<!-- ATTACHMENTS -->
{{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
{% endif %}
</div>
</div>
{% endif %}
<!-- panel for options -->
<div class="box">
<div class="box-header with-border">

View File

@ -80,14 +80,6 @@
<!-- CATEGORY ALWAYS -->
{{ ExpandedForm.text('category',data['category']) }}
<!-- INTEREST DATE -->
{{ ExpandedForm.date('interest_date',data['interest_date']) }}
<!-- BOOK DATE -->
{{ ExpandedForm.date('book_date',data['book_date']) }}
<!-- PROCESSING DATE -->
{{ ExpandedForm.date('process_date',data['process_date']) }}
<!-- TAGS -->
{{ ExpandedForm.text('tags') }}
@ -101,7 +93,114 @@
</div>
</div>
<!-- end of panel for options-->
<!-- explain if necessary -->
{% 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.internal_reference or
not optionalFields.notes or
not optionalFields.attachments %}
<p class="text-center text-success"><i class="fa fa-info-circle" aria-hidden="true"></i>
<em>{{ trans('firefly.hidden_fields_preferences', {link: route('preferences')})|raw }}</em></p>
{% endif %}
<!-- box for dates -->
{% if
optionalFields.interest_date or
optionalFields.book_date or
optionalFields.process_date or
optionalFields.due_date or
optionalFields.payment_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'] %}
<!-- INTEREST DATE -->
{{ ExpandedForm.date('interest_date',data['interest_date']) }}
{% endif %}
{% if optionalFields.book_date or data['book_date'] %}
<!-- BOOK DATE -->
{{ ExpandedForm.date('book_date',data['book_date']) }}
{% endif %}
{% if optionalFields.process_date or data['process_date'] %}
<!-- PROCESSING DATE -->
{{ ExpandedForm.date('process_date',data['process_date']) }}
{% endif %}
{% if optionalFields.due_date or data['due_date'] %}
<!-- DUE DATE -->
{{ ExpandedForm.date('due_date',data['due_date']) }}
{% endif %}
{% if optionalFields.payment_date or data['payment_date'] %}
<!-- PAYMENT DATE -->
{{ ExpandedForm.date('payment_date',data['payment_date']) }}
{% endif %}
</div>
</div>
{% endif %}
<!-- box for business fields -->
{% 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'] %}
<!-- REFERENCE -->
{{ ExpandedForm.text('internal_reference', data['interal_reference']) }}
{% endif %}
{% if optionalFields.notes or data['notes'] %}
<!-- NOTES -->
{{ ExpandedForm.textarea('notes', data['notes']) }}
{% endif %}
</div>
</div>
{% endif %}
<!-- box for attachments -->
{% if optionalFields.attachments %}
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'optional_field_attachments'|_ }}</h3>
</div>
<div class="box-body">
{% if optionalFields.attachments %}
<!-- ATTACHMENTS -->
{{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
{% endif %}
</div>
</div>
{% endif %}
<!-- panel for options -->
<div class="box">