Subversion Repositories SmartDukaan

Rev

Rev 4782 | Rev 5168 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4782 Rev 4793
Line 212... Line 212...
212
    });
212
    });
213
 
213
 
214
    return activityTable;
214
    return activityTable;
215
}
215
}
216
 
216
 
-
 
217
function loadAgentsInfo(domId) {
-
 
218
	$.ajax({
-
 
219
		type    : "GET",
-
 
220
		url	    : "/crm/agent",
-
 
221
		success : function(response) {
-
 
222
			$('#' + domId).html(response);
-
 
223
			
-
 
224
			var agentTable = $('#agents').dataTable({
-
 
225
                "aaSorting" : [ [ 1, 'asc' ] ],
-
 
226
                "bAutoWidth": false,
-
 
227
                "aoColumns" : [{ "sWidth": "12%", "sSortDataType": "dom-text", "sType": "numeric" },//AgentID
-
 
228
                               { "sWidth": "35%" },//Agent Name
-
 
229
                               { "sWidth": "40%" },//Email ID
-
 
230
                               { "sWidth": "13%", "sSortDataType": "dom-text", "sType": "numeric"}],//Manager ID
-
 
231
                "iDisplayLength" : 10,
-
 
232
                "sDom" : 'T<"clear">lfrtip',
-
 
233
                "oTableTools" : {
-
 
234
                    "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
-
 
235
                },
-
 
236
            });
-
 
237
		}
-
 
238
	});
-
 
239
}
-
 
240
 
217
function loadTicketCreationForm(domId, params) {
241
function loadTicketCreationForm(domId, params) {
218
    $.ajax({
242
    $.ajax({
219
        type : "GET",
243
        type : "GET",
220
        url : "/crm/tickets/new",
244
        url : "/crm/tickets/new",
221
        data : params,
245
        data : params,
Line 295... Line 319...
295
            var ticketTable = createTicketDataTable('tickets');
319
            var ticketTable = createTicketDataTable('tickets');
296
        }
320
        }
297
    });
321
    });
298
}
322
}
299
 
323
 
-
 
324
function createAgent(params, managerId){
-
 
325
	$.ajax({
-
 
326
		type : "POST",
-
 
327
		url : "/crm/agent!createAgent?managerId="+managerId,
-
 
328
		data : params,
-
 
329
		success : function(response) {
-
 
330
			alert("Agent created with the specified information");
-
 
331
			$.colorbox.close();
-
 
332
			$('#infopane').html(response);
-
 
333
			var agentTable = $('#agents').dataTable({
-
 
334
                "aaSorting" : [ [ 1, 'asc' ] ],
-
 
335
                "bAutoWidth": false,
-
 
336
                "aoColumns" : [{ "sWidth": "12%", "sSortDataType": "dom-text", "sType": "numeric" },//AgentID
-
 
337
                               { "sWidth": "35%" },//Agent Name
-
 
338
                               { "sWidth": "40%" },//Email ID
-
 
339
                               { "sWidth": "13%", "sSortDataType": "dom-text", "sType": "numeric"}],//Manager ID
-
 
340
                "iDisplayLength" : 10,
-
 
341
                "sDom" : 'T<"clear">lfrtip',
-
 
342
                "oTableTools" : {
-
 
343
                    "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
-
 
344
                },
-
 
345
            });
-
 
346
		}
-
 
347
	});
-
 
348
}
-
 
349
 
300
function createActivity(domId, params) {
350
function createActivity(domId, params) {
301
    $.ajax({
351
    $.ajax({
302
        type : "POST",
352
        type : "POST",
303
        url : "/crm/activity",
353
        url : "/crm/activity",
304
        data : params,
354
        data : params,
Line 535... Line 585...
535
        }
585
        }
536
    });
586
    });
537
}
587
}
538
 
588
 
539
function showHidecancelReasonDiv(cancelReason){
589
function showHidecancelReasonDiv(cancelReason){
540
	if(cancelReason=="LOWER_PRICE_AVAILABLE_ELSEWHERE"||cancelReason=="OTHER"){
590
	var reasonsToShowDiv = ['LOWER_PRICE_AVAILABLE_ELSEWHERE','OTHER','OUT_OF_STOCK','COLOR_OUT_OF_STOCK'];
-
 
591
	if(($.inArray(cancelReason, reasonsToShowDiv))!=-1){
541
		$('#cancelReasonBox').show();
592
		$('#cancelReasonBox').show();
542
	} else {
593
	} else {
543
		$('#cancelReasonBox').hide();
594
		$('#cancelReasonBox').hide();
544
	}
595
	}
545
	
-
 
546
}
596
}
547
 
597
 
548
function blockPayment(transactionId, ticketId, paymentId) {
598
function blockPayment(transactionId, ticketId, paymentId) {
549
	$.ajax({
599
	$.ajax({
550
		type : "GET",
600
		type : "GET",
Line 615... Line 665...
615
		url : "/crm/user-order-info!markOrderForCancellation?orderId=" + orderId + "&cancellationInitiator=" + formData,
665
		url : "/crm/user-order-info!markOrderForCancellation?orderId=" + orderId + "&cancellationInitiator=" + formData,
616
		success : function(response) {
666
		success : function(response) {
617
			document.location.href = "/crm?email=&orderId=" + orderId;
667
			document.location.href = "/crm?email=&orderId=" + orderId;
618
        }
668
        }
619
	});
669
	});
-
 
670
}
-
 
671
 
-
 
672
function loadAgentCreationForm() {
-
 
673
	$.colorbox({
-
 
674
        inline : true,
-
 
675
        width : "550px",
-
 
676
        height : "400px",
-
 
677
        href : "div#create-agent-div",
-
 
678
        onClosed : function() {
-
 
679
            $("div#create-agent-div").hide();
-
 
680
        }
-
 
681
    });
-
 
682
 
-
 
683
    $("div#create-agent-div").show();
-
 
684
	
-
 
685
}
-
 
686
 
-
 
687
function deactivateAgentPopup() {
-
 
688
	$.colorbox({
-
 
689
        inline : true,
-
 
690
        width : "400px",
-
 
691
        height : "150px",
-
 
692
        href : "div#deactivate-agent-div",
-
 
693
        onClosed : function() {
-
 
694
            $("div#deactivate-agent-div").hide();
-
 
695
        }
-
 
696
    });
-
 
697
 
-
 
698
    $("div#deactivate-agent-div").show();
-
 
699
 
-
 
700
}
-
 
701
 
-
 
702
function changeAgentPasswordPopup(){
-
 
703
	$.colorbox({
-
 
704
        inline : true,
-
 
705
        width  : "350px",
-
 
706
        height : "350px",
-
 
707
        href   : "div#change-password-div",
-
 
708
        onClosed : function() {
-
 
709
            $("div#change-password-div").hide();
-
 
710
        }
-
 
711
    });
-
 
712
 
-
 
713
    $("div#change-password-div").show();
-
 
714
}
-
 
715
 
-
 
716
 
-
 
717
function updateAgentPassword(){
-
 
718
	if(($('#change-password1').val().trim())==($('#change-password2').val().trim())){
-
 
719
		$.ajax({
-
 
720
			type : "POST",
-
 
721
			url : "/crm/agent!changePassword?emailId=" + $('#agentEmail').val() + "&newPassword=" + $('#change-password1').val().trim(),
-
 
722
			success : function(response) {
-
 
723
				alert("Password updated successfully");
-
 
724
				$.colorbox.close();
-
 
725
			}
-
 
726
		});
-
 
727
	}
-
 
728
	else { 
-
 
729
		alert("Passwords not matching");
-
 
730
		return false;
-
 
731
	}
-
 
732
}
-
 
733
 
-
 
734
function validateAgentCreationForm(){
-
 
735
	var formError = false;
-
 
736
	if($('#new-agent-name').val().length == 0) {
-
 
737
		$('#agent-name-error').html("Please enter the name");
-
 
738
		$('#new-agent-name').addClass('agent-form-error');
-
 
739
		formError = true;
-
 
740
	}
-
 
741
	if(($('#new-agent-id').val().length == 0)) {
-
 
742
		$('#agent-email-error').html("Please enter the Email-ID");
-
 
743
		$('#new-agent-id').addClass('agent-form-error');
-
 
744
		formError = true;
-
 
745
	}
-
 
746
	if($('#create-password1').val().length == 0) {
-
 
747
		$('#agent-password1-error').html("Please enter password");
-
 
748
		$('#create-password1').addClass('agent-form-error');
-
 
749
		formError = true;
-
 
750
	} else if($('#create-password2').val().length == 0){
-
 
751
		$('#agent-password2-error').html("Please re enter password");
-
 
752
		$('#create-password2').addClass('agent-form-error');
-
 
753
		formError = true;
-
 
754
	} else if($('#create-password1').val()!=$('#create-password2').val()) {
-
 
755
		$('#agent-password1-error').html("Please make sure you entered same passwords");
-
 
756
		$('#create-password1').addClass('agent-form-error');
-
 
757
		$('#create-password2').addClass('agent-form-error');
-
 
758
		formError = true;
-
 
759
	}
-
 
760
	
-
 
761
	if(formError){
-
 
762
		return false;
-
 
763
	}
-
 
764
	return true;
-
 
765
}
-
 
766
 
-
 
767
function clearAgentCreationForm() {
-
 
768
		$('#agent-name-error').html("");
-
 
769
		$('#new-agent-name').removeClass('agent-form-error');
-
 
770
		$('#agent-email-error').html("");
-
 
771
		$('#new-agent-id').removeClass('agent-form-error');
-
 
772
		$('#agent-password1-error').html("");
-
 
773
		$('#create-password1').removeClass('agent-form-error');
-
 
774
		$('#agent-password2-error').html("");
-
 
775
		$('#create-password2').removeClass('agent-form-error');
-
 
776
		$('#agent-password1-error').html("");
-
 
777
		$('#create-password1').removeClass('agent-form-error');
-
 
778
		$('#create-password2').removeClass('agent-form-error');
-
 
779
}
-
 
780
 
-
 
781
function deactivateAgent(emailId, id) {
-
 
782
	$.ajax({
-
 
783
		type : "POST",
-
 
784
		url : "/crm/agent!deActivateAgent?emailId=" + emailId+ "&id=" + id,
-
 
785
		success : function(response) {   
-
 
786
			alert("Agent : " + "deactivated successfully");
-
 
787
			$.colorbox.close();
-
 
788
			$('#infopane').html(response);
-
 
789
			
-
 
790
			var agentTable = $('#agents').dataTable({
-
 
791
                "aaSorting" : [ [ 1, 'asc' ] ],
-
 
792
                "bAutoWidth": false,
-
 
793
                "aoColumns" : [{ "sWidth": "12%", "sSortDataType": "dom-text", "sType": "numeric" },//AgentID
-
 
794
                               { "sWidth": "35%" },//Agent Name
-
 
795
                               { "sWidth": "40%" },//Email ID
-
 
796
                               { "sWidth": "13%", "sSortDataType": "dom-text", "sType": "numeric"}],//Manager ID
-
 
797
                "iDisplayLength" : 10,
-
 
798
                "sDom" : 'T<"clear">lfrtip',
-
 
799
                "oTableTools" : {
-
 
800
                    "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
-
 
801
                },
-
 
802
            });
-
 
803
		}
-
 
804
	});
620
}
805
}
621
806