added tarifs_import with xlrd

This commit is contained in:
2021-05-31 19:12:26 +02:00
parent 39b2c03de9
commit 83860d3c21
13 changed files with 522 additions and 20 deletions

View File

@@ -12,12 +12,12 @@
<h4>ARTICLES</h4>
</div>
<div class="col-sm-3">
<a href="${request.application_url}/cabinets"><span class="glyphicon glyphicon-list logo-primary"></span></a>
<h4>CABINETS EXP.</h4>
<a href="${request.application_url}/tarifs"><span class="glyphicon glyphicon-list-alt logo-primary"></span></a>
<h4>TARIFS</h4>
</div>
<div class="col-sm-3">
<a href="${request.application_url}/text_list"><span class="glyphicon glyphicon-list logo-primary"></span></a>
<h4>TEXTES EMAIL</h4>
<a href="${request.application_url}/cabinets"><span class="glyphicon glyphicon-list logo-primary"></span></a>
<h4>CABINETS EXP.</h4>
</div>
</div>
<br />
@@ -30,6 +30,10 @@
<a href="${request.application_url}/rdf_causes"><span class="glyphicon glyphicon-list logo-primary"></span></a>
<h4>RDF : CAUSES</h4>
</div>
<div class="col-sm-3">
<a href="${request.application_url}/text_list"><span class="glyphicon glyphicon-list logo-primary"></span></a>
<h4>TEXTES EMAIL</h4>
</div>
</div>
<br />
<div class="row text-center">

View File

@@ -0,0 +1,166 @@
<metal:block use-macro="main_template">
<div metal:fill-slot="content">
<div tal:condition="message" tal:content="message" class="alert alert-danger" />
<br />
<form id="user_edit-form" class="form-horizontal" action="${url}" method="post" tal:condition="item"
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 id="tarif" class="tab-pane fade in active">
<br />
<div class="form-group">
<label class="control-label col-xs-2" for="REF">Référence</label>
<div class="col-xs-6">
<input class="form-control" type="text" id="REF" name="REF" value="${item.REF}"
placeholder="10 caractères maximum"
data-fv-notempty="true"
data-fv-notempty-message="La référence est obligatoire"
data-fv-stringlength="true"
data-fv-stringlength-max="10"
data-fv-stringlength-message="10 caractères maximum" />
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2">Famille</label>
<div class="col-xs-6">
<select class="form-control" id="FAM" name="FAM">
<tal:block tal:repeat="famille familles">
<option value="${famille}" tal:attributes="selected famille[0]==item.FAM and 'selected' or None">${famille}</option>
</tal:block>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2" for="LIBART">Libellé</label>
<div class="col-xs-6">
<input class="form-control" type="text" id="LIBART" name="LIBART" value="${item.LIBART}"
placeholder="45 caractères maximum"
data-fv-notempty="true"
data-fv-notempty-message="Le libellé est obligatoire"
data-fv-stringlength="true"
data-fv-stringlength-max="45"
data-fv-stringlength-message="45 caractères maximum" />
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2" for="LIBCOMPL1">Libellé compl. 1</label>
<div class="col-xs-6">
<input class="form-control" type="text" id="LIBCOMPL1" name="LIBCOMPL1" value="${item.LIBCOMPL1}"
placeholder="45 caractères maximum"
data-fv-stringlength="true"
data-fv-stringlength-max="45"
data-fv-stringlength-message="45 caractères maximum" />
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2" for="LIBCOMPL2">Libellé compl. 2</label>
<div class="col-xs-6">
<input class="form-control" type="text" id="LIBCOMPL2" name="LIBCOMPL2" value="${item.LIBCOMPL2}"
placeholder="45 caractères maximum"
data-fv-stringlength="true"
data-fv-stringlength-max="45"
data-fv-stringlength-message="45 caractères maximum" />
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2" for="LIBCOMPL3">Libellé compl. 3</label>
<div class="col-xs-6">
<input class="form-control" type="text" id="LIBCOMPL3" name="LIBCOMPL3" value="${item.LIBCOMPL3}"
placeholder="45 caractères maximum"
data-fv-stringlength="true"
data-fv-stringlength-max="45"
data-fv-stringlength-message="45 caractères maximum" />
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2" for="LIBCOMPL4">Libellé compl. 4</label>
<div class="col-xs-6">
<input class="form-control" type="text" id="LIBCOMPL4" name="LIBCOMPL4" value="${item.LIBCOMPL4}"
placeholder="45 caractères maximum"
data-fv-stringlength="true"
data-fv-stringlength-max="45"
data-fv-stringlength-message="45 caractères maximum" />
</div>
</div>
<div class="form-group">
<label class="col-xs-2 control-label">Prix HT 1</label>
<div class="col-xs-6">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-euro"></i></span>
<input class="form-control" type="text" id="PRIXHT1" name="PRIXHT1" value="${item.PRIXHT1}"
data-fv-numeric="true"
data-fv-numeric-message="Le montant est invalide" />
</div>
</div>
</div>
<div class="form-group">
<label class="col-xs-2 control-label">Prix HT 2</label>
<div class="col-xs-6">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-euro"></i></span>
<input class="form-control" type="text" id="PRIXHT2" name="PRIXHT2" value="${item.PRIXHT2}"
data-fv-numeric="true"
data-fv-numeric-message="Le montant est invalide" />
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2" for="ref_cli1">Réf. client 1</label>
<div class="col-xs-6">
<input class="form-control" type="text" id="ref_cli1" name="ref_cli1" value="${item.ref_cli1}"
placeholder="20 caractères maximum"
data-fv-stringlength="true"
data-fv-stringlength-max="20"
data-fv-stringlength-message="20 caractères maximum" />
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2" for="ref_cli2">Réf. client 2</label>
<div class="col-xs-6">
<input class="form-control" type="text" id="ref_cli2" name="ref_cli2" value="${item.ref_cli2}"
placeholder="20 caractères maximum"
data-fv-stringlength="true"
data-fv-stringlength-max="20"
data-fv-stringlength-message="20 caractères maximum" />
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2" for="access">Dernière modif.</label>
<div class="col-xs-7">
<p class="form-control-static" tal:condition="item.REF != '0'">${item.modif_le.strftime('%d/%m/%Y - %H:%M')}</p>
</div>
</div>
<br />
<div class="form-group">
<div class="col-xs-offset-2 col-xs-10">
<div class="form-group">
<a class="btn btn-default" href="${request.application_url}/articles">
<span class="glyphicon glyphicon-chevron-left"></span> Annuler</a>
<button class="btn btn-primary" type="submit" name="form.submitted">
<span class="glyphicon glyphicon-ok"></span> Enregistrer</button>
<button class="btn btn-warning" type="submit" name="form.deleted"
tal:condition="item.REF != '0'">
<span class="glyphicon glyphicon-remove"></span> Supprimer</button>
</div>
</div>
</div>
</form>
<br />
<br />
<script>
$(document).ready(function() {
$('#user_edit-form').formValidation();
$('form input').on('keypress', function(e) {
return e.which !== 13;
});
});
</script>
</div>
</metal:block>

View File

@@ -0,0 +1,72 @@
<metal:block use-macro="main_template">
<div metal:fill-slot="content">
<form method="POST" id="frm" class="form-horizontal">
<div class="form-group">
<label class="control-label col-md-1">Famille : </label>
<div class="col-md-3">
<select class="form-control" id="famille" name="famille" onChange="$('#frm').submit()">
<tal:block tal:repeat="item familles">
<option value="${item}" tal:attributes="selected famille==item and 'selected' or None">${item}</option>
</tal:block>
</select>
</div>
</div>
</form>
<p>
<a href="${request.application_url}/parametres" class="btn btn-default" role="button">
<span class="glyphicon glyphicon-chevron-left"></span> Retour</a>
<a href="${request.application_url}/article_edit/0" class="btn btn-success" role="button">
<span class="glyphicon glyphicon-plus"></span> Nouvel tarif</a>
<a href="${request.application_url}/tarifs_import" class="btn btn-primary" role="button">
<span class="glyphicon glyphicon-import"></span> Import tarifs</a>
</p>
<table id="articles_list" class="table table-condensed table-striped table-bordered">
<thead>
<tr>
<th>Référence</th>
<th>Libellé</th>
<th>Libellé 2</th>
<th class="text-right">Prix HT 1</th>
<th class="text-right">Prix HT 2</th>
<th>Réf. client 1</th>
<th>Réf. client 2</th>
</tr>
</thead>
</table>
<br />
<br />
<script type="text/javascript">
var dataSet = ${dt_data};
$(document).ready(function() {
$.fn.dataTable.moment('DD-MM-YYYY HH:mm');
$('#articles_list').DataTable({
data: dataSet,
pageLength: 100,
bLengthChange: false,
searching: false,
language: {
url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/French.json'
},
columnDefs: [
{ className: "text-right", "targets": [3,4] },
{ targets: 0,
render: function (data, type, full, meta) {
// ajouter un link vers le formulaire
return '<a href="/article_edit/' + data + '">' + data + '</a>';
},
},
]
});
});
</script>
</div><!-- content -->
</metal:block>

View File

@@ -0,0 +1,45 @@
<metal:block use-macro="main_template">
<div metal:fill-slot="content">
<div class="alert alert-danger" tal:condition="message" tal:content="message" />
<br />
<form id="upload_doc-form" action="${url}" method="post" accept-charset="utf-8" enctype="multipart/form-data"
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">
<label class="control-label">Groupe :</label>
<select class="form-control" id="groupe" name="groupe">
<tal:block tal:repeat="item groupes">
<option value="${item}" tal:attributes="selected groupe==item and 'selected' or None"> ${item}</option>
</tal:block>
</select>
</div>
<div class="form-group">
<label class="control-label" for="uploadfile">Veuillez séléctionner un fichier :</label>
<input id="uploadfile" name="filename" type="file" accept=".xls,.xlsx" value="" required />
</div>
<br />
<div class="form-group">
<a class="btn btn-default" href="/">
<span class="glyphicon glyphicon-arrow-left"></span> Retour</a>
<button id="uploadButton" class="btn btn-primary" type="submit" name="form.submitted">
<i class="glyphicon glyphicon-refresh"></i> Importer</button>
</div>
</form>
<br />
<br />
<br />
<script type="text/javascript">
$('#uploadButton').on('click', function(){
$('i.gly-spin').removeClass('gly-spin');
$('i').addClass('gly-spin');
});
</script>
</div>
</metal:block>