Subversion Repositories SmartDukaan

Rev

Rev 36040 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 36040 Rev 37498
Line 1... Line 1...
1
<script>
1
<script>
-
 
2
    // Fragment is re-injected with .html(), which re-runs this script; clear the
-
 
3
    // namespace first so handlers replace rather than stack. Must sit OUTSIDE
-
 
4
    // ready() - that callback fires async, after the top-level binds below.
-
 
5
    $(document).off('.ticket');
2
    $(document).ready(function () {
6
    $(document).ready(function () {
3
        // Cleanup for myModal (activity/message modal)
7
        // Cleanup for myModal (activity/message modal)
4
        $('#myModal').on('hidden.bs.modal', function (e) {
8
        $('#myModal').on('hidden.bs.modal', function (e) {
5
            $(".activity-container .modal-body").empty();
9
            $(".activity-container .modal-body").empty();
6
        });
10
        });
Line 11... Line 15...
11
            $('body').removeClass('modal-open');
15
            $('body').removeClass('modal-open');
12
            $('.modal-backdrop').remove();
16
            $('.modal-backdrop').remove();
13
        });
17
        });
14
 
18
 
15
        // Ensure backdrop is removed on any modal close
19
        // Ensure backdrop is removed on any modal close
16
        $(document).on('hidden.bs.modal', '.modal', function () {
20
        $(document).on('hidden.bs.modal.ticket', '.modal', function () {
17
            if ($('.modal:visible').length === 0) {
21
            if ($('.modal:visible').length === 0) {
18
                $('body').removeClass('modal-open');
22
                $('body').removeClass('modal-open');
19
                $('.modal-backdrop').remove();
23
                $('.modal-backdrop').remove();
20
            }
24
            }
21
        });
25
        });
Line 92... Line 96...
92
            resultCount.text('Showing ' + visibleCount + ' of ' + totalCount + ' rows');
96
            resultCount.text('Showing ' + visibleCount + ' of ' + totalCount + ' rows');
93
        }
97
        }
94
    }
98
    }
95
 
99
 
96
    // Re-apply filter when new content is loaded via AJAX (pagination, etc.)
100
    // Re-apply filter when new content is loaded via AJAX (pagination, etc.)
97
    jQuery(document).on('ajaxComplete', function (event, xhr, settings) {
101
    jQuery(document).on('ajaxComplete.ticket', function (event, xhr, settings) {
98
        // Check if this is a ticket-related AJAX call
102
        // Check if this is a ticket-related AJAX call
99
        if (settings.url && settings.url.indexOf('ticket') > -1) {
103
        if (settings.url && settings.url.indexOf('ticket') > -1) {
100
            var searchText = jQuery('#table-quick-filter').val();
104
            var searchText = jQuery('#table-quick-filter').val();
101
            if (searchText) {
105
            if (searchText) {
102
                // Small delay to ensure DOM is updated
106
                // Small delay to ensure DOM is updated
Line 106... Line 110...
106
            }
110
            }
107
        }
111
        }
108
    });
112
    });
109
 
113
 
110
    // Clear filter when status or order dropdowns change (these change the dataset)
114
    // Clear filter when status or order dropdowns change (these change the dataset)
111
    jQuery(document).on('change', '#ticketStatus, #orderBy', function () {
115
    jQuery(document).on('change.ticket', '#ticketStatus, #orderBy', function () {
112
        clearQuickFilter();
116
        clearQuickFilter();
113
    });
117
    });
114
 
118
 
115
    function clearQuickFilter() {
119
    function clearQuickFilter() {
116
        jQuery('#table-quick-filter').val('');
120
        jQuery('#table-quick-filter').val('');