forked from DGNum/gestioCOF
Utilisation de moment.js sur K-Psul
Parce que bon, ça fait un peu plus sérieux
This commit is contained in:
parent
8f76986f89
commit
f7e9cceb70
2 changed files with 13 additions and 20 deletions
|
@ -8,6 +8,9 @@
|
||||||
<script type="text/javascript" src="{% static 'kfet/js/reconnecting-websocket.js' %}"></script>
|
<script type="text/javascript" src="{% static 'kfet/js/reconnecting-websocket.js' %}"></script>
|
||||||
<script type="text/javascript" src="{% static 'kfet/js/jquery-ui.min.js' %}"></script>
|
<script type="text/javascript" src="{% static 'kfet/js/jquery-ui.min.js' %}"></script>
|
||||||
<script type="text/javascript" src="{% static 'kfet/js/jquery-confirm.js' %}"></script>
|
<script type="text/javascript" src="{% static 'kfet/js/jquery-confirm.js' %}"></script>
|
||||||
|
<script type="text/javascript" src="{% static 'moment.js' %}"></script>
|
||||||
|
<script type="text/javascript" src="{% static 'moment-fr.js' %}"></script>
|
||||||
|
<script type="text/javascript" src="{% static 'moment-timezone-with-data-2010-2020.js' %}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block title %}K-Psul{% endblock %}
|
{% block title %}K-Psul{% endblock %}
|
||||||
|
@ -280,14 +283,8 @@ $(document).ready(function() {
|
||||||
var at_formated = '';
|
var at_formated = '';
|
||||||
if (checkout_data['last_statement_at']) {
|
if (checkout_data['last_statement_at']) {
|
||||||
last_statement_container.html(last_statement_html_default);
|
last_statement_container.html(last_statement_html_default);
|
||||||
at = new Date(checkout_data['last_statement_at']);
|
var at = moment.tz(checkout_data['last_statement_at'], 'UTC');
|
||||||
var at_date = at.getDate();
|
at_formated = at.tz('Europe/Paris').format('DD/MM/YY à HH:mm');
|
||||||
var at_month = at.getMonth()+1;
|
|
||||||
var at_year = at.getFullYear();
|
|
||||||
var at_hours = at.getHours();
|
|
||||||
var at_minutes = (at.getMinutes() < 10 ? '0' : '') + at.getMinutes();
|
|
||||||
var at_seconds = (at.getSeconds() < 10 ? '0' : '') + at.getSeconds();
|
|
||||||
at_formated = at_date+'/'+at_month+'/'+at_year+' à '+at_hours+':'+at_minutes;
|
|
||||||
} else {
|
} else {
|
||||||
last_statement_container.html('');
|
last_statement_container.html('');
|
||||||
}
|
}
|
||||||
|
@ -1003,11 +1000,8 @@ $(document).ready(function() {
|
||||||
|
|
||||||
function getOpegroupHtml(opegroup) {
|
function getOpegroupHtml(opegroup) {
|
||||||
var opegroup_html = $(history_operationgroup_html);
|
var opegroup_html = $(history_operationgroup_html);
|
||||||
var at = new Date(opegroup['at']);
|
var at = moment.tz(opegroup['at'], 'UTC');
|
||||||
var at_hours = (at.getHours() < 10 ? '0' : '') + at.getHours();
|
var at_formated = at.tz('Europe/Paris').format('HH:mm:ss');
|
||||||
var at_minutes = (at.getMinutes() < 10 ? '0' : '') + at.getMinutes();
|
|
||||||
var at_seconds = (at.getSeconds() < 10 ? '0' : '') + at.getSeconds();
|
|
||||||
var at_formated = at_hours+':'+at_minutes+':'+at_seconds;
|
|
||||||
var amount = parseFloat(opegroup['amount']);
|
var amount = parseFloat(opegroup['amount']);
|
||||||
var trigramme = opegroup['on_acc__trigramme'];
|
var trigramme = opegroup['on_acc__trigramme'];
|
||||||
if (opegroup['on_acc__trigramme'] == 'LIQ') {
|
if (opegroup['on_acc__trigramme'] == 'LIQ') {
|
||||||
|
@ -1044,17 +1038,16 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var history_day_default_html = '<div class="day"></div>';
|
var history_day_default_html = '<div class="day"></div>';
|
||||||
var months = ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'];
|
|
||||||
|
|
||||||
function checkOrCreateDay(at) {
|
function checkOrCreateDay(at) {
|
||||||
var at = new Date(at);
|
var at = moment.tz(at, 'UTC').tz('Europe/Paris');
|
||||||
var mostRecentDay = history_container.find('.day').first();
|
var mostRecentDay = history_container.find('.day').first();
|
||||||
if (mostRecentDay.length == 0 || at.getMonth() != mostRecentDay.attr('data-month') || at.getDate() != mostRecentDay.attr('data-day')) {
|
if (mostRecentDay.length == 0 || at.month() != mostRecentDay.attr('data-month') || at.date() != mostRecentDay.attr('data-day')) {
|
||||||
var day_html = $(history_day_default_html);
|
var day_html = $(history_day_default_html);
|
||||||
day_html
|
day_html
|
||||||
.attr('data-month', at.getMonth())
|
.attr('data-month', at.month())
|
||||||
.attr('data-day', at.getDate())
|
.attr('data-day', at.date())
|
||||||
.text(at.getDate()+' '+months[at.getMonth()]);
|
.text(at.format('D MMMM'));
|
||||||
history_container.prepend(day_html);
|
history_container.prepend(day_html);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -984,7 +984,7 @@ def kpsul_history(request):
|
||||||
'id', 'amount', 'at', 'checkout_id', 'is_cof',
|
'id', 'amount', 'at', 'checkout_id', 'is_cof',
|
||||||
'valid_by__trigramme', 'on_acc__trigramme')
|
'valid_by__trigramme', 'on_acc__trigramme')
|
||||||
.select_related('valid_by', 'on_acc')
|
.select_related('valid_by', 'on_acc')
|
||||||
.filter(at__gt=timezone.now()-timedelta(hours=4)))
|
.filter(at__gt=timezone.now()-timedelta(hours=24)))
|
||||||
opegroups = { opegroup['id']:opegroup for opegroup in opegroups_list }
|
opegroups = { opegroup['id']:opegroup for opegroup in opegroups_list }
|
||||||
for opegroup in opegroups:
|
for opegroup in opegroups:
|
||||||
opegroups[opegroup]['opes'] = []
|
opegroups[opegroup]['opes'] = []
|
||||||
|
|
Loading…
Reference in a new issue