{#
{% extends "@ApplicationInternit/ContentBundle/Resources/views/template/standard_layout.html.twig" %}
{% block javascripts %}
{{ parent() }}
<script>
$(document).ready(function() {
// BOTÕES DE VISUALIZAR E EXPORTAR LEADS.
// Cada botão deve ter os seguintes atributos:
// formaction: rota que será chamada.
// data-group: o grupo de leads que será alvo da operação.
$('.js-btn-export, .js-view-group').click(function(e) {
e.preventDefault();
let leadCount = $('.lead').length;
let group = '';
let showAll = $('#js-all-groups').is(':checked');
// se a checkbox de mostrar todos os grupos foi marcada
if (! showAll) {
// quando há mais de um box de grupo de leads
if (leadCount > 1) {
group = $(this).attr('data-group');
}
// quando há apenas um box de grupo na tela, há apenas um botão de exportar
else if (leadCount == 1) {
group = $('#js-group').val();
}
}
$('#js-group').val(group);
let action = $(this).attr('formaction');
$('#filtro-leads')
.attr('action', action)
.submit();
});
});
</script>
{% endblock %}
{% block stylesheets %}
{{ parent() }}
<link rel="stylesheet" href="{{ asset('/bundles/applicationinternitcontent/css/productBundle.css') }}"/>
{% endblock %}
{% block title %}
Detalhes da campanha
{% endblock %}
{% block sonata_admin_content %}
<div class="product-list-container show" >
<div class="titleDefault">
<div class="group">
<h3>Detalhes da campanha</h3>
<p>Acompanhe seu desempenho nas campanhas ativas.</p>
</div>
<div class="filter">
<form id="filtro-leads" method="POST" action="{{ path('admin_internit_lead_product_show',{'id': data.id})}}">
<div class="ordenar">
<p>De:</p>
<input type="date" id="filter-from" name="filter[from]" class="date-filter sonata-medium-date valid" value="{{ filter.from }}">
</div>
<div class="ordenar">
<p>Até:</p>
<input type="date" id="filter-to" name="filter[to]" class="date-filter sonata-medium-date valid" value="{{ filter.to }}">
</div>
<div class="ordenar">
<p>Imobiliária:</p>
<select class="select-imobiliaria big" name="filter[imob]">
<option value="">Selecione</option>
{% for imob in imobFilter %}
{% set selected = imob.name == filter['imob'] ? 'selected' : '' %}
<option value="{{imob.name}}" {{ selected }}>{{ imob.name }}</option>
{% endfor %}
</select>
</div>
<div class="group">
<input type="hidden" value="{{ filter.group }}" name="filter[group]" id="js-group">
</div>
{% if filter.group is not empty %}
<div class="ordenar">
<label>
<input type="checkbox" name="all-groups" id="js-all-groups">
Todos os grupos
</label>
</div>
{% endif %}
<div class="group">
<button type="submit" class="button-geral js-view-group"
formaction="{{ path('admin_internit_lead_product_show', {'id': data.id}) }}">Filtrar</button>
<button class="button-geral js-btn-export"
formaction="{{ path('admin_internit_lead_product_exportFiltered', {'id': data.id}) }}"
data-group="">
<i class="fas fa-download"></i> Exportar
</button>
</div>
</form>
</div>
<div class="btn-action">
{% if app.user.hasRole(['ROLE_CONSTRUTORA']) %}
<a class="button-geral" href="{{ path('admin_internit_lead_product_edit', {'id': data.id}) }}">
<i class="fas fa-edit"></i> Editar Campanha</a>
{% endif %}
</div>
</div>
{% set groupLeadsType = getLeadsGroup(data.id, filter) %}
{% if groupLeadsType|length == 1 %}
<section class="lead-list active">
<div class="title-lead">
<div class="title">
<h3>Leads</h3>
<h2>{{ data.name }} <span class="span-title">- {{ groupLeadsType|first.group }}</span></h2>
</div>
{% set LeadsType = getLeadsByGroup(data.id, groupLeadsType|first.group, filter) %}
<h2><span class="span-leads">Leads Recebidos</span>{{ LeadsType|length }}</h2>
</div>
<div class="lead">
<div class="lead-head">
<div class="field big">
<p>Nome</p>
</div>
<div class="field med">
<p>E-mail</p>
</div>
<div class="field small">
<p>DDD Celular</p>
</div>
<div class="field small">
<p>Origem</p>
</div>
<div class="field med">
<p>Grupo</p>
</div>
{% if userGroup == 'Construtora' %}
<div>
<p> Corretor </p>
</div>
{% endif %}
<div class="field med">
{% if userGroup == 'Construtora' %}
<p> Imobiliária </p>
{% else %}
<p>Corretor (e-mail)</p>
{% endif %}
</div>
<div class="field med">
<p>Data de Cadastro</p>
</div>
<div class="field med">
<p>Utm Source</p>
</div>
<div class="field med">
<p>Utm Campaign</p>
</div>
<div class="field med">
<p>Utm Medium</p>
</div>
</div>
<div class="lead-fields">
{% for lead in LeadsType %}
<div class="lead-field">
<div class="field big">
<span class="span-resp">Nome</span>
<p>{{ lead.name }}</p>
</div>
<div class="field med">
<span class="span-resp">E-mail</span>
<p>{{ lead.email }}</p>
</div>
<div class="field small">
<span class="span-resp">DDD Celular</span>
<p>{{ lead.phone }}</p>
</div>
<div class="field small">
<span class="span-resp">Origem</span>
<p>{{ lead.origem }}</p>
</div>
<div class="field med">
<span class="span-resp">Grupo</span>
<p>{{ lead.group }}</p>
</div>
<div class="field med">
{% if userGroup == 'Construtora' %}
<p>{{ lead.brokerEmail }}</p>
{% endif %}
</div>
<div class="field med">
{% if userGroup == 'Construtora' %}
<span class="span-resp">Imobiliária</span>
<p>{{ lead.brokerRealState }}</p>
{% else %}
<span class="span-resp">Corretor (e-mail)</span>
<p>{{ lead.brokerEmail }}</p>
{% endif %}
</div>
<div class="field med">
<span class="span-resp">Data de Cadastro</span>
<p>{{ lead.createdAt|date('d-m-Y H:i:s') }}</p>
</div>
<div class="field med">
<span class="span-resp">Utm Source</span>
<p>{{ lead.utm_source }}</p>
</div>
<div class="field med">
<span class="span-resp">Utm Campaign</span>
<p>{{ lead.utm_campaign }}</p>
</div>
<div class="field med">
<span class="span-resp">Utm Medium</span>
<p>{{ lead.utm_medium }}</p>
</div>
</div>
{% endfor %}
</div>
</div>
</section>
{% elseif groupLeadsType|length > 1 %}
<section class="lead-list second-option active">
{% for groupLead in groupLeadsType %}
{% set LeadsType = getLeadsByGroup(data.id, groupLead.group,filter) %}
<div class="lead">
<div class="title-lead">
<div class="title-1">
<div class="title">
<h3>Leads</h3>
<h2>{{ data.name }}</h2>
<span class="span-title">{{ groupLead.group }}</span>
</div>
<div class="btn-action">
<button class="button-geral button-add js-view-group"
formaction="{{ path('admin_internit_lead_product_show', {'id': data.id}) }}"
data-group="{{ groupLead.group }}">
<i class="fas fa-eye"></i> Visualizar
</button>
<button class="button-geral js-btn-export"
formaction="{{ path('admin_internit_lead_product_exportFiltered', {'id': data.id}) }}"
data-group="{{ groupLead.group }}">
<i class="fas fa-download"></i> Exportar
</button>
</div>
</div>
</div>
<div class="lead-body">
<div class="lead-head">
<div class="field">
<p>Nome</p>
</div>
<div class="field">
<p>E-mail</p>
</div>
<div class="field">
<p>Grupo</p>
</div>
</div>
<div class="lead-fields-container">
<div class="lead-fields">
{% for lead in LeadsType %}
<div class="lead-field">
<div class="field">
<span class="span-resp">Nome</span>
<p>{{ lead.name }}</p>
</div>
<div class="field">
<span class="span-resp">E-mail</span>
<p>{{ lead.email }}</p>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
<div class="foot-lead">
<h2><span class="span-leads">Leads Recebidos</span>{{ LeadsType|length }}</h2>
</div>
</div>
{% endfor %}
</section>
{% else %}
<p>Nenhum Lead encontrado</p>
{% endif %}
</div>
{% endblock %}#}
{% extends "@ApplicationInternit/ContentBundle/Resources/views/template/standard_layout.html.twig" %}
{% block stylesheets %}
{{ parent() }}
<link rel="stylesheet" href="{{ asset('/bundles/applicationinternitcontent/css/productBundle.css') }}"/>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.2/css/bulma.min.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bm/jszip-2.5.0/dt-1.11.4/af-2.3.7/b-2.2.2/b-colvis-2.2.2/b-html5-2.2.2/b-print-2.2.2/cr-1.5.5/date-1.1.1/fc-4.0.1/fh-3.2.1/kt-2.6.4/r-2.2.9/rg-1.1.4/rr-1.2.8/sc-2.0.5/sb-1.3.1/sp-1.4.0/sl-1.3.4/datatables.min.css"/>
<style>
table.dataTable td {
font-size: 1em;
}
th { font-size: 80%; }
tr { font-size: 90%; }
</style>
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/v/bm/jszip-2.5.0/dt-1.11.4/af-2.3.7/b-2.2.2/b-colvis-2.2.2/b-html5-2.2.2/b-print-2.2.2/cr-1.5.5/date-1.1.1/fc-4.0.1/fh-3.2.1/kt-2.6.4/r-2.2.9/rg-1.1.4/rr-1.2.8/sc-2.0.5/sb-1.3.1/sp-1.4.0/sl-1.3.4/sr-1.1.0/datatables.min.js"></script>
<script>
$(document).ready(function() {
$('.mark-beta').css('margin-top', '20px')
// BOTÕES DE VISUALIZAR E EXPORTAR LEADS.
// Cada botão deve ter os seguintes atributos:
// formaction: rota que será chamada.
// data-group: o grupo de leads que será alvo da operação.
$('.js-btn-export, .js-view-group').click(function(e) {
e.preventDefault();
let leadCount = $('.lead').length;
let group = '';
let showAll = $('#js-all-groups').is(':checked');
// se a checkbox de mostrar todos os grupos foi marcada
if (! showAll) {
// quando há mais de um box de grupo de leads
if (leadCount > 1) {
group = $(this).attr('data-group');
}
// quando há apenas um box de grupo na tela, há apenas um botão de exportar
else if (leadCount == 1) {
group = $('#js-group').val();
}
}
$('#js-group').val(group);
let action = $(this).attr('formaction');
$('#filtro-leads')
.attr('action', action)
.submit();
});
var table = $('.dataTable').DataTable({
"scrollX": true,
//"scrollY": "500px",
// "scrollCollapse": true,
//"paging": true,
"order": [[ 7, "desc" ]],
"columnDefs": [
{ "visible": false, "targets": 8 },
{ "visible": false, "targets": 9 },
{ "visible": false, "targets": 10 },
],
"pageLength": 10,
"language": {
"lengthMenu": "Exibindo _MENU_ resultados por pagina",
"zeroRecords": "Nenhum Resultado Encontrado",
"info": "Exibindo pagina _PAGE_ de _PAGES_",
"infoEmpty": "Não há registros disponíveis",
"infoFiltered": "(filtrado de _MAX_ registros totais)",
'search': "Buscar",
}
});
$('#DataTables_Table_0_length').find('label').find('div').replaceWith($('#DataTables_Table_0_length').find('select'))
//$('#DataTables_Table_0_length').css('font-size', '15px')
$('div.dataTables_filter input').css('font-size', '70%');
$('.dataTables_filter').find('label').append(`
<select class="custom-select custom-select-sm form-control form-control-sm show-collums" style="width: 120px">
<option value="-1" selected disabled>Colunas</option>
<optgroup label="Exibindo" class="show-collums-show">
<option value="0">Nome</option>
<option value="1">Email</option>
<option value="2">Telefone</option>
<option value="3">Corretor (e-mail)</option>
<option value="4">Imobilíaria</option>
<option value="5">Origem</option>
<option value="6">Grupo</option>
<option value="7">Data de Cadastro</option>
</optgroup>
<optgroup label="Oculto" class="show-collums-hide">
<option value="8">Utm Source</option>
<option value="9">Utm Campaign</option>
<option value="10">Utm Medium</option>
</optgroup>
</select>`)
$('.show-collums').on('change', function (e){
var columnNum = $(this).val()
var column = table.column( columnNum );
if(column.visible()){
column.visible( false );
var option = $(`.show-collums-show option[value="${columnNum}"]`)
$(`.show-collums-hide`).append(option.clone())
option.remove()
alphabetizeList('.show-collums-hide');
}else{
column.visible( true );
var option = $(`.show-collums-hide option[value="${columnNum}"]`)
$(`.show-collums-show`).append(option.clone())
option.remove()
alphabetizeList('.show-collums-show');
}
$(this).val('-1')
})
function alphabetizeList(listField) {
var sel = $(listField);
var selected = sel.val(); // cache selected value, before reordering
var opts_list = sel.find('option');
opts_list.sort(function (a, b) {
return $(a).val() > $(b).val() ? 1 : -1;
});
sel.html('').append(opts_list);
sel.val(selected); // set cached selected value
}
});
</script>
{% endblock %}
{% block title %}
Detalhes da campanha
{% endblock %}
{% block sonata_admin_content %}
<div class="product-list-container show" >
<div class="titleDefault">
<div class="group">
<h3>Detalhes da campanha</h3>
<p>Acompanhe seu desempenho nas campanhas ativas.</p>
</div>
<div class="filter">
<form id="filtro-leads" method="POST" action="{{ path('admin_internit_lead_product_show',{'id': data.id})}}">
<div class="ordenar">
<p>De:</p>
<input type="date" id="filter-from" name="filter[from]" class="date-filter sonata-medium-date valid" value="{{ filter.from }}">
</div>
<div class="ordenar">
<p>Até:</p>
<input type="date" id="filter-to" name="filter[to]" class="date-filter sonata-medium-date valid" value="{{ filter.to }}">
</div>
<div class="ordenar">
<p>Imobiliária:</p>
<select class="select-imobiliaria big" name="filter[imob]">
<option value="">Selecione</option>
{% for imob in imobFilter %}
{% set selected = imob.name == filter['imob'] ? 'selected' : '' %}
<option value="{{imob.name}}" {{ selected }}>{{ imob.name }}</option>
{% endfor %}
</select>
</div>
<div class="ordenar">
<p>Usuários:</p>
<select class="select-user big" name="filter[user]">
<option value="">Selecione</option>
{% for user in userFilter %}
{% set selected = user.name == filter['user'] ? 'selected' : '' %}
<option value="{{user.name}}" {{ selected }}>{{ user.name }}</option>
{% endfor %}
</select>
</div>
<div class="group">
<input type="hidden" value="{{ filter.group }}" name="filter[group]" id="js-group">
</div>
{% if filter.group is not empty %}
<div class="ordenar">
<label>
<input type="checkbox" name="all-groups" id="js-all-groups">
Todos os grupos
</label>
</div>
{% endif %}
<div class="group">
<button type="submit" class="button-geral js-view-group"
formaction="{{ path('admin_internit_lead_product_show', {'id': data.id}) }}">Filtrar</button>
<button class="button-geral js-btn-export"
formaction="{{ path('admin_internit_lead_product_exportFiltered', {'id': data.id}) }}"
data-group="">
<i class="fas fa-download"></i> Exportar
</button>
<div class="btn-action">
{% if app.user.hasRole(['ROLE_CONSTRUTORA']) %}
<a class="button-geral" href="{{ path('admin_internit_lead_product_edit', {'id': data.id}) }}">
<i class="fas fa-edit"></i> Editar Campanha</a>
{% endif %}
</div>
</div>
</form>
</div>
</div>
{% set groupLeadsType = getLeadsGroup(data.id, filter) %}
{% if groupLeadsType|length == 1 %}
<section class="lead-list active">
<div class="title-lead">
<div class="title">
<h3>Leads</h3>
<h2>{{ data.name }} <span class="span-title">- {{ groupLeadsType|first.group }}</span></h2>
</div>
<div>
{% set LeadsType = getLeadsByGroup(data.id, groupLeadsType|first.group, filter) %}
<h2><span class="span-leads">Leads Recebidos</span>{{ LeadsType|length }}</h2>
</div>
</div>
<hr>
<br>
<div class="lead" style="margin-right: 20px; margin-left: 20px;">
{# nowrap #}
<table class="display nowrap dataTable " style="width:100%">
{# style="font-size: 80%;" #}
<thead >
{#<tr>
<th rowspan="1"></th>
<th colspan="7"></th>
<th colspan="7"></th>
</tr>#}
<tr>
<th>Nome</th>
<th>E-mail</th>
<th>Telefone</th>
<th>Corretor (e-mail)</th>
{% if userGroup == 'Construtora' %}
<th>Imobiliária</th>
{% endif %}
<th>Origem</th>
<th>Grupo</th>
<th>Data de Cadastro</th>
<th>Utm Source</th>
<th>Utm Campaign</th>
<th>Utm Medium</th>
</tr>
</thead>
<tbody>
{% for lead in LeadsType %}
{% for i in 0..0 %}
<tr>
<td>{{ lead.name }}</td>
<td>{{ lead.email }}</td>
<td>{{ lead.phone }}</td>
<td>{{ lead.brokerEmail }}</td>
{% if userGroup == 'Construtora' %}
<td>{{ lead.brokerRealState }}</td>
{% endif %}
<td>{{ lead.origem }}</td>
<td>{{ lead.group }}</td>
<td><span style="display: none">{{ lead.createdAt|date('YmdHis') }}</span>{{ lead.createdAt|date('d/m/Y H:i:s') }}</td> <td>{{ lead.utm_source }}</td>
<td>{{ lead.utm_campaign }}</td>
<td>{{ lead.utm_medium }}</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
<tfoot>
<tr>
<th>Nome</th>
<th>E-mail</th>
<th>Telefone</th>
<th>Corretor (e-mail)</th>
{% if userGroup == 'Construtora' %}
<th>Imobiliária</th>
{% endif %}
<th>Origem</th>
<th>Grupo</th>
<th>Data de Cadastro</th>
<th>Utm Source</th>
<th>Utm Campaign</th>
<th>Utm Medium</th>
</tr>
</tfoot>
</table>
</div>
{# <div class="lead">
<div class="lead-head">
<div class="field big">
<p>Nome</p>
</div>
<div class="field med">
<p>E-mail</p>
</div>
<div class="field small">
<p>DDD Celular</p>
</div>
<div class="field small">
<p>Origem</p>
</div>
<div class="field med">
<p>Grupo</p>
</div>
<div class="field med">
{% if userGroup == 'Construtora' %}
<p> Imobiliária </p>
{% else %}
<p>Corretor (e-mail)</p>
{% endif %}
</div>
<div class="field med">
<p>Data de Cadastro</p>
</div>
<div class="field med">
<p>Utm Source</p>
</div>
<div class="field med">
<p>Utm Campaign</p>
</div>
<div class="field med">
<p>Utm Medium</p>
</div>
</div>
<div class="lead-fields">
{% for lead in LeadsType %}
<div class="lead-field">
<div class="field big">
<span class="span-resp">Nome</span>
<p>{{ lead.name }}</p>
</div>
<div class="field med">
<span class="span-resp">E-mail</span>
<p>{{ lead.email }}</p>
</div>
<div class="field small">
<span class="span-resp">DDD Celular</span>
<p>{{ lead.phone }}</p>
</div>
<div class="field small">
<span class="span-resp">Origem</span>
<p>{{ lead.origem }}</p>
</div>
<div class="field med">
<span class="span-resp">Grupo</span>
<p>{{ lead.group }}</p>
</div>
<div class="field med">
{% if userGroup == 'Construtora' %}
<span class="span-resp">Imobiliária</span>
<p>{{ lead.brokerRealState }}</p>
{% else %}
<span class="span-resp">Corretor (e-mail)</span>
<p>{{ lead.brokerEmail }}</p>
{% endif %}
</div>
<div class="field med">
<span class="span-resp">Data de Cadastro</span>
<p>{{ lead.createdAt|date('d-m-Y H:i:s') }}</p>
</div>
<div class="field med">
<span class="span-resp">Utm Source</span>
<p>{{ lead.utm_source }}</p>
</div>
<div class="field med">
<span class="span-resp">Utm Campaign</span>
<p>{{ lead.utm_campaign }}</p>
</div>
<div class="field med">
<span class="span-resp">Utm Medium</span>
<p>{{ lead.utm_medium }}</p>
</div>
</div>
{% endfor %}
</div>
</div>#}
</section>
{% elseif groupLeadsType|length > 1 %}
<section class="lead-list second-option active">
{% for groupLead in groupLeadsType %}
{% set LeadsType = getLeadsByGroup(data.id, groupLead.group,filter) %}
<div class="lead">
<div class="title-lead">
<div class="title-1">
<div class="title">
<h3>Leads</h3>
<h2>{{ data.name }}</h2>
<span class="span-title">{{ groupLead.group }}</span>
</div>
<div class="btn-action">
<button class="button-geral button-add js-view-group"
formaction="{{ path('admin_internit_lead_product_show', {'id': data.id}) }}"
data-group="{{ groupLead.group }}">
<i class="fas fa-eye"></i> Visualizar
</button>
<button class="button-geral js-btn-export"
formaction="{{ path('admin_internit_lead_product_exportFiltered', {'id': data.id}) }}"
data-group="{{ groupLead.group }}">
<i class="fas fa-download"></i> Exportar
</button>
</div>
</div>
</div>
<div class="lead-body">
<div class="lead-head">
<div class="field">
<p>Nome</p>
</div>
<div class="field">
<p>E-mail</p>
</div>
<div class="field">
<p>Grupo</p>
</div>
</div>
<div class="lead-fields-container">
<div class="lead-fields">
{% for lead in LeadsType %}
<div class="lead-field">
<div class="field">
<span class="span-resp">Nome</span>
<p>{{ lead.name }}</p>
</div>
<div class="field">
<span class="span-resp">E-mail</span>
<p>{{ lead.email }}</p>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
<div class="foot-lead">
<h2><span class="span-leads">Leads Recebidos</span>{{ LeadsType|length }}</h2>
</div>
</div>
{% endfor %}
</section>
{% else %}
<p>Nenhum Lead encontrado</p>
{% endif %}
</div>
<br><br><br><br>
{% endblock %}