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

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