Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
24089 tejbeer 1
$(function() {
27754 amit.gupta 2
	$(document).on('click', ".unsettled-payments", function() {
24089 tejbeer 3
		loadPaymentsRequest("main-content");
4
	});
5
 
27754 amit.gupta 6
	$(document).on('click', '.create-unsettled-payments', function() {
24089 tejbeer 7
		var transactionReference = $('input[name="transactionReference"]').val();
8
		var description = $('input[name="description"]').val();
9
		var amount =$('input[name="amount"]').val();
10
		var referencedate=$('#referencedate').val();
11
 
12
 
13
	if( transactionReference === "" && description === "" &&  amount === "" && referencedate === ""){
14
		alert("Field can't be empty");
15
		return;
16
	}
17
 
18
	if(transactionReference === ""){
19
		alert("Transaction Reference is required");
20
		return;
21
	}
22
	if(description === ""){
23
		alert("Description is required");
24
		return;
25
	}
26
	if(amount === ""){
27
		alert("amount is required");
28
		return;
29
	}
30
	if(referencedate === ""){
31
		alert("Reference Date is required");
32
		return;
33
	}	
34
 
35
		var unsettledData ={};
36
 
37
		unsettledData['transactionReference']=$('input[name="transactionReference"]').val();
38
		unsettledData['description']=$('input[name="description"]').val();
39
		unsettledData['referenceDate']=startDate;
40
		unsettledData['amount']=$('input[name="amount"]').val();
41
 
42
	    console.log(unsettledData)
43
 
44
	if(confirm("Are you sure you want to create Payment") == true){
45
	doPostAjaxRequestWithJsonHandler(context+"/createUnsettledPaymentsEntries", JSON.stringify(unsettledData), function(response){
46
	               if (response == 'true') {
47
				     alert("successfully create");
48
					loadPaymentsRequest("main-content");
49
					}
50
			});
51
 
52
		return false;	
53
	}
54
 
55
 
56
	});
57
 
58
 
28722 amit.gupta 59
	 $(document).on('click', ".remove-unsettledPayment",
24089 tejbeer 60
	 function(){
61
	 if (confirm("Are you sure you want to Remove the Entry") == true) {
62
	 id=$(this).data('requestid');
63
	 console.log(id);
64
	 unsettledRequestRemoved(id);
65
	 }
66
	 });
67
});
68
 
69
 
70
function  unsettledRequestRemoved(id) {
71
	doDeleteAjaxRequestHandler(context + "/removeUnsettledPaymentsEntries?id="+id,function(response) {
72
			if (response == 'true') {
73
		    alert("successfully Removed");
74
			loadPaymentsRequest("main-content");
75
	}
76
 
77
	});
78
 
79
}
80
 
81
	function loadPaymentsRequest(domId){
82
	doGetAjaxRequestHandler(context+ "/getcreateUnsettledPayments", function(response){
83
		$('#' + domId).html(response);
84
	});
85
	}