Project

General

Profile

« Previous | Next » 

Revision f93684a4

Added by Jérôme Schneider over 9 years ago

calebasse.dossiers.js: put a warning if an error occured

Closes #2740

View differences:

calebasse/dossiers/templates/dossiers/patientrecord_tab2_fiche_adm.html
1
<script type="text/javascript">
2
    warning_on_unsave_change();
3
    init_magic_dialog();
4
    $('#prescription-transport-btn').click(function() {
5
        $('#ajax-dlg').load('prescription-transport',
6
          function () {
7
             $(this).dialog({title: 'Prescription de transport', width: '800px',
8
                      buttons: [ { text: "Fermer",
9
                          click: function() { $(this).dialog("close"); } },
10
                      { text: "Prescrire",
11
                          click: function() { $("#ajax-dlg form").submit(); $(this).dialog("close"); } }]});
12
             $('.addresses input[type=radio]').first().click();
13
         });
14
         return false;
15
    });
16
    $('#new-protection-btn').click(function() {
17
        generic_ajaxform_dialog('protection/new', 'Ajouter une mesure de protection',
18
            '#ajax-dlg', '800px', 'Ajouter', null, add_datepickers);
19
    });
20
    $('.update-protection-btn').click(function() {
21
        generic_ajaxform_dialog('protection/' + $(this).data('id') + '/update', 'Modifier une mesure de protection',
22
            '#ajax-dlg', '800px', 'Modifier', null, add_datepickers);
23
    });
24
    $('.del-protection').click(function() {
25
        generic_ajaxform_dialog('protection/' + $(this).data('id') + '/del', 'Supprimer une mesure de protection',
26
            '#ajax-dlg', '500px', 'Supprimer');
27
    });
28
    $('input#id_id-birthdate').datepicker({dateFormat: 'd/m/yy', showOn: 'button' });
29
    calebasse_ajax_form('#tabs-2');
30
</script>
1 31
{% extends 'dossiers/patientrecord_tab.html' %}
2 32
{% load dossiers %}
3 33
{% block content %}
calebasse/static/js/calebasse.dossiers.js
20 20
}
21 21

  
22 22
function filter_date_bounds(tab, selector) {
23
    console.log(tab);
24 23
    var from = $(tab + ' form.filter input[name=from]').datepicker('getDate');
25 24
    var to = $(tab + ' form.filter input[name=to]').datepicker('getDate');
26 25
    if (to) {
......
70 69
    $('button').on("click", function() {
71 70
        form_changed = false;
72 71
    });
72
    var tabid = parseInt($.url($(location).attr('href')).fparam('tab')) + 1;
73
    if ($('.errorlist', '#ui-tabs-' + tabid).length != 0) {
74
      form_changed = true;
75
    }
73 76
}
74 77

  
75 78
function state_dialog(url, state_title, state_type) {
......
158 161
}
159 162

  
160 163
function load_tab2_adm() {
161
    warning_on_unsave_change();
162
    init_magic_dialog();
163
    $('#prescription-transport-btn').click(function() {
164
        $('#ajax-dlg').load('prescription-transport',
165
          function () {
166
             $(this).dialog({title: 'Prescription de transport', width: '800px',
167
                      buttons: [ { text: "Fermer",
168
                          click: function() { $(this).dialog("close"); } },
169
                      { text: "Prescrire",
170
                          click: function() { $("#ajax-dlg form").submit(); $(this).dialog("close"); } }]});
171
             $('.addresses input[type=radio]').first().click();
172
         });
173
         return false;
174
    });
175
    $('#new-protection-btn').click(function() {
176
        generic_ajaxform_dialog('protection/new', 'Ajouter une mesure de protection',
177
            '#ajax-dlg', '800px', 'Ajouter', null, add_datepickers);
178
    });
179
    $('.update-protection-btn').click(function() {
180
        generic_ajaxform_dialog('protection/' + $(this).data('id') + '/update', 'Modifier une mesure de protection',
181
            '#ajax-dlg', '800px', 'Modifier', null, add_datepickers);
182
    });
183
    $('.del-protection').click(function() {
184
        generic_ajaxform_dialog('protection/' + $(this).data('id') + '/del', 'Supprimer une mesure de protection',
185
            '#ajax-dlg', '500px', 'Supprimer');
186
    });
187
    $('input#id_id-birthdate').datepicker({dateFormat: 'd/m/yy', showOn: 'button' });
188
    calebasse_ajax_form('#tabs-2');
189 164
}
190 165

  
191 166
function load_tab3_addresses() {

Also available in: Unified diff