Projet

Général

Profil

0002-dossiers-remove-block-not-matching-date-filter-crite.patch

Serghei Mihai, 21 août 2014 17:58

Télécharger (3,37 ko)

Voir les différences:

Subject: [PATCH 2/2] dossiers: remove block not matching date filter criteria
 while printing page

Closes #3109
 .../dossiers/patientrecord_tab5_actes_passes.html  |  2 +-
 .../dossiers/patientrecord_tab6_next_rdv.html      |  2 +-
 calebasse/static/js/calebasse.dossiers.js          | 25 ++++++++++++++--------
 3 files changed, 18 insertions(+), 11 deletions(-)
calebasse/dossiers/templates/dossiers/patientrecord_tab5_actes_passes.html
43 43
  {% endfor %}
44 44
</div>
45 45
{% endblock %}
46
{% block print-actions %}filter_date_bounds('#ui-tabs-5', '.frame td span.date');{% endblock %}
46
{% block print-actions %}filter_date_bounds('#ui-tabs-5', '.frame', 'td span.date');{% endblock %}
calebasse/dossiers/templates/dossiers/patientrecord_tab6_next_rdv.html
47 47
  </table>
48 48
</div>
49 49
{% endblock %}
50
{% block print-actions %}filter_date_bounds('#ui-tabs-6', '.basic td span.date');{% endblock %}
50
{% block print-actions %}filter_date_bounds('#ui-tabs-6', '.basic', 'td span.date');{% endblock %}
calebasse/static/js/calebasse.dossiers.js
19 19
    });
20 20
}
21 21

  
22
function filter_date_bounds(tab, selector) {
22
function filter_date_bounds(tab, container, selector) {
23 23
    var from = $(tab + ' form.filter input[name=from]').datepicker('getDate');
24 24
    var to = $(tab + ' form.filter input[name=to]').datepicker('getDate');
25 25
    if (to) {
26 26
        to.setHours(23); to.setMinutes(59); to.setSeconds(59);
27 27
    }
28
    $.each($(tab + ' ' + selector), function(){
29
        var current = $.datepicker.parseDate('d/m/yy', $(this).text());
30
        if (current < from || (to && current >= to)) {
31
            $(this).parent().parent().addClass('screen-only');
32
        } else {
33
            $(this).parent().parent().removeClass('screen-only');
28
    $.each($(tab + ' ' + container), function(element) {
29
        var block = $(this);
30
        block.addClass('screen-only');
31
        if ($(selector, $(this)).length) {
32
            $.each($(selector, this), function() {
33
                var current = $.datepicker.parseDate('d/m/yy', $(this).text());
34
                if (current < from || (to && current >= to)) {
35
                    $(this).parent().parent().addClass('screen-only');
36
                } else {
37
                    block.removeClass('screen-only');
38
                    $(this).parent().parent().removeClass('screen-only');
39
                }
40
            });
34 41
        }
35
    });
36
}
42
    })
43
};
37 44

  
38 45
function load_add_address_dialog() {
39 46
  var str = $("#contactform").serialize();
40
-