mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for Google Maps (#2652)
This commit is contained in:
parent
febb465c71
commit
8eaa382604
@ -6,19 +6,6 @@
|
|||||||
<script src="{{ asset('js/select2.min.js') }}" type="text/javascript"></script>
|
<script src="{{ asset('js/select2.min.js') }}" type="text/javascript"></script>
|
||||||
<link href="{{ asset('css/select2.css') }}" rel="stylesheet" type="text/css"/>
|
<link href="{{ asset('css/select2.css') }}" rel="stylesheet" type="text/css"/>
|
||||||
|
|
||||||
@if ($client->showMap())
|
|
||||||
<style>
|
|
||||||
#map {
|
|
||||||
width: 100%;
|
|
||||||
height: 200px;
|
|
||||||
border-width: 1px;
|
|
||||||
border-style: solid;
|
|
||||||
border-color: #ddd;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script src="https://maps.googleapis.com/maps/api/js?key={{ env('GOOGLE_MAPS_API_KEY') }}"></script>
|
|
||||||
@endif
|
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
|
|
||||||
@ -233,8 +220,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if ($client->showMap())
|
@if ($client->showMap())
|
||||||
<div id="map"></div>
|
|
||||||
<br/>
|
<iframe
|
||||||
|
width="100%"
|
||||||
|
height="200px"
|
||||||
|
frameborder="0" style="border:0"
|
||||||
|
src="https://www.google.com/maps/embed/v1/place?key={{ env('GOOGLE_MAPS_API_KEY') }}&q={!! e("{$client->address1} {$client->address2} {$client->city} {$client->state} {$client->postal_code} " . ($client->country ? $client->country->getName() : '')) !!}" allowfullscreen>
|
||||||
|
</iframe>
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<ul class="nav nav-tabs nav-justified">
|
<ul class="nav nav-tabs nav-justified">
|
||||||
@ -244,15 +237,12 @@
|
|||||||
@endif
|
@endif
|
||||||
@if ($hasExpenses)
|
@if ($hasExpenses)
|
||||||
{!! Form::tab_link('#expenses', trans('texts.expenses')) !!}
|
{!! Form::tab_link('#expenses', trans('texts.expenses')) !!}
|
||||||
@endif
|
|
||||||
@if ($hasRecurringQuotes)
|
|
||||||
{!! Form::tab_link('#recurring_quotes', trans('texts.recurring_quotes')) !!}
|
|
||||||
@endif
|
@endif
|
||||||
@if ($hasQuotes)
|
@if ($hasQuotes)
|
||||||
{!! Form::tab_link('#quotes', trans('texts.quotes')) !!}
|
{!! Form::tab_link('#quotes', trans('texts.quotes')) !!}
|
||||||
@endif
|
@endif
|
||||||
@if ($hasRecurringInvoices)
|
@if ($hasRecurringInvoices)
|
||||||
{!! Form::tab_link('#recurring_invoices', trans('texts.recurring_invoices')) !!}
|
{!! Form::tab_link('#recurring_invoices', trans('texts.recurring')) !!}
|
||||||
@endif
|
@endif
|
||||||
{!! Form::tab_link('#invoices', trans('texts.invoices')) !!}
|
{!! Form::tab_link('#invoices', trans('texts.invoices')) !!}
|
||||||
{!! Form::tab_link('#payments', trans('texts.payments')) !!}
|
{!! Form::tab_link('#payments', trans('texts.payments')) !!}
|
||||||
@ -323,16 +313,6 @@
|
|||||||
])
|
])
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@if ($hasRecurringQuotes)
|
|
||||||
<div class="tab-pane" id="recurring_quotes">
|
|
||||||
@include('list', [
|
|
||||||
'entityType' => ENTITY_RECURRING_QUOTE,
|
|
||||||
'datatable' => new \App\Ninja\Datatables\RecurringInvoiceDatatable(true, true),
|
|
||||||
'clientId' => $client->public_id,
|
|
||||||
'url' => url('api/recurring_quotes/' . $client->public_id),
|
|
||||||
])
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<div class="tab-pane" id="invoices">
|
<div class="tab-pane" id="invoices">
|
||||||
@include('list', [
|
@include('list', [
|
||||||
@ -469,50 +449,6 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@if ($client->showMap())
|
|
||||||
function initialize() {
|
|
||||||
var mapCanvas = document.getElementById('map');
|
|
||||||
var mapOptions = {
|
|
||||||
zoom: {{ DEFAULT_MAP_ZOOM }},
|
|
||||||
mapTypeId: google.maps.MapTypeId.ROADMAP,
|
|
||||||
zoomControl: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
var map = new google.maps.Map(mapCanvas, mapOptions)
|
|
||||||
var address = {!! json_encode(e("{$client->address1} {$client->address2} {$client->city} {$client->state} {$client->postal_code} " . ($client->country ? $client->country->getName() : ''))) !!};
|
|
||||||
|
|
||||||
geocoder = new google.maps.Geocoder();
|
|
||||||
geocoder.geocode( { 'address': address}, function(results, status) {
|
|
||||||
if (status == google.maps.GeocoderStatus.OK) {
|
|
||||||
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
|
|
||||||
var result = results[0];
|
|
||||||
map.setCenter(result.geometry.location);
|
|
||||||
|
|
||||||
var infowindow = new google.maps.InfoWindow(
|
|
||||||
{ content: '<b>'+result.formatted_address+'</b>',
|
|
||||||
size: new google.maps.Size(150, 50)
|
|
||||||
});
|
|
||||||
|
|
||||||
var marker = new google.maps.Marker({
|
|
||||||
position: result.geometry.location,
|
|
||||||
map: map,
|
|
||||||
title:address,
|
|
||||||
});
|
|
||||||
google.maps.event.addListener(marker, 'click', function() {
|
|
||||||
infowindow.open(map, marker);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$('#map').hide();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$('#map').hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
google.maps.event.addDomListener(window, 'load', initialize);
|
|
||||||
@endif
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@stop
|
@stop
|
||||||
|
Loading…
x
Reference in New Issue
Block a user