Add location to account.

This commit is contained in:
James Cole
2019-12-28 19:49:33 +01:00
parent 950b706e7c
commit 021d421c6f
7 changed files with 155 additions and 42 deletions

View File

@@ -24,40 +24,41 @@ declare(strict_types=1);
return [
// new user:
'bank_name' => 'Bank name',
'bank_balance' => 'Balance',
'savings_balance' => 'Savings balance',
'credit_card_limit' => 'Credit card limit',
'automatch' => 'Match automatically',
'skip' => 'Skip',
'enabled' => 'Enabled',
'name' => 'Name',
'active' => 'Active',
'amount_min' => 'Minimum amount',
'amount_max' => 'Maximum amount',
'match' => 'Matches on',
'strict' => 'Strict mode',
'repeat_freq' => 'Repeats',
'update_channel' => 'Update channel',
'journal_currency_id' => 'Currency',
'currency_id' => 'Currency',
'transaction_currency_id' => 'Currency',
'external_ip' => 'Your server\'s external IP',
'attachments' => 'Attachments',
'journal_amount' => 'Amount',
'journal_source_name' => 'Revenue account (source)',
'keep_bill_id' => 'Bill',
'journal_source_id' => 'Asset account (source)',
'BIC' => 'BIC',
'verify_password' => 'Verify password security',
'source_account' => 'Source account',
'destination_account' => 'Destination account',
'journal_destination_id' => 'Asset account (destination)',
'asset_destination_account' => 'Destination account',
'include_net_worth' => 'Include in net worth',
'asset_source_account' => 'Source account',
'journal_description' => 'Description',
'note' => 'Notes',
'bank_name' => 'Bank name',
'bank_balance' => 'Balance',
'savings_balance' => 'Savings balance',
'credit_card_limit' => 'Credit card limit',
'automatch' => 'Match automatically',
'skip' => 'Skip',
'enabled' => 'Enabled',
'name' => 'Name',
'active' => 'Active',
'amount_min' => 'Minimum amount',
'amount_max' => 'Maximum amount',
'match' => 'Matches on',
'strict' => 'Strict mode',
'repeat_freq' => 'Repeats',
'location' => 'Location',
'update_channel' => 'Update channel',
'journal_currency_id' => 'Currency',
'currency_id' => 'Currency',
'transaction_currency_id' => 'Currency',
'external_ip' => 'Your server\'s external IP',
'attachments' => 'Attachments',
'journal_amount' => 'Amount',
'journal_source_name' => 'Revenue account (source)',
'keep_bill_id' => 'Bill',
'journal_source_id' => 'Asset account (source)',
'BIC' => 'BIC',
'verify_password' => 'Verify password security',
'source_account' => 'Source account',
'destination_account' => 'Destination account',
'journal_destination_id' => 'Asset account (destination)',
'asset_destination_account' => 'Destination account',
'include_net_worth' => 'Include in net worth',
'asset_source_account' => 'Source account',
'journal_description' => 'Description',
'note' => 'Notes',
'store_new_transaction' => 'Store new transaction',
'split_journal' => 'Split this transaction',
'split_journal_explanation' => 'Split this transaction in multiple parts',

View File

@@ -53,7 +53,7 @@
{# only correct way to do active checkbox #}
{{ ExpandedForm.checkbox('include_net_worth', 1) }}
{{ ExpandedForm.textarea('notes',null,{helpText: trans('firefly.field_supports_markdown')}) }}
{{ ExpandedForm.location('location') }}
</div>
</div>
@@ -77,6 +77,43 @@
</form>
{% endblock %}
{% block scripts %}
<!-- location script -->
<script type="text/javascript">
// pre-set latitude:
{% if old('tag_position_latitude') %}
var tag_position_latitude = "{{ old('tag_position_latitude') }}";
{% else %}
var tag_position_latitude = "52.3167";
{% endif %}
// pre-set longitude
{% if old('tag_position_longitude') %}
var tag_position_longitude = "{{ old('tag_position_longitude') }}";
{% else %}
var tag_position_longitude = "5.5500";
{% endif %}
// pre-set zoom level
{% if old('tag_position_zoomlevel') %}
var tag_position_zoomlevel = "{{ old('tag_position_zoomlevel') }}";
{% else %}
var tag_position_zoomlevel = "6";
{% endif %}
// must draw a tag?
{% if old('tag_position_latitude') and old('tag_position_longitude') and old('tag_position_zoomlevel') %}
var tag_position_set_tag = true;
{% else %}
var tag_position_set_tag = false;
{% endif %}
// token for Mapbox:
var mapboxToken = "{{ config('firefly.mapbox_api_key') }}";
</script>
<script src="v1/lib/leaflet/leaflet.js?v={{ FF_VERSION }}"></script>
<script type="text/javascript" src="v1/js/lib/modernizr-custom.js?v={{ FF_VERSION }}"></script>
<script type="text/javascript" src="v1/js/lib/jquery-ui.min.js?v={{ FF_VERSION }}"></script>
<script type="text/javascript" src="v1/js/ff/accounts/create.js?v={{ FF_VERSION }}"></script>
@@ -85,4 +122,5 @@
{% block styles %}
<link href="v1/css/jquery-ui/jquery-ui.structure.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all">
<link href="v1/css/jquery-ui/jquery-ui.theme.min.css?v={{ FF_VERSION }}" type="text/css" rel="stylesheet" media="all">
<link rel="stylesheet" href="v1/lib/leaflet/leaflet.css?v={{ FF_VERSION }}"/>
{% endblock %}

View File

@@ -85,9 +85,22 @@
</div>
</div>
{% endif %}
{% if account.notes.count == 1 %}
<div class="row">
<div class="col-lg-12">
<div class="row">
<div class="col-lg-6">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'location'|_ }}</h3>
</div>
<div class="box-body">
{% if(location) %}
<div id="location_map" style="width:100%;height:300px;"></div>
{% endif %}
</div>
</div>
</div>
{% if account.notes.count == 1 %}
<div class="col-lg-6">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'notes'|_ }}</h3>
@@ -97,8 +110,8 @@
</div>
</div>
</div>
</div>
{% endif %}
{% endif %}
</div>
<div class="row">
<div class="{% if periods|length > 0 %}col-lg-10 col-md-8 col-sm-12{% else %}col-lg-12 col-md-12 col-sm-12{% endif %}">
@@ -149,6 +162,17 @@
var chartUri = '{{ chartUri }}';
{% if not showAll %}
showAll = false;
// location stuff
{% if location %}
var latitude = {{ location.latitude|default("52.3167") }};
var longitude = {{ location.longitude|default("5.5500") }};
var zoomLevel = {{ location.zoom_level|default("6") }};
var doPlaceMarker = true;
// token for Mapbox:
var mapboxToken = "{{ config('firefly.mapbox_api_key') }}";
{% endif %}
// uri's for charts:
var incomeCategoryUri = '{{ route('chart.account.income-category', [account.id, start.format('Ymd'), end.format('Ymd')]) }}';
@@ -162,6 +186,9 @@
{% endif %}
</script>
{% if location %}
<script src="v1/lib/leaflet/leaflet.js?v={{ FF_VERSION }}"></script>
{% endif %}
<script type="text/javascript" src="v1/js/lib/Chart.bundle.min.js?v={{ FF_VERSION }}"></script>
<script type="text/javascript" src="v1/js/lib/chartjs-plugin-annotation.min.js?v={{ FF_VERSION }}"></script>
<script type="text/javascript" src="v1/js/ff/charts.defaults.js?v={{ FF_VERSION }}"></script>
@@ -173,3 +200,9 @@
{# required for groups.twig #}
<script type="text/javascript" src="v1/js/ff/list/groups.js?v={{ FF_VERSION }}"></script>
{% endblock %}
{% block styles %}
{% if location %}
<link rel="stylesheet" href="v1/lib/leaflet/leaflet.css?v={{ FF_VERSION }}"/>
{% endif %}
{% endblock %}