Subversion Repositories SmartDukaan

Rev

Rev 7565 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7565 Rev 8707
Line 7... Line 7...
7
<html>
7
<html>
8
<head>
8
<head>
9
	<title>Coupons</title>
9
	<title>Coupons</title>
10
	<script type="text/javascript">
10
	<script type="text/javascript">
11
	</script>
11
	</script>
-
 
12
	<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
-
 
13
	<script type="text/javascript" src="js/jquery.colorbox-min.js"></script>
12
	<style>
14
	<style>
-
 
15
		.hidden {
-
 
16
			display : none;
-
 
17
		}
13
		.form-div {
18
		.form-div {
14
			padding-top:15px;
19
			padding-top:15px;
15
		}
20
		}
16
	</style>
21
	</style>
17
</head>
22
</head>
Line 19... Line 24...
19
	#parse("../content/reports-common.vm")
24
	#parse("../content/reports-common.vm")
20
	<div>
25
	<div>
21
	<h3>Create New Gift Voucher</h3>
26
	<h3>Create New Gift Voucher</h3>
22
	<form id="new-coupon" style='padding-left:20px;' name="coupon" onsubmit="return validateFields()" method="POST">
27
	<form id="new-coupon" style='padding-left:20px;' name="coupon" onsubmit="return validateFields()" method="POST">
23
		<div class='form-div'>
28
		<div class='form-div'>
-
 
29
			Coupon Category: 
-
 
30
			<select name="couponcategory" id='couponcategory'>
-
 
31
				<option value="0" >Customer Satisfaction</option>
-
 
32
				<option value="1" selected="selected">Marketing</option>
-
 
33
				<option value="2" >Refund</option>
-
 
34
			</select>			
-
 
35
		</div>
-
 
36
		<div id='orderIddiv' class = 'hidden'>
-
 
37
			<br />
-
 
38
			Order Id:
-
 
39
			<input type="text" name="orderId" /><span style='font-size:14px;padding-left:5px;color:red;'>Order Id is mandatory in if coupons are to be created for 'REFUND' Coupon Category</span>
-
 
40
		</div>
-
 
41
		<div class='form-div'>
24
			Type: 
42
			Type: 
25
			<select name="type">
43
			<select name="type">
26
				<option value="27" selected="selected">Gift Voucher</option>
44
				<option value="27" selected="selected">Gift Voucher</option>
27
			</select>			
45
			</select>			
28
		</div>
46
		</div>
Line 146... Line 164...
146
    	document.getElementById('optional').style.display='block';
164
    	document.getElementById('optional').style.display='block';
147
	}
165
	}
148
}
166
}
149
 
167
 
150
function validateFields() {
168
function validateFields() {
-
 
169
	var couponcategory= document.forms["coupon"]["couponcategory"].value
-
 
170
	var orderid = document.forms["coupon"]["orderId"].value
-
 
171
	if (couponcategory=="2" && (orderid==null || orderid=="")){
-
 
172
		alert("Order Id is mandatory for 'REFUND' Coupon Category !");
-
 
173
		$('input[name=orderId]').focus();
-
 
174
		return false;
-
 
175
	}
151
    var email=document.forms["coupon"]["userEmail"].value;
176
    var email=document.forms["coupon"]["userEmail"].value;
152
    if (email==null || email=="")
177
	if (email==null || email=="")
153
    {
178
    {
154
        alert("Email cannot be empty!");
179
        alert("Email cannot be empty!");
-
 
180
		$('input[name=userEmail]').focus();
155
        return false;
181
        return false;
156
    }
182
    }
157
	var discount=document.forms["coupon"]["discount"].value;
183
	var discount=document.forms["coupon"]["discount"].value;
158
	if (discount==null || discount=="")
184
	if (discount==null || discount=="")
159
    {
185
    {
160
        alert("Discount cannot be empty!");
186
        alert("Discount cannot be empty!");
-
 
187
		$('input[name=discount]').focus();
161
        return false;
188
        return false;
162
    }
189
    }
163
	return true;
190
	return true;
164
}
191
}
-
 
192
 
-
 
193
$('select[id=couponcategory]').change(function () {
-
 
194
    if ($(this).val() == '0' || $(this).val() === '2') {
-
 
195
        $('div#orderIddiv').show();
-
 
196
    } else {
-
 
197
        $('div#orderIddiv').hide();
-
 
198
    }
-
 
199
});
-
 
200
$('input[name=orderId]').keypress(function(e) {
-
 
201
    var a = [];
-
 
202
    var k = e.which;
-
 
203
 
-
 
204
    for (i = 48; i < 58; i++)
-
 
205
        a.push(i);
-
 
206
 
-
 
207
    if (!(a.indexOf(k)>=0)){
-
 
208
        e.preventDefault();
-
 
209
		alert('Order Id acceptable in Numeric Value Only');
-
 
210
	}
-
 
211
});
-
 
212
$('input[name=discount]').keypress(function(e) {
-
 
213
    var a = [];
-
 
214
    var k = e.which;
-
 
215
 
-
 
216
    for (i = 46; i < 58; i++){
-
 
217
		if(i == 47){
-
 
218
			continue;
-
 
219
		}
-
 
220
		else{
-
 
221
        	a.push(i);
-
 
222
		}
-
 
223
	}
-
 
224
 
-
 
225
    if (!(a.indexOf(k)>=0)){
-
 
226
        e.preventDefault();
-
 
227
		alert('Discount acceptable in Numeric Value Only');
-
 
228
	}
-
 
229
});
165
</script>
230
</script>
166
</html>
231
</html>
167
232