mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			313 lines
		
	
	
		
			16 KiB
		
	
	
	
		
			Twig
		
	
	
	
	
	
			
		
		
	
	
			313 lines
		
	
	
		
			16 KiB
		
	
	
	
		
			Twig
		
	
	
	
	
	
| {% extends "./layout/default" %}
 | |
| 
 | |
| {% block breadcrumbs %}
 | |
|     {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, journal) }}
 | |
| {% endblock %}
 | |
| {% block content %}
 | |
|     <form method="POST" action="{{ route('transactions.split.update',journal.id) }}" accept-charset="UTF-8" class="form-horizontal" id="update"
 | |
|           enctype="multipart/form-data">
 | |
| 
 | |
|         <input name="_token" type="hidden" value="{{ csrf_token() }}">
 | |
|         <input type="hidden" name="id" value="{{ journal.id }}"/>
 | |
|         <input type="hidden" name="what" value="{{ preFilled.what }}"/>
 | |
| 
 | |
|         {% if errors.all()|length > 0 %}
 | |
|             <div class="row">
 | |
|                 <div class="col-lg-12 col-md-12 col-sm-12">
 | |
|                     <div class="box box-danger">
 | |
|                         <div class="box-header with-border">
 | |
|                             <h3 class="box-title">{{ 'errors'|_ }}</h3>
 | |
|                         </div>
 | |
|                         <div class="box-body">
 | |
|                             <ul>
 | |
|                                 {% for key, err in errors.all() %}
 | |
|                                     <li class="text-danger">{{ err }}</li>
 | |
|                                 {% endfor %}
 | |
|                             </ul>
 | |
|                         </div>
 | |
|                     </div>
 | |
|                 </div>
 | |
|             </div>
 | |
|         {% endif %}
 | |
|         <div class="row">
 | |
|             <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_data'|_ }}</h3>
 | |
|                     </div>
 | |
|                     <div class="box-body">
 | |
| 
 | |
|                         {# DESCRIPTION IS ALWAYS AVAILABLE #}
 | |
|                         {{ ExpandedForm.text('journal_description', journal.description) }}
 | |
| 
 | |
|                         {# CURRENCY IS NEW FOR SPLIT JOURNALS #}
 | |
|                         {{ ExpandedForm.select('currency_id', currencies, preFilled.currency_id) }}
 | |
| 
 | |
|                         {# show source if withdrawal or transfer #}
 | |
|                         {% if preFilled.what == 'withdrawal' or preFilled.what == 'transfer' %}
 | |
|                             {{ ExpandedForm.select('journal_source_account_id', assetAccounts, preFilled.journal_source_account_id) }}
 | |
|                         {% endif %}
 | |
| 
 | |
|                         {# show destination account id, if deposit (is asset): #}
 | |
|                         {% if preFilled.what == 'deposit' %}
 | |
|                             {{ ExpandedForm.select('journal_destination_account_id', assetAccounts, preFilled.journal_destination_account_id) }}
 | |
|                         {% endif %}
 | |
| 
 | |
|                         {# show static destination if transfer #}
 | |
|                         {% if preFilled.what == 'transfer' %}
 | |
|                             {{ ExpandedForm.select('journal_destination_account_id', assetAccounts, preFilled.journal_destination_account_id) }}
 | |
|                         {% endif %}
 | |
| 
 | |
|                         {# TOTAL AMOUNT IS STATIC TEXT #}
 | |
|                         {{ ExpandedForm.staticText('journal_amount', preFilled.journal_amount|formatAmount ) }}
 | |
|                         <input type="hidden" name="journal_amount" value="{{ preFilled.journal_amount }}"/>
 | |
| 
 | |
|                         {# DATE #}
 | |
|                         {{ ExpandedForm.date('date', journal.date) }}
 | |
|                     </div>
 | |
|                 </div>
 | |
|             </div>
 | |
|             <div class="col-lg-6 col-md-6 col-sm-6">
 | |
|                 <div class="box">
 | |
|                     <div class="box-header with-border">
 | |
|                         <h3 class="box-title">{{ 'optional_field_meta_data'|_ }}</h3>
 | |
|                     </div>
 | |
|                     <div class="box-body">
 | |
|                         {# NO BUDGET #}
 | |
|                         {# NO CATEGORY #}
 | |
| 
 | |
|                         {# ALWAYS TAGS #}
 | |
|                         {{ ExpandedForm.text('tags', preFilled.tags) }}
 | |
| 
 | |
|                         {# NO PIGGY BANK #}
 | |
|                     </div>
 | |
|                 </div>
 | |
| 
 | |
|                 {# EXPLANATION 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.invoice_date or
 | |
|                 not optionalFields.internal_reference or
 | |
|                 not optionalFields.notes or
 | |
|                 not optionalFields.attachments %}
 | |
|                     <p class="text-center text-success"><i class="fa fa-info-circle" aria-hidden="true"></i>
 | |
|                         <em>{{ trans('firefly.hidden_fields_preferences', {link: route('preferences.index')})|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 optionalFields.invoice_date %}
 | |
|                     <div class="box">
 | |
|                         <div class="box-header with-border">
 | |
|                             <h3 class="box-title">{{ 'optional_field_meta_dates'|_ }}</h3>
 | |
|                         </div>
 | |
|                         <div class="box-body">
 | |
| 
 | |
|                             {# INTEREST DATE #}
 | |
|                             {% if optionalFields.interest_date or journal.interest_date %}
 | |
|                                 {{ ExpandedForm.date('interest_date', journal.interest_date) }}
 | |
|                             {% endif %}
 | |
| 
 | |
|                             {# BOOK DATE #}
 | |
|                             {% if optionalFields.book_date or journal.book_date %}
 | |
|                                 {{ ExpandedForm.date('book_date', journal.book_date) }}
 | |
|                             {% endif %}
 | |
| 
 | |
|                             {# PROCESSING DATE #}
 | |
|                             {% if optionalFields.process_date or journal.process_date %}
 | |
|                                 {{ ExpandedForm.date('process_date', journal.process_date) }}
 | |
|                             {% endif %}
 | |
| 
 | |
|                             {# DUE DATE #}
 | |
|                             {% if optionalFields.due_date or journal.due_date %}
 | |
|                                 {{ ExpandedForm.date('due_date', journal.due_date) }}
 | |
|                             {% endif %}
 | |
| 
 | |
|                             {# PAYMENT DATE #}
 | |
|                             {% if optionalFields.payment_date or journal.payment_date %}
 | |
|                                 {{ ExpandedForm.date('payment_date', journal.payment_date) }}
 | |
|                             {% endif %}
 | |
| 
 | |
|                             {# INVOICE DATE #}
 | |
|                             {% if optionalFields.invoice_date or journal.invoice_date %}
 | |
|                                 {{ ExpandedForm.date('invoice_date', journal.invoice_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">
 | |
| 
 | |
|                             {# INTERNAL REFERENCE #}
 | |
|                             {% if optionalFields.internal_reference or journal.internal_reference %}
 | |
|                                 {{ ExpandedForm.text('internal_reference', journal.internal_reference) }}
 | |
|                             {% endif %}
 | |
| 
 | |
|                             {# NOTES #}
 | |
|                             {% if optionalFields.notes  or journal.notes %}
 | |
|                                 {{ ExpandedForm.textarea('notes', journal.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">
 | |
|                             {# ATTACHMENTS #}
 | |
|                             {% if optionalFields.attachments %}
 | |
|                                 {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
 | |
|                             {% endif %}
 | |
|                         </div>
 | |
|                     </div>
 | |
|                 {% endif %}
 | |
| 
 | |
|             </div>
 | |
|         </div>
 | |
|         <div class="row">
 | |
|             <div class="col-lg-12 col-md-12 col-sm-12">
 | |
|                 <div class="box">
 | |
|                     <div class="box-header with-border">
 | |
|                         <h3 class="box-title">{{ 'splits'|_ }}</h3>
 | |
|                     </div>
 | |
|                     <div class="box-body">
 | |
|                         <table class="table table-bordered table-condensed table-striped split-table">
 | |
|                             <thead>
 | |
|                             <tr>
 | |
|                                 <th> </th>
 | |
|                                 <th>{{ trans('list.split_number') }}</th>
 | |
|                                 <th>{{ trans('list.description') }}</th>
 | |
| 
 | |
|                                 {# withdrawal and deposit have a destination. #}
 | |
|                                 {% if preFilled.what == 'withdrawal' %}
 | |
|                                     <th>{{ trans('list.destination') }}</th>
 | |
|                                 {% endif %}
 | |
| 
 | |
|                                 {# DEPOSIT HAS A SOURCE #}
 | |
|                                 {% if preFilled.what == 'deposit' %}
 | |
|                                     <th>{{ trans('list.source') }}</th>
 | |
|                                 {% endif %}
 | |
| 
 | |
|                                 <th>{{ trans('list.amount') }}</th>
 | |
| 
 | |
|                                 {# only withdrawal has budget #}
 | |
|                                 {% if preFilled.what == 'withdrawal' %}
 | |
|                                     <th>{{ trans('list.budget') }}</th>
 | |
|                                 {% endif %}
 | |
| 
 | |
|                                 <th>{{ trans('list.category') }}</th>
 | |
|                             </tr>
 | |
|                             </thead>
 | |
|                             <tbody>
 | |
|                             {% for index, transaction in preFilled.transactions %}
 | |
|                                 <tr data-split="{{ loop.index0 }}">
 | |
|                                     <td><a href="#" class="btn btn-xs btn-danger remove-current-split" data-split="{{ loop.index0 }}"><i
 | |
|                                                     class="fa fa-trash" data-split="{{ loop.index0 }}"></i></a></td>
 | |
|                                     <td class="count">#{{ loop.index }}</td>
 | |
|                                     <td>
 | |
|                                         <input type="text" name="transactions[{{ loop.index0 }}][description]" value="{{ transaction.description }}"
 | |
|                                                class="form-control"/>
 | |
|                                     </td>
 | |
| 
 | |
|                                     <!-- withdrawal has several destination names. -->
 | |
|                                     {% if preFilled.what == 'withdrawal' %}
 | |
|                                         <td>
 | |
|                                             <input type="text" name="transactions[{{ loop.index0 }}][destination_account_name]"
 | |
|                                                    value="{{ transaction.destination_account_name }}"
 | |
|                                                    class="form-control"/>
 | |
|                                         </td>
 | |
|                                     {% endif %}
 | |
| 
 | |
|                                     <!-- deposit has several source names -->
 | |
|                                     {% if preFilled.what == 'deposit' %}
 | |
|                                         <td>
 | |
|                                             <input type="text" name="transactions[{{ loop.index0 }}][source_account_name]"
 | |
|                                                    value="{{ transaction.source_account_name }}"
 | |
|                                                    class="form-control"/>
 | |
|                                         </td>
 | |
|                                     {% endif %}
 | |
| 
 | |
| 
 | |
|                                     <td style="width:10%;">
 | |
|                                         <input type="number" name="transactions[{{ loop.index0 }}][amount]" value="{{ transaction.amount }}"
 | |
|                                                class="form-control" autocomplete="off" step="any" min="0.01">
 | |
|                                     </td>
 | |
| 
 | |
|                                     {% if preFilled.what == 'withdrawal' %}
 | |
|                                         <td>
 | |
|                                             <select class="form-control" name="transactions[{{ loop.index0 }}][budget_id]">
 | |
|                                                 {% for key, budget in budgets %}
 | |
|                                                     <option label="{{ budget }}" value="{{ key }}"
 | |
|                                                             {% if transaction.budget_id == key %}
 | |
|                                                                 selected="selected"
 | |
|                                                             {% endif %}
 | |
|                                                     >{{ budget }}</option>
 | |
|                                                 {% endfor %}
 | |
|                                             </select>
 | |
|                                         </td>
 | |
|                                     {% endif %}
 | |
|                                     <td>
 | |
|                                         <input type="text" name="transactions[{{ loop.index0 }}][category]" value="{{ transaction.category }}"
 | |
|                                                class="form-control"/>
 | |
|                                     </td>
 | |
|                                 </tr>
 | |
|                             {% endfor %}
 | |
|                             </tbody>
 | |
|                         </table>
 | |
|                         <p>
 | |
|                             <br/>
 | |
|                             <a href="#" class="btn btn-default btn-do-split"><i class="fa fa-plus-circle"></i> {{ 'add_another_split'|_ }}</a>
 | |
|                         </p>
 | |
|                     </div>
 | |
|                 </div>
 | |
|             </div>
 | |
|         </div>
 | |
|         <div class="row">
 | |
|             <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
 | |
|                 <!-- panel for options -->
 | |
|                 <div class="box">
 | |
|                     <div class="box-header with-border">
 | |
|                         <h3 class="box-title">{{ 'options'|_ }}</h3>
 | |
|                     </div>
 | |
|                     <div class="box-body">
 | |
|                         {{ ExpandedForm.optionsList('update','split-transaction') }}
 | |
|                     </div>
 | |
|                     <div class="box-footer">
 | |
|                         <button type="submit" class="pull-right btn btn-success">{{ ('update_' ~ preFilled.what)|_ }}</button>
 | |
|                     </div>
 | |
|                 </div>
 | |
|             </div>
 | |
|         </div>
 | |
|     </form>
 | |
| 
 | |
| {% endblock %}
 | |
| {% block styles %}
 | |
|     <link href="css/bootstrap-tagsinput.css" type="text/css" rel="stylesheet" media="all">
 | |
| {% endblock %}
 | |
| {% block scripts %}
 | |
|     <script type="text/javascript">
 | |
|         var originalSum = {{ preFilled.journal_amount }};
 | |
|         var what = "{{ preFilled.what }}";
 | |
|     </script>
 | |
|     <script type="text/javascript" src="js/lib/bootstrap3-typeahead.min.js"></script>
 | |
|     <script type="text/javascript" src="js/lib/bootstrap-tagsinput.min.js"></script>
 | |
|     <script type="text/javascript" src="js/ff/transactions/create-edit.js"></script>
 | |
|     <script type="text/javascript" src="js/ff/split/journal/from-store.js"></script>
 | |
| {% endblock %}
 |