Générer les dossiers par email un à un et non en lot

This commit is contained in:
2020-12-10 20:39:51 +01:00
parent 7840087bb0
commit 908e15a80f
4 changed files with 268 additions and 324 deletions

View File

@@ -39,7 +39,7 @@
<span class="glyphicon glyphicon-download-alt logo-warning"></span>
<h4>EMAILS <span class="glyphicon glyphicon-arrow-right"></span> DOSSIERS</h4></a>
</div>
<div class="col-sm-3">
<div class="col-sm-3" tal:condition="logged_in=='CAO'">
<a href="${request.application_url}/upload_om" tal:condition="access > 0">
<span class="glyphicon glyphicon-download-alt logo-warning"></span>
<h4>PDF <span class="glyphicon glyphicon-arrow-right"></span> DOSSIERS</h4></a>

View File

@@ -1,94 +1,50 @@
<metal:block use-macro="main_template">
<div metal:fill-slot="content">
<div tal:condition="message" tal:content="message" class="alert alert-success" />
<div class="row">
<table id="demandes" class="table table-striped table-bordered">
<thead>
<tr>
<th>Société</th>
<th>Date</th>
<th>Expéditeur</th>
<th>Objet</th>
</tr>
</thead>
</table>
</div>
<div class="row">
<form id="demandes_form" action="${url}" class="form-horizontal" method="post"
data-fv-framework="bootstrap"
data-fv-icon-valid="glyphicon glyphicon-ok"
data-fv-icon-invalid="glyphicon glyphicon-remove"
data-fv-icon-validating="glyphicon glyphicon-refresh">
<div class="form-group">
<div class="col-sm-offset-4 col-sm-8">
<a href="${request.application_url}/" class="btn btn-default btn-lg" role="button">
<span class="glyphicon glyphicon-chevron-left"></span> Retour</a>
<button id="generateButton" class="btn btn-success btn-lg" type="submit" name="form.submitted" tal:condition="msglus">
<i class="glyphicon glyphicon-refresh"></i>&nbsp;Générer les dossiers</button>
</div>
</div>
</form>
</div>
<div class="row">
<h2>Rapport de génération</h2>
<table class="table table-condensed">
<tr tal:repeat="item log_creation">
<td>${item.date.strftime('%d %b, %H:%M')}</td>
<td>${item.proc}</td>
<td>${item.msg}</td>
<td><a href="${request.application_url}/dossier_view/${item.nodossier}">${item.nodossier}</td>
<td>${item.user}</td>
</tr>
</table>
<h2>Dossiers générés à contrôler</h2>
<table class="table table-condensed">
<tr tal:repeat="item dossiers_traites">
<td>${item.DATEMAJ.strftime('%d %b')}</td>
<td><a href="${request.application_url}/dossier_view/${item.societe}-${item.NO_ID}">${item.societe}-${item.NO_ID}</td>
<td>${item.NOMCLI}</td>
<td>${item.C_NOM}</td>
<td>${item.USERMAJ}</td>
</tr>
</table>
</div>
<br />
<p>
<a href="${request.application_url}/" class="btn btn-default btn" role="button">
<span class="glyphicon glyphicon-chevron-left"></span> Retour</a>
</p>
<table class="table table-bordered">
<thead>
<tr>
<th class="text-center">Soc</th>
<th>Date</th>
<th>Expéditeur</th>
<th>Objet</th>
<th></th>
</tr>
</thead>
<tr tal:repeat="item emails">
<td tal:condition="item.email_societe=='PE'" class="bg-warning text-center">${item.email_societe}</td>
<td tal:condition="item.email_societe=='ME'" class="bg-danger text-center">${item.email_societe}</td>
<td tal:condition="item.email_societe=='PL'" class="bg-success text-center">${item.email_societe}</td>
<td>${item.email_date.strftime('%d %b, %H:%M')}</td>
<td>${item.email_from}</td>
<td>${item.email_subject}</td>
<td class="text-center">
<a href="${request.application_url}/demandes_dl/${item.email_societe}/${item.email_from}/${item.email_uid}">
<i class="glyphicon glyphicon-arrow-down"></i></a>
</td>
</tr>
</table>
<br />
<h2>Dossiers générés à contrôler</h2>
<table class="table table-condensed">
<tr tal:repeat="item dossiers_traites">
<td>${item.DATEMAJ.strftime('%d %b')}</td>
<td><a href="${request.application_url}/dossier_view/${item.societe}-${item.NO_ID}">${item.societe}-${item.NO_ID}</td>
<td>${item.NOMCLI}</td>
<td>${item.C_NOM}</td>
<td>${item.USERMAJ}</td>
</tr>
</table>
<br />
<br />
<script type="text/javascript">
var dataSet = ${dt_data};
$(document).ready(function() {
$.fn.dataTable.moment('DD-MM-YYYY MH:mm:ss');
$('#demandes').DataTable({
data: dataSet,
pageLength: 50,
bLengthChange: false,
searching: false,
language: {
url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/French.json'
},
columnDefs: [
{ className: "text-center", "targets": [0] },
],
createdRow: function( row, data, dataIndex ) {
if ( data[0] == "ME" ) {
$('td', row).eq(0).css('background-color', 'Gold');
} else if ( data[0] == "PE" ) {
$('td', row).eq(0).css('background-color', 'LightYellow');
} else if ( data[0] == "PL" ) {
$('td', row).eq(0).css('background-color', 'LightGreen');
}
},
});
});
</script>
<script type="text/javascript">
$('#generateButton').on('click', function(){
$('i.gly-spin').removeClass('gly-spin');