Subversion Repositories SmartDukaan

Rev

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

Rev 1380 Rev 1464
Line 4... Line 4...
4
	$('#addAdrBtn').click(function(){
4
	$('#addAdrBtn').click(function(){
5
		$('#newShipAdr').show();
5
		$('#newShipAdr').show();
6
		scrollWin();
6
		scrollWin();
7
	});
7
	});
8
	var lastQueryType = -1;
8
	var lastQueryType = -1;
9
	
-
 
10
	function checkAndUpdateOrderSelector()	{
-
 
11
		if (lastQueryType == 1 || lastQueryType == 2)	{
-
 
12
			jQuery.ajax({
-
 
13
				type: "GET",
-
 
14
				url: "/contact-us/all_orders",
-
 
15
				success: function(data)	{
-
 
16
					$("#order_id").html(data);
-
 
17
				}
-
 
18
			});
-
 
19
		}
-
 
20
	}
-
 
21
	
-
 
22
	$('#communication_category').change(function(){
-
 
23
		$('#orderComponent, #awbComponent, #productComponent, #subjectComponent, #msgComponent').hide();
-
 
24
		$('#frmContactUs input[name="submit"]').removeAttr('disabled');
-
 
25
		
-
 
26
		switch(parseInt($(this).val()))	{
-
 
27
 
-
 
28
			case 1:
-
 
29
				$('#orderComponent, #productComponent, #subjectComponent, #msgComponent').show();
-
 
30
				$('#lblSubject').html('Reason');
-
 
31
				$('#reason_to_return').attr('name', 'subject').show();
-
 
32
				$('#delivery_problem, #subject').removeAttr('name').hide();
-
 
33
				
-
 
34
				jQuery.ajax({
-
 
35
					type: "GET",
-
 
36
					url: "/contact-us/to_return",
-
 
37
					success: function(data)	{
-
 
38
						$("#order_id").html(data);
-
 
39
					}
-
 
40
				});
-
 
41
				lastQueryType = 1;
-
 
42
				break;
-
 
43
 
-
 
44
			case 2:
-
 
45
				$('#orderComponent, #subjectComponent, #msgComponent').show();
-
 
46
				$('#lblSubject').html('Reason');
-
 
47
				$('#subject').attr('name', 'subject').show();
-
 
48
				$('#delivery_problem, #reason_to_return').removeAttr('name').hide();
-
 
49
				
-
 
50
				jQuery.ajax({
-
 
51
					type: "GET",
-
 
52
					url: "/contact-us/to_cancel",
-
 
53
					success: function(data)	{
-
 
54
						$("#order_id").html(data);
-
 
55
					}
-
 
56
				});
-
 
57
				lastQueryType = 2;
-
 
58
				break;
-
 
59
 
-
 
60
			case 3:
-
 
61
				$('#orderComponent, #subjectComponent, #msgComponent').show();
-
 
62
				$('#lblSubject').html('Problem Type');
-
 
63
				$('#delivery_problem').attr('name', 'subject').show();
-
 
64
				$('#reason_to_return, #subject').removeAttr('name').hide();
-
 
65
				checkAndUpdateOrderSelector();
-
 
66
				lastQueryType = 3;
-
 
67
				break;
-
 
68
 
-
 
69
			case 4:
-
 
70
				$('#orderComponent, #msgComponent').show();
-
 
71
				checkAndUpdateOrderSelector();
-
 
72
				lastQueryType = 4;
-
 
73
				break;
-
 
74
 
-
 
75
			case 5:
-
 
76
				$('#orderComponent, #msgComponent').show();
-
 
77
				checkAndUpdateOrderSelector();
-
 
78
				lastQueryType = 5;
-
 
79
				break;
-
 
80
 
-
 
81
			case 6:
-
 
82
				$('#subjectComponent, #msgComponent').show();
-
 
83
				$('#lblSubject').html('Product Title');
-
 
84
				$('#subject').attr('name', 'subject').show();
-
 
85
				$('#delivery_problem, #reason_to_return').removeAttr('name').hide();
-
 
86
				checkAndUpdateOrderSelector();
-
 
87
				lastQueryType = 6;
-
 
88
				break;
-
 
89
 
-
 
90
			case 7:
-
 
91
				$('#subjectComponent, #msgComponent').show();
-
 
92
				$('#lblSubject').html('Subject');
-
 
93
				$('#subject').attr('name', 'subject').show();
-
 
94
				$('#delivery_problem, #reason_to_return').removeAttr('name').hide();
-
 
95
				checkAndUpdateOrderSelector();
-
 
96
				lastQueryType = 7;
-
 
97
				break;
-
 
98
 
-
 
99
			default:
-
 
100
				$('#orderComponent, #awbComponent, #productComponent, #subjectComponent, #msgComponent').hide();
-
 
101
				$('#submit').attr('disabled', 'disabled');
-
 
102
				break;
-
 
103
		}
-
 
104
	});
-
 
105
	
-
 
106
	$('#order_id').change(function(){
-
 
107
		var orderId = parseInt($(this).val());
-
 
108
 
-
 
109
		if(isNaN(orderId))	{
-
 
110
			alert("Order Id must be an integer");
-
 
111
		} else	{
-
 
112
			jQuery.ajax({
-
 
113
				type: "GET",
-
 
114
				url: "/contact-us/" + orderId + "",
-
 
115
				success: function(data)	{
-
 
116
					$("#product").html(data);
-
 
117
				}
-
 
118
			});
-
 
119
		}
-
 
120
	});
-
 
121
	
-
 
122
	$('form[name="frmContactUs"]').validate({
-
 
123
		rules: {
-
 
124
			email: {
-
 
125
				required: true,
-
 
126
				email: true
-
 
127
			},
-
 
128
			order_id: {
-
 
129
				required: true,
-
 
130
				digits: true
-
 
131
			}
-
 
132
		}
-
 
133
	});
-
 
134
 
9
 
135
  function scrollWin(){
10
  function scrollWin(){
136
    $('html, body').animate({
11
    $('html, body').animate({
137
      scrollTop: $("#newShipAdr").offset().top
12
      scrollTop: $("#newShipAdr").offset().top
138
    }, 2000);
13
    }, 2000);