{% extends 'layout.html.twig' %}
{% trans_default_domain 'PotentialCustomerCompany' %}
{% block title %}{{ 'ui.sales_journals' | trans }}{% endblock %}
{% block body %}
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="page-header">
<h1>{{ 'ui.sales_journals' | trans }}</h1>
</div>
<div class="btn-toolbar">
<div class="btn-group pull-right">
<a href="{{ path('app.sales_journal.create') }}" class="btn btn-primary" title="{{ 'ui.create' | trans }}"><i class="fa fa-plus"></i> {{ 'ui.create' | trans }}</a>
</div>
<div class="btn-group pull-right">
<a href="{{ path('app.sales_journal.print_all') }}" target="_blank" class="btn btn-default" title="{{ 'ui.print' | trans({}, 'app') }}"><i class="fa fa-print"></i> {{ 'ui.print' | trans({}, 'app') }}</a>
</div>
</div>
<table id="customer-list" class="table">
<thead>
<tr>
<th>#</th>
<th>{{ 'property.name' | trans }} / VAR / {{ 'property.notes' | trans }}</th>
<th>{{ 'property.contacts' | trans }}</th>
<th style="min-width: 170px;"></th>
</tr>
</thead>
<tbody>
{% for company in companies %}
<tr id="company-{{ company.id }}">
<td>{{ company.id }}</td>
<td>
<p><strong>{{ company.name }}</strong></p>
<p>
{% if company.company is null %}
{% if is_granted('create', newVar) %}
<a href="{{ path('app.sales_journal.create_var', {'company': company.id}) }}" class="btn btn-default btn-sm">{{ 'ui.create_var' | trans }}</a>
{% else %}
<i>{{ 'ui.no_var' | trans }}</i>
{% endif %}
{% else %}
<a href="{{ path('app.company.update', {'company': company.company.id}) }}">{{ company.company.name }} »</a>
{% endif %}
</p>
<p>{{ company.notes | nl2br }}</p>
</td>
<td>
{% for contact in company.contacts %}
<p>
{{ contact.name }}{% if contact.role is not null %}, {{ contact.role }}{% endif %}{% if contact.email is not null %}<br/> {{ contact.email }}{% endif %}{% if contact.phone is not null %}<br/> {{ contact.phone }}{% endif %}
</p>
{% endfor %}
</td>
<td>
<div class="btn-toolbar pull-right">
<div class="btn-group btn-group-sm">
<a href="{{ path('app.sales_journal.print', {'company': company.id}) }}" target="_blank" class="btn btn-default" title="{{ 'ui.print' | trans({}, 'app') }}"><i class="fa fa-print"></i></a>
</div>
<div class="btn-group btn-group-sm">
<a href="{{ path('app.sales_journal.update', {'company': company.id}) }}" class="btn btn-default" title="{{ 'ui.update' | trans }}"><i class="fa fa-pencil"></i></a>
<button class="btn btn-danger delete" data-message="{{ 'ui.delete_confirm' | trans({'%name%': company.name}) }}" data-url="{{ path('app.sales_journal.delete', {'company': company.id}) }}"><i class="fa fa-trash-o"></i></button>
</div>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}
{% block stylesheets %}
<style type="text/css">
#customer-list .item.address td:first-child,
#customer-list .item.customer td:first-child {
padding-left: 20px;
}
</style>
{% endblock %}
{% block javascripts %}
<script type="text/javascript">
$(document).ready(function () {
initList('customer-list');
});
</script>
{% endblock %}