Subversion Repositories SmartDukaan

Rev

Rev 4241 | Rev 4438 | 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
    });
4241 anupam.sin 46
 
47
    $("a.show-activity-description").live('click', function() {
48
    	loadActivityDescription("activity-description-pane", this);
49
    });
3090 mandeep.dh 50
 
3228 mandeep.dh 51
    $("a.show-activity-details").live('click', function() {
52
        var activityId = $(this).attr('activityId');
3422 mandeep.dh 53
        loadActivityInfo("bottom-infopane", activityId);
3228 mandeep.dh 54
    });
4241 anupam.sin 55
 
3228 mandeep.dh 56
    $("a.create-ticket").live('click', function() {
3405 mandeep.dh 57
        var userId = $(this).attr('userId');
58
 
59
        var params = null;
60
        if (userId != null && userId != "") {
61
            params = "userId=" + userId;
62
        }
63
 
64
        loadTicketCreationForm("infopane", params);
3228 mandeep.dh 65
    });
3206 mandeep.dh 66
 
3228 mandeep.dh 67
    $("a.create-activity").live('click', function() {
68
        var userId = $(this).attr('userId');
3090 mandeep.dh 69
 
3405 mandeep.dh 70
        var params = null;
71
        if (userId != null && userId != "") {
72
            params = "userId=" + userId;
73
        }
74
 
75
        loadActivityCreationForm("infopane", params);
3339 mandeep.dh 76
    });
77
 
3228 mandeep.dh 78
    $('#update-ticket-form').live('submit', function() {
79
        var ticketId = $(this).attr('ticketId');
80
        updateTicket("infopane", ticketId, $(this).serialize());
81
        return false;
82
    });
3206 mandeep.dh 83
 
3228 mandeep.dh 84
    $('form#mail-form').live(
85
            'submit',
86
            function() {
4163 mandeep.dh 87
            	var body = $('#mail-body').val().trim();
88
                if (body == null || body == '') {
89
                	alert('Please specify body of the mail');
90
                }
91
                else {
4164 mandeep.dh 92
                    var ticketId = $('#update-ticket-form').attr('ticketId');
4163 mandeep.dh 93
                    updateTicket("infopane", ticketId, $(this).serialize() + '&'
94
                            + $('#update-ticket-form').serialize());
95
                    $.colorbox.close();
96
                }
97
 
3228 mandeep.dh 98
                return false;
99
            });
3106 mandeep.dh 100
 
4020 mandeep.dh 101
    $('form#escalation-form').live(
102
            'submit',
103
            function() {
104
                var ticketId = $('#update-ticket-form').attr('ticketId');
105
                updateTicket("infopane", ticketId, $(this).serialize() + '&'
106
                        + $('#update-ticket-form').serialize());
107
                $.colorbox.close();
108
                return false;
109
            });
4241 anupam.sin 110
 
111
    $('form#cancel-cod-form').live(
112
            'submit',
113
            function() {
114
            	var body = $('#cancel-cod-body').val().trim();
115
            	if (body == null || body == '') {
116
                	alert('Please specify description');
117
                	return false;
118
            	}
119
                var ticketId = $('.display-cancel-order-popup').attr('ticketId');
120
                var orderId = $('.display-cancel-order-popup').attr('orderId');
121
                var orderStatus = $('.display-cancel-order-popup').attr('orderStatus');
122
                cancelOrder("bottom-infopane", ticketId, orderId, orderStatus, $(this).serialize());
123
                $.colorbox.close();
124
                return false;
125
            });
4020 mandeep.dh 126
 
3228 mandeep.dh 127
    $('form#activity-mail-form').live(
128
            'submit',
129
            function() {
130
                createActivity("infopane", $(this).serialize() + '&' + $("#create-activity-form").serialize());
131
                $.colorbox.close();
132
                return false;
133
            });
3106 mandeep.dh 134
 
3405 mandeep.dh 135
    $('#create-activity-form').live('submit', function() {
136
        createActivity("infopane", $(this).serialize());
3339 mandeep.dh 137
        return false;
138
    });
139
 
3228 mandeep.dh 140
    $('#create-ticket-form').live('submit', function() {
141
        createTicket("infopane", $(this).serialize());
142
        return false;
143
    });
3106 mandeep.dh 144
 
3228 mandeep.dh 145
    $(".home-page").click(function() {
146
        goToHomePage();
147
    });
3106 mandeep.dh 148
 
3228 mandeep.dh 149
    $(".my-open-tickets").live('click', function() {
4008 mandeep.dh 150
        loadTickets('infopane', "/crm/tickets!searchTickets?agentIds=" + $(this).attr('agentIds') +"&status=OPEN");
3228 mandeep.dh 151
    });
3151 mandeep.dh 152
 
3228 mandeep.dh 153
    $(".unassigned-tickets").live('click', function() {
3234 mandeep.dh 154
        loadTickets('infopane', "/crm/tickets!getUnassignedTickets");
3151 mandeep.dh 155
    });
156
 
4065 mandeep.dh 157
    $("#spinner-div").ajaxSend(function(evt, request, settings) {
158
        if (settings.url != '/crm') {
159
            $(this).show();
160
        }
3228 mandeep.dh 161
    });
162
 
4065 mandeep.dh 163
    $("#spinner-div").ajaxComplete(function(evt, request, settings) {
164
        if (settings.url != '/crm') {
165
            $(this).hide();
166
        }
3228 mandeep.dh 167
    });
168
 
169
    $("select#activity-type").live('change', function() {
3422 mandeep.dh 170
        processActivityTypeChange($(this).val());
3228 mandeep.dh 171
    });
3397 mandeep.dh 172
 
3339 mandeep.dh 173
    $(".list-my-activity").live('click', function() {
174
        listActivities('infopane', "");
175
    });
176
 
177
    $(".list-customer-activity").live('click', function() {
178
        listActivities('infopane', "creatorId=1");
179
    });
3390 mandeep.dh 180
 
181
    $("#mark-as-read").live('click', function() {
182
        var activityId = $(this).attr('activityId');
183
        markAsRead(activityId);
184
    });
3397 mandeep.dh 185
 
4267 anupam.sin 186
    $("#block-payment").live('click', function() {
187
    	var transactionId = $(this).attr('transactionId');
188
    	var ticketId = $(this).attr('ticketId');
189
    	var currentAgent = $(this).attr('currentAgent');
190
    	blockPayment(transactionId, ticketId, currentAgent);
191
    });
192
 
193
    $("#allow-payment").live('click', function() {
194
    	var transactionId = $(this).attr('transactionId');
195
    	var ticketId = $(this).attr('ticketId');
196
    	allowPayment(transactionId, ticketId);
197
    });
198
 
3397 mandeep.dh 199
    $("form#search").live('submit', function() {
200
        if ($('#searchEntity').val() == 'Tickets') {
201
            loadTickets('infopane', "/crm/tickets!searchTickets?" + $(this).serialize());
202
        }
203
        else {
204
            listActivities('infopane', $(this).serialize());
205
        }
206
 
207
        $.colorbox.close();
208
        return false;
209
    });
210
 
211
    $(".advanced-search").live('click', function() {
212
        loadAdvancedSearchBox();
213
        return false;
214
    });
215
 
216
    $("select#searchEntity").live('change', function() {
217
        var searchEntity = $(this).val();
218
        processSearchEntityChange(searchEntity);
219
    });
3499 mandeep.dh 220
 
221
    $('.pending-cod-verification-tickets').live('click', function() {
3546 mandeep.dh 222
        loadTickets('infopane', "/crm/tickets!searchTickets?category=COD_VERIFICATION&status=OPEN");        
223
        return false;
3499 mandeep.dh 224
    });
3546 mandeep.dh 225
 
3578 mandeep.dh 226
    $('.open-failed-payments-tickets').live('click', function() {
227
        loadTickets('infopane', "/crm/tickets!searchTickets?category=FAILED_PAYMENTS&status=OPEN");        
228
        return false;
229
    });
4267 anupam.sin 230
 
231
    $('.open-flagged-payments-tickets').live('click', function() {
232
        loadTickets('infopane', "/crm/tickets!searchTickets?category=PAYMENT_FLAGGED&status=OPEN");        
233
        return false;
234
    });
3578 mandeep.dh 235
 
4008 mandeep.dh 236
    $('.open-delayed-delivery-tickets').live('click', function() {
237
        loadTickets('infopane', "/crm/tickets!searchTickets?category=DELAYED_DELIVERY&status=OPEN");        
238
        return false;
239
    });
240
 
3499 mandeep.dh 241
    $('.trust-level-increase').live('click', function() {
242
        increaseTrustLevel('infopane', $('input#trust-level-increase').attr('userId'), $('input#trust-level-increase').val());
243
    });
244
 
3546 mandeep.dh 245
    $('.update-order-status').live('click', function() {
246
        updateOrderStatus('bottom-infopane', $(this).attr('ticketId'), $(this).attr('orderId'), $(this).attr('orderStatus'));
3499 mandeep.dh 247
    });
4241 anupam.sin 248
 
249
    $('.display-cancel-order-popup').live('click', function() {
250
    	displayCancelOrderPopUp()
251
    });
3711 mandeep.dh 252
 
253
    $('.list-my-unread-activity').live('click', function() {
254
        loadUnreadActivities('infopane');
255
    });
4142 mandeep.dh 256
 
257
    $('form.change-address').live('submit', function() {
258
        changeAddress($(this).serialize());
259
    });
2674 vikas 260
});