Subversion Repositories SmartDukaan

Rev

Rev 24892 | Rev 24942 | 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
 
24896 amit.gupta 35
	$(".fetchTransactions").live('click', function() {
36
		var type = $('#reference-type option:selected').val();
37
		doGetAjaxRequestHandler(context + "/getWalletHistoryByPartner?referenceType="+type+"&fofoId=" + currentFofoId, function(response) {
38
			$('.wallet-history-container').html(response);
39
		});
40
	});
24876 tejbeer 41
 
42
	$(".transactionSubmit").live(
43
			'click',
44
			function() {
45
				var reference = $('#reference_id').val();
46
				var type = $('#reference-type option:selected').val();
47
				var transactiontype = $('#transaction-type').val();
48
				var amount = $('#amount').val();
49
				var description = $('#description').val();
50
				var retailerId = currentFofoId
51
				console.log(currentFofoId)
52
				if (type == "") {
53
					alert("Please Choose Reference Type");
54
					return;
55
				}
56
				if (transactiontype == "") {
57
					alert("Please Choose Transaction Type");
58
					return;
59
				}
60
				if (amount == "") {
61
					alert("amount is required");
62
					return;
63
				}
64
 
65
				if (description == "") {
66
					alert("description is required");
67
					return;
68
				}
69
				if (retailerId == "") {
70
					alert("partner name is required");
71
					return;
72
				}
73
 
74
				if (confirm("Are you sure you want update wallet") == true) {
75
 
76
					doPostAjaxRequestHandler(context
77
							+ "/walletUpdate?reference=" + reference
78
							+ "&referenceType=" + type + "&transactiontype="
79
							+ transactiontype + "&amount=" + amount
80
							+ "&description=" + description + "&retailerId="
81
							+ currentFofoId, function(response) {
82
						if (response == 'true') {
83
							alert("successfully submit");
24896 amit.gupta 84
							$("button.referenceSearch").click();
24876 tejbeer 85
						}
86
					});
87
				}
88
			});
89
 
90
});
91
function loadManualPayment(domId) {
92
	doGetAjaxRequestHandler(context + "/manualPayment", function(response) {
93
		$('#' + domId).html(response);
94
	});
95
}