Subversion Repositories SmartDukaan

Rev

Rev 4751 | Rev 5168 | 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
 
4705 anupam.sin 111
    $('form#cancel-form').live('submit',
112
    		function() {
113
    	if( $('#cancelReasonBox').attr('style') && !($('#cancelReasonBox').attr('style').indexOf('none'))) {
114
    	var body = $('#cancel-body').val().trim();
115
    	if (body == null || body == '') {
116
    		alert('Please specify description');
117
    		return false;
118
    	}
119
    }
120
    var ticketId = $('.display-cancel-order-popup').attr('ticketId');
121
    var orderId = $('.display-cancel-order-popup').attr('orderId');
122
    var orderStatus = $('.display-cancel-order-popup').attr('orderStatus');
123
    cancelOrder("bottom-infopane", ticketId, orderId, orderStatus, $(this).serialize());
124
    $.colorbox.close();
125
    return false;
126
	});
4020 mandeep.dh 127
 
3228 mandeep.dh 128
    $('form#activity-mail-form').live(
129
            'submit',
130
            function() {
131
                createActivity("infopane", $(this).serialize() + '&' + $("#create-activity-form").serialize());
132
                $.colorbox.close();
133
                return false;
134
            });
3106 mandeep.dh 135
 
3405 mandeep.dh 136
    $('#create-activity-form').live('submit', function() {
137
        createActivity("infopane", $(this).serialize());
3339 mandeep.dh 138
        return false;
139
    });
140
 
3228 mandeep.dh 141
    $('#create-ticket-form').live('submit', function() {
142
        createTicket("infopane", $(this).serialize());
143
        return false;
144
    });
3106 mandeep.dh 145
 
3228 mandeep.dh 146
    $(".home-page").click(function() {
147
        goToHomePage();
148
    });
3106 mandeep.dh 149
 
3228 mandeep.dh 150
    $(".my-open-tickets").live('click', function() {
4008 mandeep.dh 151
        loadTickets('infopane', "/crm/tickets!searchTickets?agentIds=" + $(this).attr('agentIds') +"&status=OPEN");
3228 mandeep.dh 152
    });
3151 mandeep.dh 153
 
3228 mandeep.dh 154
    $(".unassigned-tickets").live('click', function() {
3234 mandeep.dh 155
        loadTickets('infopane', "/crm/tickets!getUnassignedTickets");
3151 mandeep.dh 156
    });
157
 
4065 mandeep.dh 158
    $("#spinner-div").ajaxSend(function(evt, request, settings) {
159
        if (settings.url != '/crm') {
160
            $(this).show();
161
        }
3228 mandeep.dh 162
    });
163
 
4065 mandeep.dh 164
    $("#spinner-div").ajaxComplete(function(evt, request, settings) {
165
        if (settings.url != '/crm') {
166
            $(this).hide();
167
        }
3228 mandeep.dh 168
    });
169
 
170
    $("select#activity-type").live('change', function() {
3422 mandeep.dh 171
        processActivityTypeChange($(this).val());
3228 mandeep.dh 172
    });
3397 mandeep.dh 173
 
3339 mandeep.dh 174
    $(".list-my-activity").live('click', function() {
175
        listActivities('infopane', "");
176
    });
177
 
178
    $(".list-customer-activity").live('click', function() {
179
        listActivities('infopane', "creatorId=1");
180
    });
3390 mandeep.dh 181
 
182
    $("#mark-as-read").live('click', function() {
183
        var activityId = $(this).attr('activityId');
184
        markAsRead(activityId);
185
    });
3397 mandeep.dh 186
 
4490 anupam.sin 187
    $("#deny-doa").live('click', function() {
188
    	var ticketId = $(this).attr('ticketId');
189
    	var orderId = $(this).attr('orderId');
190
    	denyDOA(orderId, ticketId);
191
    });
192
 
193
    $("#authorize-doa").live('click', function() {
194
    	var ticketId = $(this).attr('ticketId');
195
    	var orderId = $(this).attr('orderId');
196
    	authorizeDOA(orderId, ticketId);
197
    });
198
 
199
    $("#deny-return").live('click', function() {
200
    	var ticketId = $(this).attr('ticketId');
201
    	var orderId = $(this).attr('orderId');
202
    	denyReturn(orderId, ticketId);
203
    });
204
 
205
    $("#authorize-return").live('click', function() {
206
    	var ticketId = $(this).attr('ticketId');
207
    	var orderId = $(this).attr('orderId');
208
    	authorizeReturn(orderId, ticketId);
209
    });
210
 
4267 anupam.sin 211
    $("#block-payment").live('click', function() {
212
    	var transactionId = $(this).attr('transactionId');
213
    	var ticketId = $(this).attr('ticketId');
4438 anupam.sin 214
    	var paymentId = $(this).attr('paymentId');
215
    	blockPayment(transactionId, ticketId, paymentId);
4267 anupam.sin 216
    });
217
 
218
    $("#allow-payment").live('click', function() {
219
    	var transactionId = $(this).attr('transactionId');
220
    	var ticketId = $(this).attr('ticketId');
4438 anupam.sin 221
    	var paymentId = $(this).attr('paymentId');
222
    	allowPayment(transactionId, ticketId, paymentId);
4267 anupam.sin 223
    });
224
 
3397 mandeep.dh 225
    $("form#search").live('submit', function() {
226
        if ($('#searchEntity').val() == 'Tickets') {
227
            loadTickets('infopane', "/crm/tickets!searchTickets?" + $(this).serialize());
228
        }
229
        else {
230
            listActivities('infopane', $(this).serialize());
231
        }
232
 
233
        $.colorbox.close();
234
        return false;
235
    });
236
 
237
    $(".advanced-search").live('click', function() {
238
        loadAdvancedSearchBox();
239
        return false;
240
    });
241
 
242
    $("select#searchEntity").live('change', function() {
243
        var searchEntity = $(this).val();
244
        processSearchEntityChange(searchEntity);
245
    });
3499 mandeep.dh 246
 
247
    $('.pending-cod-verification-tickets').live('click', function() {
3546 mandeep.dh 248
        loadTickets('infopane', "/crm/tickets!searchTickets?category=COD_VERIFICATION&status=OPEN");        
249
        return false;
3499 mandeep.dh 250
    });
3546 mandeep.dh 251
 
3578 mandeep.dh 252
    $('.open-failed-payments-tickets').live('click', function() {
253
        loadTickets('infopane', "/crm/tickets!searchTickets?category=FAILED_PAYMENTS&status=OPEN");        
254
        return false;
255
    });
4267 anupam.sin 256
 
257
    $('.open-flagged-payments-tickets').live('click', function() {
258
        loadTickets('infopane', "/crm/tickets!searchTickets?category=PAYMENT_FLAGGED&status=OPEN");        
259
        return false;
260
    });
4490 anupam.sin 261
 
262
    $('.doa-request-tickets').live('click', function() {
263
        loadTickets('infopane', "/crm/tickets!searchTickets?category=DOA_RECEIVED&status=OPEN");        
264
        return false;
265
    });
266
 
267
    $('.return-request-tickets').live('click', function() {
268
        loadTickets('infopane', "/crm/tickets!searchTickets?category=RETURN_FORM&status=OPEN");        
269
        return false;
270
    });
4751 anupam.sin 271
 
272
    $('#order-cancellation-tickets').live('click', function() {
273
        loadTickets('infopane', "/crm/tickets!searchTickets?category=ORDER_CANCELLATION&status=OPEN");        
274
        return false;
275
    });
3578 mandeep.dh 276
 
4008 mandeep.dh 277
    $('.open-delayed-delivery-tickets').live('click', function() {
278
        loadTickets('infopane', "/crm/tickets!searchTickets?category=DELAYED_DELIVERY&status=OPEN");        
279
        return false;
280
    });
281
 
3499 mandeep.dh 282
    $('.trust-level-increase').live('click', function() {
283
        increaseTrustLevel('infopane', $('input#trust-level-increase').attr('userId'), $('input#trust-level-increase').val());
284
    });
285
 
3546 mandeep.dh 286
    $('.update-order-status').live('click', function() {
287
        updateOrderStatus('bottom-infopane', $(this).attr('ticketId'), $(this).attr('orderId'), $(this).attr('orderStatus'));
3499 mandeep.dh 288
    });
4241 anupam.sin 289
 
290
    $('.display-cancel-order-popup').live('click', function() {
4689 anupam.sin 291
    	displayCancelOrderPopUp();
4241 anupam.sin 292
    });
3711 mandeep.dh 293
 
294
    $('.list-my-unread-activity').live('click', function() {
295
        loadUnreadActivities('infopane');
296
    });
4142 mandeep.dh 297
 
298
    $('form.change-address').live('submit', function() {
299
        changeAddress($(this).serialize());
300
    });
4681 amar.kumar 301
 
4689 anupam.sin 302
    $('#orderCancellationButton').live('click', function(){
303
        displayCancelOrderPopUp();
304
    });
305
 
4681 amar.kumar 306
    $('input.cancelReason').live('change', function(){
307
    	showHidecancelReasonDiv($(this).attr('id'));
308
    });
4793 amar.kumar 309
 
310
    $('a.manage-agents').live('click', function() {
311
        loadAgentsInfo("infopane");
312
    });
313
 
314
    $('a#create-agent').live('click', function() {
315
    	loadAgentCreationForm();
316
    });
317
 
318
    $('a#deactivate-agent').live('click', function() {
319
    	deactivateAgentPopup();
320
    });
321
 
322
    $('a#change-password').live('click', function() {
323
    	changeAgentPasswordPopup();
324
    });
325
 
326
    $('input#deactivate-agent').live('click', function() {
327
    	deactivateAgent($('#deactivate-agent-email').val(),$('#deactivate-agent-email').find(':selected')[0].id);
328
    });
329
 
330
    $('#create-agent-form').live('submit', function() {
331
    	if(validateAgentCreationForm()){
332
    		var managerId = $('#manager-email-id').find(':selected')[0].id;
333
    		createAgent($(this).serialize(), managerId);
334
    	}
335
    });
336
 
337
    $('#change-agent-password').live('click', function() {
338
    	updateAgentPassword();
339
    });
2674 vikas 340
});