From 6c5cd705c0972c7b991af0ee205292f5a5ce5dc2 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 4 Sep 2016 16:21:51 +0200 Subject: [PATCH] Some code for new optional fields, see #301 Signed-off-by: James Cole --- .../Controllers/PreferencesController.php | 41 +++-- .../Transaction/SplitController.php | 7 +- .../Controllers/TransactionController.php | 11 +- resources/lang/en_US/firefly.php | 161 ++++++++++-------- resources/lang/en_US/form.php | 4 + resources/views/form/checkbox.twig | 10 +- resources/views/preferences/index.twig | 32 ++++ resources/views/split/journals/create.twig | 61 +++++-- resources/views/split/journals/edit.twig | 60 +++++-- resources/views/transactions/create.twig | 107 ++++++++++-- resources/views/transactions/edit.twig | 117 ++++++++++++- 11 files changed, 466 insertions(+), 145 deletions(-) diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index 4347755d79..21f059fd20 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -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(); diff --git a/app/Http/Controllers/Transaction/SplitController.php b/app/Http/Controllers/Transaction/SplitController.php index 94236356c1..10cde184dd 100644 --- a/app/Http/Controllers/Transaction/SplitController.php +++ b/app/Http/Controllers/Transaction/SplitController.php @@ -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' ) ); diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php index f5eb24b3ea..1f1707919f 100644 --- a/app/Http/Controllers/TransactionController.php +++ b/app/Http/Controllers/TransactionController.php @@ -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); } /** diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index f68648a02f..ea1810f81f 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -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 settings.', // 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 this wiki page 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 :description.', - '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 :tag.', + '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 this wiki page 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 :description.', + '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 :tag.', ]; diff --git a/resources/lang/en_US/form.php b/resources/lang/en_US/form.php index 772fe808e7..a94ffaa9e7 100644 --- a/resources/lang/en_US/form.php +++ b/resources/lang/en_US/form.php @@ -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', ]; diff --git a/resources/views/form/checkbox.twig b/resources/views/form/checkbox.twig index b2bc258cd0..9e2d718b81 100644 --- a/resources/views/form/checkbox.twig +++ b/resources/views/form/checkbox.twig @@ -1,7 +1,13 @@
- + -
+
+ +
+
+

{{ 'pref_optional_fields_transaction'|_ }}

+
+
+

+ {{ 'pref_optional_fields_transaction_help'|_ }} +

+

{{ 'optional_tj_date_fields'|_ }}

+ {{ 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'|_ }) }} + +

{{ 'optional_tj_business_fields'|_ }}

+ {{ 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'|_ }) }} + +

{{ 'optional_tj_attachment_fields'|_ }}

+ {{ ExpandedForm.checkbox('tj[attachments]','1', tjOptionalFields.attachments,{ 'label' : 'pref_optional_tj_attachments'|_ }) }} + + + +
+
+ + + + +
diff --git a/resources/views/split/journals/create.twig b/resources/views/split/journals/create.twig index a88138a859..8656bf9870 100644 --- a/resources/views/split/journals/create.twig +++ b/resources/views/split/journals/create.twig @@ -44,7 +44,7 @@
-

{{ 'transaction_meta_data'|_ }}

+

{{ 'transaction_data'|_ }}

{{ ExpandedForm.text('journal_description', journal.description) }} @@ -72,16 +72,45 @@
-

{{ 'transaction_dates'|_ }}

+

{{ 'transaction_meta_data'|_ }}

{{ ExpandedForm.date('date', journal.date) }} - {{ ExpandedForm.date('interest_date', journal.interest_date) }} + {% if optionalFields.interest_date or journal.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 %} + + {{ ExpandedForm.date('book_date', journal.book_date) }} + {% endif %} - {{ ExpandedForm.date('process_date', journal.process_date) }} + {% if optionalFields.process_date or journal.process_date %} + + {{ ExpandedForm.date('process_date', journal.process_date) }} + {% endif %} + + {% if optionalFields.due_date or journal.due_date %} + + {{ ExpandedForm.date('due_date', journal.due_date) }} + {% endif %} + + {% if optionalFields.payment_date or journal.payment_date %} + + {{ ExpandedForm.date('payment_date', journal.payment_date) }} + {% endif %} + + {% if optionalFields.internal_reference or journal.internal_reference %} + + {{ ExpandedForm.text('internal_reference', journal.internal_reference) }} + {% endif %} + + {% if optionalFields.notes or journal.notes %} + + {{ ExpandedForm.textarea('notes', journal.notes) }} + {% endif %}
@@ -194,18 +223,22 @@
-
-
-
-

{{ 'optionalFields'|_ }}

-
-
- - {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }} + {% if optionalFields.attachments %} +
+
+
+

{{ 'optionalFields'|_ }}

+
+
+ + {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }} +
-
+ {% endif %} + +
diff --git a/resources/views/split/journals/edit.twig b/resources/views/split/journals/edit.twig index 108fab1b33..69a74a16b7 100644 --- a/resources/views/split/journals/edit.twig +++ b/resources/views/split/journals/edit.twig @@ -33,7 +33,7 @@
-

{{ 'transaction_meta_data'|_ }}

+

{{ 'transaction_data'|_ }}

{{ ExpandedForm.text('journal_description', journal.description) }} @@ -61,16 +61,45 @@
-

{{ 'transaction_dates'|_ }}

+

{{ 'transaction_meta_data'|_ }}

{{ ExpandedForm.date('date', journal.date) }} - {{ ExpandedForm.date('interest_date', journal.interest_date) }} + {% if optionalFields.interest_date or journal.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 %} + + {{ ExpandedForm.date('book_date', journal.book_date) }} + {% endif %} - {{ ExpandedForm.date('process_date', journal.process_date) }} + {% if optionalFields.process_date or journal.process_date %} + + {{ ExpandedForm.date('process_date', journal.process_date) }} + {% endif %} + + {% if optionalFields.due_date or journal.due_date %} + + {{ ExpandedForm.date('due_date', journal.due_date) }} + {% endif %} + + {% if optionalFields.payment_date or journal.payment_date %} + + {{ ExpandedForm.date('payment_date', journal.payment_date) }} + {% endif %} + + {% if optionalFields.internal_reference or journal.internal_reference %} + + {{ ExpandedForm.text('internal_reference', journal.internal_reference) }} + {% endif %} + + {% if optionalFields.notes or journal.notes %} + + {{ ExpandedForm.textarea('notes', journal.notes) }} + {% endif %}
@@ -171,18 +200,19 @@
-
- -
-
-

{{ 'optionalFields'|_ }}

-
-
- - {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }} + {% if optionalFields.attachments %} +
+
+
+

{{ 'optionalFields'|_ }}

+
+
+ + {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }} +
-
+ {% endif %}
diff --git a/resources/views/transactions/create.twig b/resources/views/transactions/create.twig index e4f200d49b..4c0b8d1321 100644 --- a/resources/views/transactions/create.twig +++ b/resources/views/transactions/create.twig @@ -51,12 +51,17 @@ {{ ExpandedForm.date('date', phpdate('Y-m-d')) }}
+
-

{{ 'optionalFields'|_ }}

+

{{ 'optional_field_meta_data'|_ }}

@@ -66,32 +71,104 @@ {{ ExpandedForm.select('budget_id',budgets,0, {helpText: trans('firefly.no_budget_pointer')}) }} {% endif %} - {{ ExpandedForm.text('category') }} - - {{ ExpandedForm.date('interest_date') }} - - {{ ExpandedForm.date('book_date') }} - - {{ ExpandedForm.date('process_date') }} - - {{ ExpandedForm.text('tags') }} - {{ ExpandedForm.select('piggy_bank_id',piggies) }} - - {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }} -
-
+ + {% 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 + %} +

{{ trans('firefly.hidden_fields_preferences', {link: route('preferences')})|raw }}

+ {% endif %} + + {% if optionalFields.interest_date or optionalFields.book_date or optionalFields.process_date or optionalFields.due_date or optionalFields.payment_date %} +
+
+

{{ 'optional_field_meta_dates'|_ }}

+
+
+ + {% if optionalFields.interest_date %} + + {{ ExpandedForm.date('interest_date') }} + {% endif %} + + {% if optionalFields.book_date %} + + {{ ExpandedForm.date('book_date') }} + {% endif %} + + {% if optionalFields.process_date %} + + {{ ExpandedForm.date('process_date') }} + {% endif %} + + {% if optionalFields.due_date %} + + {{ ExpandedForm.date('due_date') }} + {% endif %} + + {% if optionalFields.payment_date %} + + {{ ExpandedForm.date('payment_date') }} + {% endif %} + +
+
+ {% endif %} + + + {% if optionalFields.internal_reference or optionalFields.notes %} +
+
+

{{ 'optional_field_meta_business'|_ }}

+
+
+ {% if optionalFields.internal_reference %} + + {{ ExpandedForm.text('internal_reference') }} + {% endif %} + + {% if optionalFields.notes %} + + {{ ExpandedForm.textarea('notes') }} + {% endif %} + +
+
+ {% endif %} + + + {% if optionalFields.attachments %} +
+
+

{{ 'optional_field_attachments'|_ }}

+
+
+ {% if optionalFields.attachments %} + + {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }} + {% endif %} +
+
+ {% endif %} +
diff --git a/resources/views/transactions/edit.twig b/resources/views/transactions/edit.twig index b9f0e19341..e6a988044f 100644 --- a/resources/views/transactions/edit.twig +++ b/resources/views/transactions/edit.twig @@ -80,14 +80,6 @@ {{ ExpandedForm.text('category',data['category']) }} - - {{ ExpandedForm.date('interest_date',data['interest_date']) }} - - {{ ExpandedForm.date('book_date',data['book_date']) }} - - {{ ExpandedForm.date('process_date',data['process_date']) }} - - {{ ExpandedForm.text('tags') }} @@ -101,7 +93,114 @@
- + + + + {% 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 %} +

+ {{ trans('firefly.hidden_fields_preferences', {link: route('preferences')})|raw }}

+ {% endif %} + + + + {% 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 + %} +
+
+

{{ 'optional_field_meta_dates'|_ }}

+
+
+ + {% 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 %} + +
+
+ {% endif %} + + + + + {% if + optionalFields.internal_reference or + optionalFields.notes or + data['interal_reference'] or + data['notes'] + + %} +
+
+

{{ 'optional_field_meta_business'|_ }}

+
+
+ {% 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']) }} + {% endif %} + +
+
+ {% endif %} + + + {% if optionalFields.attachments %} +
+
+

{{ 'optional_field_attachments'|_ }}

+
+
+ {% if optionalFields.attachments %} + + {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }} + {% endif %} +
+
+ {% endif %}