Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
2674 vikas 1
$(function() {
3228 mandeep.dh 2
    $("a.show-order-details").live('click', function() {
3
        var orderId = $(this).attr('orderId');
3499 mandeep.dh 4
        loadOrderInfo("bottom-infopane", orderId);
3228 mandeep.dh 5
    });
3206 mandeep.dh 6
 
3228 mandeep.dh 7
    $("a.show-user-details").live('click', function() {
8
        var userId = $(this).attr('userId');
9
        loadUserPane("infopane", userId);
10
    });
3090 mandeep.dh 11
 
3228 mandeep.dh 12
    $("a.show-orders").live('click', function() {
13
        var userId = $(this).attr('userId');
14
        loadOrderPane("infopane", userId, 0);
15
    });
3090 mandeep.dh 16
 
3228 mandeep.dh 17
    $("a.show-cart").live('click', function() {
18
        var userId = $(this).attr('userId');
19
        var cartId = $(this).attr('cartId');
20
        loadCartPane("infopane", userId, cartId);
21
    });
3090 mandeep.dh 22
 
3228 mandeep.dh 23
    $("a.show-line-details").live('click', function() {
24
        var userId = $(this).attr('userId');
25
        var itemId = $(this).attr('itemId');
26
        loadLineInfo("bottom-infopane", userId, itemId);
27
    });
3090 mandeep.dh 28
 
3228 mandeep.dh 29
    $("a.show-tickets").live('click', function() {
30
        var userId = $(this).attr('userId');
3405 mandeep.dh 31
        loadTickets('infopane', "/crm/tickets!searchTickets?userId=" + userId);
3228 mandeep.dh 32
    });
3090 mandeep.dh 33
 
3228 mandeep.dh 34
    $("a.show-activity").live('click', function() {
35
        var userId = $(this).attr('userId');
3405 mandeep.dh 36
        listActivities('infopane', "userId=" + userId);
3228 mandeep.dh 37
    });
3090 mandeep.dh 38
 
3228 mandeep.dh 39
    $("a.show-ticket-details").live('click', function() {
40
        var ticketId = $(this).attr('ticketId');
3405 mandeep.dh 41
 
3228 mandeep.dh 42
        // will be set when ticket Id link is clicked from activity page
43
        var activityId = $(this).attr('activityId');
44
        loadTicketInfo("bottom-infopane", ticketId, null, activityId);
45
    });
3090 mandeep.dh 46
 
3228 mandeep.dh 47
    $("a.show-activity-details").live('click', function() {
48
        var activityId = $(this).attr('activityId');
3422 mandeep.dh 49
        loadActivityInfo("bottom-infopane", activityId);
3228 mandeep.dh 50
    });
3090 mandeep.dh 51
 
3228 mandeep.dh 52
    $("a.create-ticket").live('click', function() {
3405 mandeep.dh 53
        var userId = $(this).attr('userId');
54
 
55
        var params = null;
56
        if (userId != null && userId != "") {
57
            params = "userId=" + userId;
58
        }
59
 
60
        loadTicketCreationForm("infopane", params);
3228 mandeep.dh 61
    });
3206 mandeep.dh 62
 
3228 mandeep.dh 63
    $("a.create-activity").live('click', function() {
64
        var userId = $(this).attr('userId');
3090 mandeep.dh 65
 
3405 mandeep.dh 66
        var params = null;
67
        if (userId != null && userId != "") {
68
            params = "userId=" + userId;
69
        }
70
 
71
        loadActivityCreationForm("infopane", params);
3339 mandeep.dh 72
    });
73
 
3228 mandeep.dh 74
    $('#update-ticket-form').live('submit', function() {
75
        var ticketId = $(this).attr('ticketId');
76
        updateTicket("infopane", ticketId, $(this).serialize());
77
        return false;
78
    });
3206 mandeep.dh 79
 
3228 mandeep.dh 80
    $('form#mail-form').live(
81
            'submit',
82
            function() {
4163 mandeep.dh 83
            	var body = $('#mail-body').val().trim();
84
            	console.log(body);
85
                if (body == null || body == '') {
86
                	alert('Please specify body of the mail');
87
                }
88
                else {
89
                	var ticketId = $('#update-ticket-form').attr('ticketId');
90
                    updateTicket("infopane", ticketId, $(this).serialize() + '&'
91
                            + $('#update-ticket-form').serialize());
92
                    $.colorbox.close();
93
                }
94
 
3228 mandeep.dh 95
                return false;
96
            });
3106 mandeep.dh 97
 
4020 mandeep.dh 98
    $('form#escalation-form').live(
99
            'submit',
100
            function() {
101
                var ticketId = $('#update-ticket-form').attr('ticketId');
102
                updateTicket("infopane", ticketId, $(this).serialize() + '&'
103
                        + $('#update-ticket-form').serialize());
104
                $.colorbox.close();
105
                return false;
106
            });
107
 
3228 mandeep.dh 108
    $('form#activity-mail-form').live(
109
            'submit',
110
            function() {
111
                createActivity("infopane", $(this).serialize() + '&' + $("#create-activity-form").serialize());
112
                $.colorbox.close();
113
                return false;
114
            });
3106 mandeep.dh 115
 
3405 mandeep.dh 116
    $('#create-activity-form').live('submit', function() {
117
        createActivity("infopane", $(this).serialize());
3339 mandeep.dh 118
        return false;
119
    });
120
 
3228 mandeep.dh 121
    $('#create-ticket-form').live('submit', function() {
122
        createTicket("infopane", $(this).serialize());
123
        return false;
124
    });
3106 mandeep.dh 125
 
3228 mandeep.dh 126
    $(".home-page").click(function() {
127
        goToHomePage();
128
    });
3106 mandeep.dh 129
 
3228 mandeep.dh 130
    $(".my-open-tickets").live('click', function() {
4008 mandeep.dh 131
        loadTickets('infopane', "/crm/tickets!searchTickets?agentIds=" + $(this).attr('agentIds') +"&status=OPEN");
3228 mandeep.dh 132
    });
3151 mandeep.dh 133
 
3228 mandeep.dh 134
    $(".unassigned-tickets").live('click', function() {
3234 mandeep.dh 135
        loadTickets('infopane', "/crm/tickets!getUnassignedTickets");
3151 mandeep.dh 136
    });
137
 
4065 mandeep.dh 138
    $("#spinner-div").ajaxSend(function(evt, request, settings) {
139
        if (settings.url != '/crm') {
140
            $(this).show();
141
        }
3228 mandeep.dh 142
    });
143
 
4065 mandeep.dh 144
    $("#spinner-div").ajaxComplete(function(evt, request, settings) {
145
        if (settings.url != '/crm') {
146
            $(this).hide();
147
        }
3228 mandeep.dh 148
    });
149
 
150
    $("select#activity-type").live('change', function() {
3422 mandeep.dh 151
        processActivityTypeChange($(this).val());
3228 mandeep.dh 152
    });
3397 mandeep.dh 153
 
3339 mandeep.dh 154
    $(".list-my-activity").live('click', function() {
155
        listActivities('infopane', "");
156
    });
157
 
158
    $(".list-customer-activity").live('click', function() {
159
        listActivities('infopane', "creatorId=1");
160
    });
3390 mandeep.dh 161
 
162
    $("#mark-as-read").live('click', function() {
163
        var activityId = $(this).attr('activityId');
164
        markAsRead(activityId);
165
    });
3397 mandeep.dh 166
 
167
    $("form#search").live('submit', function() {
168
        if ($('#searchEntity').val() == 'Tickets') {
169
            loadTickets('infopane', "/crm/tickets!searchTickets?" + $(this).serialize());
170
        }
171
        else {
172
            listActivities('infopane', $(this).serialize());
173
        }
174
 
175
        $.colorbox.close();
176
        return false;
177
    });
178
 
179
    $(".advanced-search").live('click', function() {
180
        loadAdvancedSearchBox();
181
        return false;
182
    });
183
 
184
    $("select#searchEntity").live('change', function() {
185
        var searchEntity = $(this).val();
186
        processSearchEntityChange(searchEntity);
187
    });
3499 mandeep.dh 188
 
189
    $('.pending-cod-verification-tickets').live('click', function() {
3546 mandeep.dh 190
        loadTickets('infopane', "/crm/tickets!searchTickets?category=COD_VERIFICATION&status=OPEN");        
191
        return false;
3499 mandeep.dh 192
    });
3546 mandeep.dh 193
 
3578 mandeep.dh 194
    $('.open-failed-payments-tickets').live('click', function() {
195
        loadTickets('infopane', "/crm/tickets!searchTickets?category=FAILED_PAYMENTS&status=OPEN");        
196
        return false;
197
    });
198
 
4008 mandeep.dh 199
    $('.open-delayed-delivery-tickets').live('click', function() {
200
        loadTickets('infopane', "/crm/tickets!searchTickets?category=DELAYED_DELIVERY&status=OPEN");        
201
        return false;
202
    });
203
 
3499 mandeep.dh 204
    $('.trust-level-increase').live('click', function() {
205
        increaseTrustLevel('infopane', $('input#trust-level-increase').attr('userId'), $('input#trust-level-increase').val());
206
    });
207
 
3546 mandeep.dh 208
    $('.update-order-status').live('click', function() {
209
        updateOrderStatus('bottom-infopane', $(this).attr('ticketId'), $(this).attr('orderId'), $(this).attr('orderStatus'));
3499 mandeep.dh 210
    });
3711 mandeep.dh 211
 
212
    $('.list-my-unread-activity').live('click', function() {
213
        loadUnreadActivities('infopane');
214
    });
4142 mandeep.dh 215
 
216
    $('form.change-address').live('submit', function() {
217
        changeAddress($(this).serialize());
218
    });
2674 vikas 219
});