Files
schedule/src/schedule-2.0/templates/Offer/list.html.twig

160 lines
7.6 KiB
Twig
Raw Normal View History

2020-05-11 15:53:07 +02:00
{% extends "base.html.twig" %}
{% block localstyle %}
td {
padding:5px !important;
}
{% if fgprint is defined and fgprint %}
table { font-size:10px;}
th,td {
border: 1px solid #37474F;
}
thead {
display: table-header-group;
}
tr { page-break-inside: avoid; }
{%endif%}
{% endblock %}
{% block body %}
<h1 class="page-header">
COMMANDES {% if app.session.get('viewservice') %}PAR ACTVITE{%else%}PAR DOMAINE{%endif%}
2020-05-11 15:53:07 +02:00
</h1>
<a class="btn btn-success" href={{ path('app_offer_submit') }}>Ajouter</a>
2020-10-14 17:09:26 +02:00
{% if doliactive == "true" %}
2020-10-12 14:49:58 +02:00
<a class="btn btn-success" href={{ path('app_offer_getorders') }}>Récupérer les commandes de Dolibarr</a>
2020-10-14 17:02:41 +02:00
{% endif %}
2020-05-11 15:53:07 +02:00
<div class="custom-control custom-switch float-right">
<input type="checkbox" class="custom-control-input" id="switchactiveproject" {% if app.session.get('activeproject') %} checked {% endif %}>
<label class="custom-control-label" for="switchactiveproject">Projet Actif</label>
</div>
<div class="custom-control custom-switch float-right" style="margin-right:10px">
<input type="checkbox" class="custom-control-input" id="switchactiveoffer" {% if app.session.get('activeoffer') %} checked {% endif %}>
<label class="custom-control-label" for="switchactiveoffer">Proposition Active</label>
</div>
<div class="custom-control custom-switch float-right mr-3">
<input type="checkbox" class="custom-control-input" id="switchservice" {% if app.session.get('viewservice') %} checked {% endif %}>
{% if app.session.get('viewservice') %}
<label class="custom-control-label" for="switchservice">Vue par Activité</label>
{% else %}
<label class="custom-control-label" for="switchservice">Vue par Domaine</label>
{% endif %}
</div>
2020-05-11 15:53:07 +02:00
<p></p>
{% if app.session.get('viewservice') %}
{% set loop01s=services %}
{% else %}
{% set loop01s=domaines %}
{% endif %}
{%for loop01 in loop01s %}
{% if not loop01.projects is empty %}
2020-05-11 15:53:07 +02:00
{% set haveoffer=false %}
{% set haveproject=false %}
{% for project in loop01.projects %}
2020-05-11 15:53:07 +02:00
{% if app.session.get('activeproject')==project.active and (app.session.get('idproject')=="all" or app.session.get('idproject')==project.id) %}
{% for offer in project.offers %}
{% if app.session.get('activeoffer')==offer.active %}
{% set haveoffer=true %}
{% endif %}
{% endfor %}
{% set haveproject=true %}
{% endif %}
{% endfor %}
{% if haveoffer and haveproject %}
<div class="card">
<div class="card-header">
<i class="fa fa-table fa-fw"></i> {{ loop01.name }}
2020-05-11 15:53:07 +02:00
</div>
<div class="card-body">
<div class="dataTable_wrapper">
<table class="table table-striped table-bordered table-hover small" id="dataTables" style="width:100%">
<thead>
<tr>
<th width="70px" class="no-sort no-print">Action</th>
<th width="200px">Client</th>
<th>Projet</th>
<th width="250px">Proposition</th>
<th width="150px">Ref</th>
<th width="100px" class="text-center no-string">Qt</th>
<th width="100px" class="text-center no-string">PU</th>
<th width="100px" class="text-center no-string">Total</th>
</tr>
</thead>
<tbody>
{% for project in loop01.projects %}
2020-05-11 15:53:07 +02:00
{% if app.session.get('activeproject')==project.active and (app.session.get('idproject')=="all" or app.session.get('idproject')==project.id) %}
{% for offer in project.offers %}
{% if app.session.get('activeoffer')==offer.active %}
<tr>
<td class="no-print">
<a href="{{path("app_offer_update",{id:offer.id})}}"><i class="fa fa-file"></i></a>
</td>
<td>{{offer.project.customer.name}}</td>
<td>{{offer.project.name}}</td>
<td>{{offer.name}}</td>
2020-10-13 10:43:09 +02:00
{%if offer.iddolibarr %}
{% if offer.typedolibarr == "commande" %}<td><a href="https://doli.cadoles.com/dolibarr/commande/card.php?id={{offer.iddolibarr}}" target="_blank">{{offer.ref}}</td>{% endif %}
{% if offer.typedolibarr == "propal" %}<td><a href="https://doli.cadoles.com/dolibarr/comm/propal/card.php?id={{offer.iddolibarr}}" target="_blank">{{offer.ref}}</td>{% endif %}
{% endif %}
2020-05-11 15:53:07 +02:00
<td>{{offer.ref}}</td>
<td class="text-right">{{offer.quantity|number_format(2, '.', ' ')}}</td>
<td class="text-right">{{offer.pu|number_format(2, '.', ' ')}}</td>
<td class="text-right">{{offer.total|number_format(2, '.', ' ')}}</td>
</tr>
{% endif %}
{% endfor %}
{%endif%}
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<br>
{% endif %}
{% endif %}
{% endfor %}
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
{% if not fgprint is defined or not fgprint %}
$('.table ').DataTable({
columnDefs: [ { "targets": "no-sort", "orderable": false }, { "targets": "no-string", "type" : "num" } ],
responsive: true,
iDisplayLength: 100,
order: [[ 1, "asc" ]]
});
{%else%}
$('#dataTables').removeClass("table table-striped table-bordered table-hover small dataTable no-footer");
{% endif %}
});
function myprint() {
href=document.location.href;
document.location.href=href+"?fgprint=true";
}
$('#switchactiveproject').change(function() {
window.location="{{ path('app_offer_activeproject' )}}";
});
$('#switchactiveoffer').change(function() {
window.location="{{ path('app_offer_activeoffer' )}}";
});
$('#switchservice').change(function() {
window.location="{{ path('app_offer_viewservice' )}}";
});
2020-05-11 15:53:07 +02:00
{% endblock %}