On utilise le render par défaut

This commit is contained in:
Ludovic Stephan 2020-09-15 20:04:35 +02:00
parent 49591fa67e
commit a6e58dcd68

View file

@ -1,5 +1,5 @@
{% extends 'kfet/base_col_2.html' %} {% extends 'kfet/base_col_2.html' %}
{% load l10n staticfiles widget_tweaks %} {% load l10n staticfiles widget_tweaks bootstrap %}
{% block extra_head %} {% block extra_head %}
<link rel="stylesheet" type="text/css" href="{% static 'kfet/vendor/multiple-select/multiple-select.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'kfet/vendor/multiple-select/multiple-select.css' %}">
@ -20,13 +20,8 @@
<span id="nb_opes"></span> <span id="nb_opes"></span>
<span class="sub">opérations</span> <span class="sub">opérations</span>
</div> </div>
<div class="text"> <div class="text" id="history-form">
<ul class="list-unstyled"> {{ filter_form|bootstrap}}
<li style="position: relative;"><b>De</b> {{ filter_form.from_date|add_class:"form-control" }}</li>
<li style="position: relative;"><b>à</b> {{ filter_form.to_date|add_class:"form-control" }}</li>
<li><b>Caisses</b> {{ filter_form.checkouts }}</li>
<li><b>Comptes</b> {{ filter_form.accounts }}</li>
</ul>
</div> </div>
<div class="buttons"> <div class="buttons">
<button class="btn btn-primary" id="btn-fetch">Valider</button> <button class="btn btn-primary" id="btn-fetch">Valider</button>
@ -48,30 +43,13 @@ $(document).ready(function() {
khistory = new KHistory(); khistory = new KHistory();
var $from_date = $('#id_from_date'); var $from_date = $('#id_start');
var $to_date = $('#id_to_date'); var $to_date = $('#id_end');
var $checkouts = $('#id_checkouts'); var $checkout = $('#id_checkout');
var $accounts = $('#id_accounts'); var $account = $('#id_account');
function getSelectedMultiple($el) {
var selected = [];
$el.find(':selected').each(function() {
selected.push($(this).val())
});
return selected;
}
function getHistory() { function getHistory() {
var data = {}; data = $("#history-form").find("input, select, textarea").serialize();
if ($from_date.val())
data['from'] = moment($from_date.val()).format('YYYY-MM-DD HH:mm:ss');
if ($to_date.val())
data['to'] = moment($to_date.val()).format('YYYY-MM-DD HH:mm:ss');
var checkouts = getSelectedMultiple($checkouts);
if ($checkouts)
data['checkouts'] = checkouts;
var accounts = getSelectedMultiple($accounts);
data['accounts'] = accounts;
khistory.fetch(data).done(function () { khistory.fetch(data).done(function () {
var nb_opes = khistory.$container.find('.entry:not(.canceled)').length; var nb_opes = khistory.$container.find('.entry:not(.canceled)').length;
@ -101,14 +79,6 @@ $(document).ready(function() {
$('#from_date').data("DateTimePicker").maxDate(e.date); $('#from_date').data("DateTimePicker").maxDate(e.date);
}); });
$("select").multipleSelect({
width: '100%',
filter: true,
allSelected: " ",
selectAllText: "Tout-te-s",
countSelected: "# sur %"
});
$("#btn-fetch").on('click', function() { $("#btn-fetch").on('click', function() {
khistory.reset(); khistory.reset();
getHistory(); getHistory();