Subversion Repositories SmartDukaan

Rev

Rev 21363 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
21101 kshitij.so 1
<html>
2
<head>
3
<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
4
<style>
5
actionMessage{
6
	paddding:0px;
7
}
8
.actionError{
9
	padding:0px;
10
}
11
</style>
12
</head>
13
<body>
14
<a href="/Support/reports">Back</a>
15
<a href="/Support/logout">Logout</a>
16
<h2>Credit User Wallet</h2>
17
<div style="color:blue;">
18
	#sactionmessage()
19
</div>
20
<div style="color:red;">
21
	#sactionerror()
22
</div>
23
#set($wallet = $action.getUserWallet())
24
#set($user = $action.getUser())
25
<form action="/Support/user-wallet-credit!getWallet" method="POST">
26
	<label for="email">Email:</label>
27
    <input name="email" />
28
	<button type="submit" style="margin:5px;">Submit</button>
29
</form>
30
<hr/>
31
#if($wallet.getAmount())
32
    <div>
33
    	<label for="email">Current Wallet Amount ($user.getEmail()):</label>
34
		$wallet.getAmount()
35
    </div>
36
	<form id="wallet-topup">
37
	<label for="amount">Amount:</label>
38
    <input id="amount" name="amount" />
39
	<label for="email">Email:</label>
40
	<input id="email" name="email" value="$user.getEmail()" readonly/>
41
	<label for="email">CashBack:</label>
42
    <input name="cashback" value="1%" readonly/>
43
	<button type="submit" style="margin:5px;">Submit</button>
44
	</form>
45
#end
46
</body>
47
<script type="text/javascript">
48
$("#wallet-topup").live('submit', function(){
49
	var amt = $('#amount').val();
50
	var email = $('#email').val();
51
	if (amt==isNaN(amt) || amt==null || amt==""){
52
		alert("Empty amount.");
53
		return false;
54
	}
55
	if(!confirm("Adding amount "+amt+" to "+email)){
56
		return false;
57
	}
58
	var data = $(this).serialize();
59
    jQuery.ajax({
60
        url: "/Support/user-wallet-credit!creditWallet",
61
        type: 'POST',
62
        data: data,
63
        async: false,
64
        success: function (data) {
65
			$('#wallet-topup')[0].reset();
66
			alert(data);
67
		},
68
		error : function() {
69
		 	alert("OOPS!!!Failed to do changes.Try Again.");
70
			$('#wallet-topup')[0].reset();
71
		 },
72
        cache: false,
73
        contentType: "application/x-www-form-urlencoded",
74
        processData: false
75
    });
76
	location.reload();
77
    return false;
78
	});
79
</script>
80
 
81
</html>