Subversion Repositories SmartDukaan

Rev

Rev 36806 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
36645 vikas 1
$(document).on('click', ".beat-report", function () {
2
    doGetAjaxRequestHandler(context + "/beat-report",
3
        function (response) {
4
            $('#main-content').html(response);
5
        });
6
});
7
 
36814 ranu 8
$(document).on('click', ".company-office-list", function () {
9
    doGetAjaxRequestHandler(context + "/company-office-list",
10
        function (response) {
11
            $('#main-content').html(response);
12
        });
13
});
14
 
36645 vikas 15
$(document).on('click', '.beat-report-fetch', function () {
16
    var selectedDate = $("#beat-report-date").val();
17
    if (!selectedDate) {
18
        alert("Please select a date!");
19
        return;
20
    }
36806 ranu 21
    var categoryId = $('#beat-report-category').val();
22
    var level = $('#beat-report-level').val();
23
    var url = context + "/beat-report/data?date=" + encodeURIComponent(selectedDate);
24
    if (categoryId) url += '&categoryId=' + encodeURIComponent(categoryId);
25
    if (level) url += '&escalationType=' + encodeURIComponent(level);
26
    doGetAjaxRequestHandler(url,
36645 vikas 27
        function (response) {
28
            $('.beat-report-container').html(response);
29
        });
30
});
31
 
32
$(document).on('click', '.user-detail-refresh', function () {
36664 vikas 33
    var userId = $('#user-detail-user').val() || $(this).data('userid');
36645 vikas 34
    var selectedDate = $("#user-detail-date").val();
35
    if (!selectedDate) {
36
        alert("Please select a date!");
37
        return;
38
    }
39
    doGetAjaxRequestHandler(context + "/beat-report/user-detail?userId=" + userId + "&date=" + selectedDate,
40
        function (response) {
41
            $('#main-content').html(response);
42
        });
43
});
44
 
36664 vikas 45
$(document).on('change', '#user-detail-level', function () {
46
    var level = $(this).val();
47
    var userSelect = $('#user-detail-user');
48
    userSelect.html('<option value="">Select User</option>');
49
    if (!level) return;
50
 
51
    $.ajax({
52
        url: context + "/beatPlan/getAuthUsers", type: "GET", dataType: "json",
53
        data: { categoryId: 4, escalationType: level },
54
        success: function (r) {
55
            var data = r.response || r;
56
            var html = '<option value="">Select User</option>';
57
            data.forEach(function (u) {
58
                html += '<option value="' + u.id + '">' + u.name + '</option>';
59
            });
60
            userSelect.html(html);
61
        }
62
    });
63
});
64
 
65
$(document).on('change', '#user-detail-user', function () {
66
    var authUserId = $(this).val();
67
    if (!authUserId) return;
68
    var selectedDate = $("#user-detail-date").val();
69
    if (!selectedDate) {
70
        selectedDate = new Date().toISOString().split('T')[0];
71
    }
72
    doGetAjaxRequestHandler(context + "/beat-report/user-detail?authUserId=" + authUserId + "&date=" + selectedDate,
73
        function (response) {
74
            $('#main-content').html(response);
75
        });
76
});
77
 
36645 vikas 78
$(document).on('click', '.beat-user-detail-link', function () {
79
    var userId = $(this).data('userid');
80
    var selectedDate = $("#beat-report-date").val();
81
    if (!selectedDate) {
82
        selectedDate = new Date().toISOString().split('T')[0];
83
    }
84
    doGetAjaxRequestHandler(context + "/beat-report/user-detail?userId=" + userId + "&date=" + selectedDate,
85
        function (response) {
86
            $('#main-content').html(response);
87
        });
88
});