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

@@ -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 %}