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
|
||||||
|
|
||||||
|
|
||||||
@ -86,23 +73,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if ($client->last_login > 0)
|
@if ($client->last_login > 0)
|
||||||
<h3 style="margin-top:0px"><small>
|
<h3 style="margin-top:0px"><small>
|
||||||
{{ trans('texts.last_logged_in') }} {{ Utils::timestampToDateTimeString(strtotime($client->last_login)) }}
|
{{ trans('texts.last_logged_in') }} {{ Utils::timestampToDateTimeString(strtotime($client->last_login)) }}
|
||||||
</small></h3>
|
</small></h3>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<h3>{{ trans('texts.details') }}</h3>
|
<h3>{{ trans('texts.details') }}</h3>
|
||||||
@if ($client->id_number)
|
@if ($client->id_number)
|
||||||
<p><i class="fa fa-id-number" style="width: 20px"></i>{{ trans('texts.id_number').': '.$client->id_number }}</p>
|
<p><i class="fa fa-id-number" style="width: 20px"></i>{{ trans('texts.id_number').': '.$client->id_number }}</p>
|
||||||
@endif
|
@endif
|
||||||
@if ($client->vat_number)
|
@if ($client->vat_number)
|
||||||
<p><i class="fa fa-vat-number" style="width: 20px"></i>{{ trans('texts.vat_number').': '.$client->vat_number }}</p>
|
<p><i class="fa fa-vat-number" style="width: 20px"></i>{{ trans('texts.vat_number').': '.$client->vat_number }}</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($client->account->customLabel('client1') && $client->custom_value1)
|
@if ($client->account->customLabel('client1') && $client->custom_value1)
|
||||||
@ -130,7 +117,7 @@
|
|||||||
<p><i>{!! nl2br(e($client->private_notes)) !!}</i></p>
|
<p><i>{!! nl2br(e($client->private_notes)) !!}</i></p>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($client->industry || $client->size)
|
@if ($client->industry || $client->size)
|
||||||
@if ($client->industry)
|
@if ($client->industry)
|
||||||
{{ $client->industry->name }}
|
{{ $client->industry->name }}
|
||||||
@endif
|
@endif
|
||||||
@ -142,8 +129,8 @@
|
|||||||
@endif
|
@endif
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($client->website)
|
@if ($client->website)
|
||||||
<p>{!! Utils::formatWebsite($client->website) !!}</p>
|
<p>{!! Utils::formatWebsite($client->website) !!}</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($client->language)
|
@if ($client->language)
|
||||||
@ -160,10 +147,10 @@
|
|||||||
• {{ trans('texts.is_not_sent_reminders') }}</br>
|
• {{ trans('texts.is_not_sent_reminders') }}</br>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<h3>{{ trans('texts.address') }}</h3>
|
<h3>{{ trans('texts.address') }}</h3>
|
||||||
|
|
||||||
@if ($client->addressesMatch())
|
@if ($client->addressesMatch())
|
||||||
{!! $client->present()->address(ADDRESS_BILLING) !!}
|
{!! $client->present()->address(ADDRESS_BILLING) !!}
|
||||||
@ -174,8 +161,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<h3>{{ trans('texts.contacts') }}</h3>
|
<h3>{{ trans('texts.contacts') }}</h3>
|
||||||
@foreach ($client->contacts as $contact)
|
@foreach ($client->contacts as $contact)
|
||||||
@if ($contact->first_name || $contact->last_name)
|
@if ($contact->first_name || $contact->last_name)
|
||||||
<b>{{ $contact->first_name.' '.$contact->last_name }}</b><br/>
|
<b>{{ $contact->first_name.' '.$contact->last_name }}</b><br/>
|
||||||
@ -206,78 +193,81 @@
|
|||||||
@endif
|
@endif
|
||||||
<br/>
|
<br/>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<h3>{{ trans('texts.standing') }}
|
<h3>{{ trans('texts.standing') }}
|
||||||
<table class="table" style="width:100%">
|
<table class="table" style="width:100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td><small>{{ trans('texts.paid_to_date') }}</small></td>
|
<td><small>{{ trans('texts.paid_to_date') }}</small></td>
|
||||||
<td style="text-align: right">{{ Utils::formatMoney($client->paid_to_date, $client->getCurrencyId()) }}</td>
|
<td style="text-align: right">{{ Utils::formatMoney($client->paid_to_date, $client->getCurrencyId()) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><small>{{ trans('texts.balance') }}</small></td>
|
<td><small>{{ trans('texts.balance') }}</small></td>
|
||||||
<td style="text-align: right">{{ Utils::formatMoney($client->balance, $client->getCurrencyId()) }}</td>
|
<td style="text-align: right">{{ Utils::formatMoney($client->balance, $client->getCurrencyId()) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@if ($credit > 0)
|
@if ($credit > 0)
|
||||||
<tr>
|
<tr>
|
||||||
<td><small>{{ trans('texts.credit') }}</small></td>
|
<td><small>{{ trans('texts.credit') }}</small></td>
|
||||||
<td style="text-align: right">{{ Utils::formatMoney($credit, $client->getCurrencyId()) }}</td>
|
<td style="text-align: right">{{ Utils::formatMoney($credit, $client->getCurrencyId()) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endif
|
@endif
|
||||||
</table>
|
</table>
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</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">
|
||||||
{!! Form::tab_link('#activity', trans('texts.activity'), true) !!}
|
{!! Form::tab_link('#activity', trans('texts.activity'), true) !!}
|
||||||
@if ($hasTasks)
|
@if ($hasTasks)
|
||||||
{!! Form::tab_link('#tasks', trans('texts.tasks')) !!}
|
{!! Form::tab_link('#tasks', trans('texts.tasks')) !!}
|
||||||
@endif
|
@endif
|
||||||
@if ($hasExpenses)
|
@if ($hasExpenses)
|
||||||
{!! Form::tab_link('#expenses', trans('texts.expenses')) !!}
|
{!! Form::tab_link('#expenses', trans('texts.expenses')) !!}
|
||||||
@endif
|
@endif
|
||||||
@if ($hasRecurringQuotes)
|
@if ($hasQuotes)
|
||||||
{!! Form::tab_link('#recurring_quotes', trans('texts.recurring_quotes')) !!}
|
{!! Form::tab_link('#quotes', trans('texts.quotes')) !!}
|
||||||
@endif
|
@endif
|
||||||
@if ($hasQuotes)
|
|
||||||
{!! Form::tab_link('#quotes', trans('texts.quotes')) !!}
|
|
||||||
@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')) !!}
|
||||||
@if ($account->isModuleEnabled(ENTITY_CREDIT))
|
@if ($account->isModuleEnabled(ENTITY_CREDIT))
|
||||||
{!! Form::tab_link('#credits', trans('texts.credits')) !!}
|
{!! Form::tab_link('#credits', trans('texts.credits')) !!}
|
||||||
@endif
|
@endif
|
||||||
</ul><br/>
|
</ul><br/>
|
||||||
|
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
|
||||||
<div class="tab-pane active" id="activity">
|
<div class="tab-pane active" id="activity">
|
||||||
{!! Datatable::table()
|
{!! Datatable::table()
|
||||||
->addColumn(
|
->addColumn(
|
||||||
trans('texts.date'),
|
trans('texts.date'),
|
||||||
trans('texts.message'),
|
trans('texts.message'),
|
||||||
trans('texts.balance'),
|
trans('texts.balance'),
|
||||||
trans('texts.adjustment'))
|
trans('texts.adjustment'))
|
||||||
->setUrl(url('api/activities/'. $client->public_id))
|
->setUrl(url('api/activities/'. $client->public_id))
|
||||||
->setCustomValues('entityType', 'activity')
|
->setCustomValues('entityType', 'activity')
|
||||||
->setCustomValues('clientId', $client->public_id)
|
->setCustomValues('clientId', $client->public_id)
|
||||||
->setCustomValues('rightAlign', [2, 3])
|
->setCustomValues('rightAlign', [2, 3])
|
||||||
->setOptions('sPaginationType', 'bootstrap')
|
->setOptions('sPaginationType', 'bootstrap')
|
||||||
->setOptions('bFilter', false)
|
->setOptions('bFilter', false)
|
||||||
->setOptions('aaSorting', [['0', 'desc']])
|
->setOptions('aaSorting', [['0', 'desc']])
|
||||||
->render('datatable') !!}
|
->render('datatable') !!}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if ($hasTasks)
|
@if ($hasTasks)
|
||||||
@ -323,18 +313,8 @@
|
|||||||
])
|
])
|
||||||
</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', [
|
||||||
'entityType' => ENTITY_INVOICE,
|
'entityType' => ENTITY_INVOICE,
|
||||||
'datatable' => new \App\Ninja\Datatables\InvoiceDatatable(true, true),
|
'datatable' => new \App\Ninja\Datatables\InvoiceDatatable(true, true),
|
||||||
@ -390,17 +370,17 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var loadedTabs = {};
|
var loadedTabs = {};
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
$('.normalDropDown:not(.dropdown-toggle)').click(function(event) {
|
$('.normalDropDown:not(.dropdown-toggle)').click(function(event) {
|
||||||
openUrlOnClick('{{ URL::to('clients/' . $client->public_id . '/edit') }}', event);
|
openUrlOnClick('{{ URL::to('clients/' . $client->public_id . '/edit') }}', event);
|
||||||
});
|
});
|
||||||
$('.primaryDropDown:not(.dropdown-toggle)').click(function(event) {
|
$('.primaryDropDown:not(.dropdown-toggle)').click(function(event) {
|
||||||
openUrlOnClick('{{ URL::to('clients/statement/' . $client->public_id ) }}', event);
|
openUrlOnClick('{{ URL::to('clients/statement/' . $client->public_id ) }}', event);
|
||||||
});
|
});
|
||||||
|
|
||||||
// load datatable data when tab is shown and remember last tab selected
|
// load datatable data when tab is shown and remember last tab selected
|
||||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||||
@ -424,31 +404,31 @@
|
|||||||
} else {
|
} else {
|
||||||
window['load_activity']();
|
window['load_activity']();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function onArchiveClick() {
|
function onArchiveClick() {
|
||||||
$('#action').val('archive');
|
$('#action').val('archive');
|
||||||
$('.mainForm').submit();
|
$('.mainForm').submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onRestoreClick() {
|
function onRestoreClick() {
|
||||||
$('#action').val('restore');
|
$('#action').val('restore');
|
||||||
$('.mainForm').submit();
|
$('.mainForm').submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDeleteClick() {
|
function onDeleteClick() {
|
||||||
sweetConfirm(function() {
|
sweetConfirm(function() {
|
||||||
$('#action').val('delete');
|
$('#action').val('delete');
|
||||||
$('.mainForm').submit();
|
$('.mainForm').submit();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPurgeClick() {
|
function onPurgeClick() {
|
||||||
sweetConfirm(function() {
|
sweetConfirm(function() {
|
||||||
$('#action').val('purge');
|
$('#action').val('purge');
|
||||||
$('.mainForm').submit();
|
$('.mainForm').submit();
|
||||||
}, "{{ trans('texts.purge_client_warning') . "\\n\\n" . trans('texts.mobile_refresh_warning') . "\\n\\n" . trans('texts.no_undo') }}");
|
}, "{{ trans('texts.purge_client_warning') . "\\n\\n" . trans('texts.mobile_refresh_warning') . "\\n\\n" . trans('texts.no_undo') }}");
|
||||||
}
|
}
|
||||||
|
|
||||||
function showEmailHistory(email) {
|
function showEmailHistory(email) {
|
||||||
window.emailBounceId = false;
|
window.emailBounceId = false;
|
||||||
@ -469,50 +449,6 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@if ($client->showMap())
|
</script>
|
||||||
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>
|
|
||||||
|
|
||||||
@stop
|
@stop
|
||||||
|
Loading…
x
Reference in New Issue
Block a user