Subversion Repositories SmartDukaan

Rev

Rev 36761 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 36761 Rev 37498
Line 74... Line 74...
74
 
74
 
75
        $('#defDate').val(fmt(d));
75
        $('#defDate').val(fmt(d));
76
        loadDeferred();
76
        loadDeferred();
77
    })();
77
    })();
78
 
78
 
-
 
79
    // Fragment is re-injected with .html(), which re-runs this script; clear the
-
 
80
    // namespace first so handlers replace rather than stack.
-
 
81
    $(document).off('.beatplandeferred');
79
    $(document).on('click', '#defLoad', function () {
82
    $(document).on('click.beatplandeferred', '#defLoad', function () {
80
        loadDeferred();
83
        loadDeferred();
81
    });
84
    });
82
 
85
 
83
    function loadDeferred() {
86
    function loadDeferred() {
84
        var d = $('#defDate').val();
87
        var d = $('#defDate').val();
Line 139... Line 142...
139
        });
142
        });
140
        $('#defRows').html(html);
143
        $('#defRows').html(html);
141
    }
144
    }
142
 
145
 
143
    // Cancel
146
    // Cancel
144
    $(document).on('click', '.def-cancel', function () {
147
    $(document).on('click.beatplandeferred', '.def-cancel', function () {
145
        var id = $(this).data('id');
148
        var id = $(this).data('id');
146
        if (!confirm('Cancel this deferred visit? It will be dropped (no re-visit).')) return;
149
        if (!confirm('Cancel this deferred visit? It will be dropped (no re-visit).')) return;
147
        $.ajax({
150
        $.ajax({
148
            url: context + '/beatPlan/deferred/action',
151
            url: context + '/beatPlan/deferred/action',
149
            type: 'POST', contentType: 'application/json',
152
            type: 'POST', contentType: 'application/json',
Line 158... Line 161...
158
    });
161
    });
159
 
162
 
160
    // Reschedule → open the beat-plan calendar window scoped to that sales person,
163
    // Reschedule → open the beat-plan calendar window scoped to that sales person,
161
    // in "deferred-assign" mode. The head clicks an upcoming beat there to drop the
164
    // in "deferred-assign" mode. The head clicks an upcoming beat there to drop the
162
    // deferred lead/partner into it. On close, reload (the assigned item drops off).
165
    // deferred lead/partner into it. On close, reload (the assigned item drops off).
163
    $(document).on('click', '.def-reschedule', function () {
166
    $(document).on('click.beatplandeferred', '.def-reschedule', function () {
164
        var id = $(this).data('id');
167
        var id = $(this).data('id');
165
        var userId = $(this).data('userid');
168
        var userId = $(this).data('userid');
166
        var userName = $(this).data('username') || '';
169
        var userName = $(this).data('username') || '';
167
        var type = $(this).data('type') || 'visit';
170
        var type = $(this).data('type') || 'visit';
168
        var name = $(this).data('name') || '';
171
        var name = $(this).data('name') || '';