Projet

Général

Profil

Télécharger (4,41 ko) Statistiques
| Branche: | Tag: | Révision:

calebasse / calebasse / static / js / calebasse.facturation.js @ 2c6641c8

1
function close_dialog(url) {
2
    $('#change-record').load(url,
3
            function () {
4
                function onsuccess(response, status, xhr, form) {
5
                    var parse = $(response);
6
                    if ($('.errorlist', parse).length != 0) {
7
                        $('#change-record').html(response);
8
                        $('#change-record form').ajaxForm({
9
                            success: onsuccess,
10
                        });
11
                    } else {
12
                        window.location.reload(true);
13
                    }
14
                }
15
                $('form', this).ajaxForm({
16
                    success: onsuccess,
17
                    data: { invoicing_id: $(this).data('id'),  service_name: $(this).data('service-name') }
18
                });
19
                $(this).dialog({title: "Clôture",
20
                    width: '500px',
21
                    buttons: [ { text: "Annuler",
22
                        click: function() { $(this).dialog("close"); } },
23
                    { text: "Valider",
24
                        click: function() { $("#change-record form").submit(); } }]});
25
            });
26
}
27

    
28
function rebill_dialog(url, invoice_id) {
29
    $('#rebill').load(url,
30
            function () {
31
                function onsuccess(response, status, xhr, form) {
32
                    var parse = $(response);
33
                    if ($('.errorlist', parse).length != 0) {
34
                        $('#rebill').html(response);
35
                        $('#rebill form').ajaxForm({
36
                            success: onsuccess,
37
                            data: { invoice_id: invoice_id}
38
                        });
39
                    } else {
40
                        window.location.reload(true);
41
                    }
42
                }
43
                $('form', this).ajaxForm({
44
                    success: onsuccess,
45
                    data: { invoice_id: invoice_id}
46
                });
47
                $(this).dialog({title: "Rejeter cette facture",
48
                    width: '500px',
49
                    buttons: [ { text: "Annuler",
50
                        click: function() { $(this).dialog("close"); } },
51
                    { text: "Confirmer",
52
                        click: function() { $("#rebill form").submit(); } }]});
53
            });
54
}
55

    
56

    
57
(function($) {
58
  $(function() {
59
    $('#hide-dossiers-cb').change(function() {
60
      var val = $(this).is(':checked');
61
      if ($(this).is(':checked')) {
62
        $('#dossiers-concernes div.dossier:not(.not_facturable)').hide('fold');
63
      } else {
64
        $('#dossiers-concernes div.dossier').show('fold');
65
      }
66
    });
67
    $("input[name='dossiers_filter']").change(function() {
68
        val = $("input[name='dossiers_filter']:checked").val()
69
        if (val == 'pause') {
70
            $('#dossiers-concernes div.dossier').show();
71
            $('#dossiers-concernes div.dossier:not(.pause)').hide();
72
        } else if (val == 'losts') {
73
            $('#dossiers-concernes div.dossier').show();
74
            $('#dossiers-concernes div.dossier:not(.losts)').hide();
75
        } else if (val == 'acts_paused') {
76
            $('#dossiers-concernes div.dossier').show();
77
            $('#dossiers-concernes div.dossier:not(.acts_paused)').hide();
78
        } else if (val == 'missing_policy') {
79
            $('#dossiers-concernes div.dossier').show();
80
            $('#dossiers-concernes div.dossier:not(.missing_policy)').hide();
81
        } else if (val == 'missing_birthdate') {
82
            $('#dossiers-concernes div.dossier').show();
83
            $('#dossiers-concernes div.dossier:not(.missing_birthdate)').hide();
84
        } else {
85
            $('#dossiers-concernes div.dossier').show();
86
        }
87
    });
88
    $('#close-invoicing').click(function() {
89
        close_dialog('clore');
90
    });
91
    $('#validate-dialog').dialog({
92
        autoOpen: false,
93
        modal: true,
94
        buttons: {
95
          "Valider": function () { $('#validate-dialog form').submit(); },
96
          "Annuler": function () { $(this).dialog("close"); },
97
        },
98
    });
99
    $('#validate').click(function () {
100
        $('#validate-dialog-content').load('validate/',
101
              function () {
102
                $('#validate-dialog').dialog('open');
103
              }
104
            );
105
      });
106
    $('button.blind').next().hide();
107
    $('button.blind').click(function() {
108
            $(this).next().toggle('blind');
109
    });
110
    $('.rebill-btn').click(function() {
111
        rebill_dialog('rebill', $(this).data('id'));
112
    });
113
  });
114
})(window.jQuery)
(8-8/21)