templates/business_contacts/index.html.twig line 1
{% extends 'base.html.twig' %}
{% block title %}Business Contacts{% endblock %}
{% block body %}
{% include 'business_contacts/parts/import_and_export.html.twig' %}
{% for business_type in business_types %}
{% set business_contacts_count = CountBusinessContactsService.count(business_type) %}
{% set business_contacts_count_with_map_locations = CountBusinessContactsService.countWithMapLocations(business_type) %}
{% if business_type.mapicon is not null %}
{% set file = asset( 'administration/ATSSharedFiles/BusinessContactsMapIcons/' ~ business_type.mapIcon.iconFile) %}
{% endif %}
{% if business_contacts_count >0 %}
<div class="row">
<div class="col-10">
<h2 style="color: red">
{% if business_contacts_count_with_map_locations> 0 %}
<a class="btn btn-danger btn-sm"
href="{{ path('business_contacts_map',{subset: business_type.businessType}) }}">
<i class="fa fa-map-marker"></i>
</a>
{% endif %}
{% if business_type.mapIcon is not empty %}
<img height="40" width="40" src="{{ file }}">
{% endif %}
{% if is_granted('ROLE_ADMIN') %}
<a target="_blank" href="{{ path('business_types_edit',{id:business_type.id}) }}">
{{ business_type.businessType }}
</a>
{% else %}
{{ business_type.businessType }}
{% endif %}
{% if app.user %}
<a href="{{ path('business_contacts_new', {business_type: business_type.id}) }}">+</a>
{% endif %}
</h2>
</div>
</div>
<table class="table table-responsive custom-table">
<thead>
<tr>
{# <---- Start of Body 1 ----> #}
<th>Photo</th>
{# <---- End of Body 1 ----> #}
{# <---- Start of Body 2 ----> #}
<th style="width: 350px; text-align: left">Company</th>
{% if list_or_map=='map' %}
<th></th>{% endif %}
<th style="width: 100px; text-align: left">
<i class="fa fa-user"></i>
</th>
{# <---- End of Body 2 ----> #}
{# <---- Start of Body 3 ----> #}
<th class="desktop" title="Website" style="width: 10px; text-align: center">
<i class="fa fa-link"></i>
</th>
<th class="desktop" title="Email" style="width: 10px; text-align: center">
<i class="fa fa-envelope"></i>
</th>
<th class="desktop" title="Mobile" style="width: 10px; text-align: center; border-left: 1px dotted;">
<i class="fab fa-whatsapp"></i>
</th>
{% for type in ['mobile'] %}
{% include 'business_contacts/parts/telephone_numbers_header.html.twig' %}
{% endfor %}
<th class="desktop" title="Phone" style="width: 10px; text-align: center">
<i class="fa fa-phone"></i>
</th>
{% for type in ['landline'] %}
{% include 'business_contacts/parts/telephone_numbers_header.html.twig' %}
{% endfor %}
{# <---- End of Body 3 ----> #}
{# <---- Start of Body 4 ----> #}
<th class="mobile">' '</th>
<th class="desktop" title="Address" style="width: 400px; text-align: left">
<i class="fa fa-building"></i>
</th>
{# <---- End of Body 4 ----> #}
{# <---- Start of Body 5 ----> #}
<th class="desktop" title="Notes" style="width: 100px; text-align: left"><i class="fa fa-pen"></i>
</th>
<th style="width: 10px; text-align: center" title="Business card"><i class="fa fa-address-card"></i>
</th>
<th class="desktop" title="Files" style="width: 10px; text-align: center"><i
class="fa fa-file-pdf"></i></th>
{% include 'business_contacts/parts/access_count_headers.html.twig' %}
</tr>
</thead>
<tbody>
{% for business_contact in business_contacts %}
{% set phoneAnalysisMobile = phoneAnalysisMobile[business_contact.id] ?? null %}
{% set phoneAnalysisLandline = phoneAnalysisLandline[business_contact.id] ?? null %}
{% if business_type == business_contact.businessType %}
{% set business_contact_website =[] %}
{% if business_contact.website is not empty %}
{% if business_contact.website starts with 'http' %}
{% set business_contact_website = business_contact.website %}
{% else %}
{% set business_contact_website = 'https://'~ business_contact.website %}
{% endif %}
{% endif %}
<tr>
{% include 'business_contacts/parts/1 photo.html.twig' %}
{% include 'business_contacts/parts/2 company_and_user.html.twig' %}
{% include 'business_contacts/parts/3 website_email_tels.html.twig' %}
{% include 'business_contacts/parts/4 map marker.html.twig' %}
{% include 'business_contacts/parts/5 notes buttons files.html.twig' %}
{% include 'business_contacts/parts/access_count_body.html.twig' %}
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
<br><br>
{% endif %}
{% endfor %}
{% endblock %}
{% block datatable %}
<script>
{% if is_granted('ROLE_ADMIN') %}
$(document).ready(function () {
$('.table').DataTable({
'pageLength': 100,
"order": [[12, 'asc'], [1, 'asc']],
"paging": false,
"searching": false,
"bInfo": false
});
});
{% else %}
$(document).ready(function () {
$('.table').DataTable({
'pageLength': 100,
"order": [[1, 'asc']],
"paging": false,
"searching": false,
"bInfo": false
});
});
{% endif %}
</script>
{% endblock datatable %}
{% block additionaljs %}
<script>
var businessContactId = '';
function getLocation(id) {
businessContactId = id;
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showLocation);
} else {
$('#location').html('Geolocation is not supported by this browser.');
}
}
function showLocation(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
var pin = latitude + "," + longitude;
$.ajax({
type: 'POST',
url: 'update/location',
data: 'latitude=' + latitude + '&longitude=' + longitude + '&id=' + businessContactId,
success: function (msg) {
location.reload();
}
});
}
</script>
<script>
$('.action').click(function (e) {
e.preventDefault();
let elem = $(this);
let id = $(this).attr('data-id');
let action = $(this).attr('data-action');
let url = '/referrals/new_from_businesscontacts/' + id + '/' + action;
$.ajax({
type: 'GET',
url: url,
success: function (msg) {
//window.location.href()
//alert('success');
let goTo = elem.attr('href');
window.open(goTo, '_blank');
}
});
})
</script>
{% endblock %}