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' %}
{% load l10n staticfiles widget_tweaks %}
{% load l10n staticfiles widget_tweaks bootstrap %}
{% block extra_head %}
<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 class="sub">opérations</span>
</div>
<div class="text">
<ul class="list-unstyled">
<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 class="text" id="history-form">
{{ filter_form|bootstrap}}
</div>
<div class="buttons">
<button class="btn btn-primary" id="btn-fetch">Valider</button>
@ -48,30 +43,13 @@ $(document).ready(function() {
khistory = new KHistory();
var $from_date = $('#id_from_date');
var $to_date = $('#id_to_date');
var $checkouts = $('#id_checkouts');
var $accounts = $('#id_accounts');
function getSelectedMultiple($el) {
var selected = [];
$el.find(':selected').each(function() {
selected.push($(this).val())
});
return selected;
}
var $from_date = $('#id_start');
var $to_date = $('#id_end');
var $checkout = $('#id_checkout');
var $account = $('#id_account');
function getHistory() {
var data = {};
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;
data = $("#history-form").find("input, select, textarea").serialize();
khistory.fetch(data).done(function () {
var nb_opes = khistory.$container.find('.entry:not(.canceled)').length;
@ -101,14 +79,6 @@ $(document).ready(function() {
$('#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() {
khistory.reset();
getHistory();