Subversion Repositories SmartDukaan

Rev

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