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
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,10 +742,10 @@ 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',
'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',

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) }}
{% if optionalFields.interest_date or journal.interest_date %}
<!-- INTEREST DATE -->
{{ ExpandedForm.date('interest_date', journal.interest_date) }}
{% endif %}
{% if optionalFields.book_date or journal.book_date %}
<!-- BOOK DATE -->
{{ ExpandedForm.date('book_date', journal.book_date) }}
{% endif %}
{% 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,8 +223,9 @@
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
{% 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>
@@ -206,6 +236,9 @@
</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) }}
{% if optionalFields.interest_date or journal.interest_date %}
<!-- INTEREST DATE -->
{{ ExpandedForm.date('interest_date', journal.interest_date) }}
{% endif %}
{% if optionalFields.book_date or journal.book_date %}
<!-- BOOK DATE -->
{{ ExpandedForm.date('book_date', journal.book_date) }}
{% endif %}
{% 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,8 +200,8 @@
</div>
</div>
<div class="row">
{% 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>
@@ -183,6 +212,7 @@
</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,31 +71,103 @@
{{ 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) }}
</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">

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">