Subversion Repositories SmartDukaan

Rev

Rev 24876 | Rev 24896 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
24876 tejbeer 1
$(function() {
2
 
3
	$(".wallet-edit").live('click', function() {
4
		loadManualPayment("main-content");
5
	});
6
 
7
	$(".referenceSearch").live(
8
			'click',
9
			function() {
10
				var reference = $('#reference_id').val();
11
				var type = $('#reference-type option:selected').val();
12
 
13
				if (type == "" || type == null || type == undefined) {
14
					alert("Please Choose Reference Type");
15
					return false;
16
				}
17
 
18
				doGetAjaxRequestHandler(context
19
						+ "/getWalletHistory?reference=" + reference
20
						+ "&referenceType=" + type, function(response) {
21
					$('.wallet-history-container').html(response);
22
				});
23
 
24
				doGetAjaxRequestHandler(context + "/getPartnerName?reference="
25
						+ reference + "&referenceType=" + type, function(
26
						response) {
27
					response=JSON.parse(response);
28
					console.log(response.businessName+ "-" + response.address.city)
29
                   $("#FofoId").val(response.businessName+ "-" + response.address.city);
30
					currentFofoId=response.partnerId;
31
				});
32
 
33
			});
24892 amit.gupta 34
 
35
	$(".fetchTransactions").live(
36
			'click',
37
			function() {
38
					var type = $('#reference-type option:selected').val();
39
					doGetAjaxRequestHandler(context + "/getWalletHistoryByPartner?reference="
40
						+ reference + "&fofoId=" + currentFofoId, function(
41
								response) {
42
					response=JSON.parse(response);
43
				});
44
 
45
			});
24876 tejbeer 46
 
47
	$(".transactionSubmit").live(
48
			'click',
49
			function() {
50
				var reference = $('#reference_id').val();
51
				var type = $('#reference-type option:selected').val();
52
				var transactiontype = $('#transaction-type').val();
53
				var amount = $('#amount').val();
54
				var description = $('#description').val();
55
				var retailerId = currentFofoId
56
				console.log(currentFofoId)
57
				if (type == "") {
58
					alert("Please Choose Reference Type");
59
					return;
60
				}
61
				if (transactiontype == "") {
62
					alert("Please Choose Transaction Type");
63
					return;
64
				}
65
				if (amount == "") {
66
					alert("amount is required");
67
					return;
68
				}
69
 
70
				if (description == "") {
71
					alert("description is required");
72
					return;
73
				}
74
				if (retailerId == "") {
75
					alert("partner name is required");
76
					return;
77
				}
78
 
79
				if (confirm("Are you sure you want update wallet") == true) {
80
 
81
					doPostAjaxRequestHandler(context
82
							+ "/walletUpdate?reference=" + reference
83
							+ "&referenceType=" + type + "&transactiontype="
84
							+ transactiontype + "&amount=" + amount
85
							+ "&description=" + description + "&retailerId="
86
							+ currentFofoId, function(response) {
87
						if (response == 'true') {
88
							alert("successfully submit");
89
 
90
							loadManualPayment("main-content");
91
						}
92
					});
93
				}
94
			});
95
 
96
});
97
function loadManualPayment(domId) {
98
	doGetAjaxRequestHandler(context + "/manualPayment", function(response) {
99
		$('#' + domId).html(response);
100
	});
101
}