add remaining state transitions and loan transactions to api format.

This commit is contained in:
Keith Woodlock
2012-05-17 02:07:41 +01:00
parent 8bc0b7461f
commit 7bb8b9359e
28 changed files with 397 additions and 1462 deletions
@@ -508,6 +508,14 @@ $(document).ready(function() {
offsetToApprovalDate = data.maxApprovedOnOffsetFromToday;
offsetToDisbursalDate = data.maxDisbursedOnOffsetFromToday;
var $loantabs = $(".loantabs").tabs({
"show": function(event, ui) {
var curTab = $('#newtabs .ui-tabs-panel:not(.ui-tabs-hide)');
var curTabID = curTab.prop("id")
}
});
$('.rejectloan').button().click(function(e) {
var linkId = this.id;
var loanId = linkId.replace("rejectbtn", "");
@@ -579,7 +587,7 @@ $(document).ready(function() {
var linkId = this.id;
var loanId = linkId.replace("undodisbursalbtn", "");
var postUrl = 'http://localhost:8080/mifosng-provider/api/v1/loans/' + loanId + '?command=undodisbursal';
var postUrl = 'http://localhost:8080/mifosng-provider/api/v1/loans/' + loanId + '/undo?command=undodisbursal';
var width = 400;
var height = 150;
popupConfirmationDialogAndPost(postUrl, 'POST', 'dialog.title.undo.loan.disbursal', width, height, currentTabIndex);
@@ -605,54 +613,73 @@ $(document).ready(function() {
var linkId = this.id;
var loanId = linkId.replace("repaymentbtn", "");
var url = 'http://localhost:8080/mifosng-provider/api/v1/loans/' + loanId;
var getUrl = 'http://localhost:8080/mifosng-provider/api/v1/loans/' + loanId + '/transactions/template?transactionType=repayment';
var postUrl = 'http://localhost:8080/mifosng-provider/api/v1/loans/' + loanId + '/transactions?transactionType=repayment';
var templateSelector = "#transactionLoanFormTemplate";
var width = 500;
var height = 350;
var defaultOffset = offsetToApprovalDate;
popupDialogWithFormView(url, 'dialog.title.loan.repayment', templateSelector, width, height, currentTabIndex, offsetToSubmittedDate, defaultOffset, maxOffset)
var saveSuccessFunction = function(data, textStatus, jqXHR) {
$("#dialog-form").dialog("close");
$newtabs.tabs('load', currentTabIndex);
}
popupDialogWithFormView(getUrl, postUrl, 'POST', "dialog.title.loan.repayment", templateSelector, width, height, saveSuccessFunction);
//popupDialogWithFormView(getUrl, postUrl, 'POST', 'dialog.title.loan.repayment', templateSelector, width, height, currentTabIndex, offsetToSubmittedDate, defaultOffset, maxOffset)
e.preventDefault();
});
$('button.repaymentloan span').text(jQuery.i18n.prop('dialog.button.loan.repayment'));
$('.waiveloan').button().click(function(e) {
var linkId = this.id;
var loanId = linkId.replace("waivebtn", "");
var getUrl = 'http://localhost:8080/mifosng-provider/api/v1/loans/' + loanId + '/transactions/template?transactionType=waiver';
var postUrl = 'http://localhost:8080/mifosng-provider/api/v1/loans/' + loanId + '/transactions?transactionType=waiver';
var templateSelector = "#transactionLoanFormTemplate";
var width = 500;
var height = 350;
var defaultOffset = offsetToApprovalDate;
var saveSuccessFunction = function(data, textStatus, jqXHR) {
$("#dialog-form").dialog("close");
$newtabs.tabs('load', currentTabIndex);
}
popupDialogWithFormView(getUrl, postUrl, 'POST', "dialog.title.waive.loan", templateSelector, width, height, saveSuccessFunction);
//popupDialogWithFormView(getUrl, postUrl, 'POST', 'dialog.title.waive.loan', templateSelector, width, height, currentTabIndex, offsetToSubmittedDate, defaultOffset, maxOffset)
e.preventDefault();
});
$('button.waiveloan span').text(jQuery.i18n.prop('dialog.button.loan.waive'));
$('.adjustloanrepayment').button().click(function(e) {
var linkId = this.id;
var loanAndRepaymentId = linkId.replace("adjustrepaymentbtn", "");
var ids = loanAndRepaymentId.split("_");
var loanId = ids[0];
var transactionId = ids[1];
var getAndPutUrl = 'http://localhost:8080/mifosng-provider/api/v1/loans/' + loanId + '/transactions/' + transactionId;
var url = '${rootContext}portfolio/loan/' + ids[0] + '/repayment/' + ids[1] + '/adjust';
var templateSelector = "#transactionLoanFormTemplate";
var width = 500;
var height = 350;
var defaultOffset = offsetToApprovalDate;
popupDialogWithFormView(url, 'dialog.title.adjust.loan.repayment', templateSelector, width, height, currentTabIndex, offsetToSubmittedDate, defaultOffset, maxOffset)
var saveSuccessFunction = function(data, textStatus, jqXHR) {
$("#dialog-form").dialog("close");
$newtabs.tabs('load', currentTabIndex);
}
popupDialogWithFormView(getAndPutUrl, getAndPutUrl, 'PUT', "dialog.title.adjust.loan.repayment", templateSelector, width, height, saveSuccessFunction);
// popupDialogWithFormView(getAndPutUrl, getAndPutUrl, 'PUT', 'dialog.title.adjust.loan.repayment', templateSelector, width, height, currentTabIndex, offsetToSubmittedDate, defaultOffset, maxOffset)
e.preventDefault();
});
$('button.adjustloanrepayment span').text(jQuery.i18n.prop('dialog.button.adjust.loan.repayment'));
$('.waiveloan').button().click(function(e) {
var linkId = this.id;
var loanId = linkId.replace("waivebtn", "");
var url = '${rootContext}portfolio/loan/' + loanId + '/waive';
var templateSelector = "#transactionLoanFormTemplate";
var width = 500;
var height = 350;
var defaultOffset = offsetToApprovalDate;
popupDialogWithFormView(url, 'dialog.title.waive.loan', templateSelector, width, height, currentTabIndex, offsetToSubmittedDate, defaultOffset, maxOffset)
e.preventDefault();
});
$('button.waiveloan span').text(jQuery.i18n.prop('dialog.button.loan.waive'));
var $loantabs = $(".loantabs").tabs({
"show": function(event, ui) {
var curTab = $('#newtabs .ui-tabs-panel:not(.ui-tabs-hide)');
var curTabID = curTab.prop("id")
}
});
// additional data
var additionalFieldsParams = {
url: "http://localhost:8080/mifosng-provider/",
@@ -816,14 +816,15 @@
<form id="entityform">
<div id="formerrors"></div>
<label for="transactionDate"><spring:message code="label.loan.transaction.on"/></label>
<input id="transactionDate" name="transactionDate" cssClass="text ui-widget-content ui-corner-all" title="" class="datepickerfield" value="{{=$ctx.globalDate(date)}}"/>
<input type="hidden" id="dateFormat" name="dateFormat" value="dd MMMM yyyy" />
<label for="transactionDateFormatted"><spring:message code="label.loan.transaction.on"/></label>
<input id="transactionDateFormatted" name="transactionDateFormatted" cssClass="text ui-widget-content ui-corner-all" title="" class="datepickerfield" value="{{=$ctx.globalDate(date)}}"/>
<label for="transactionAmount"><spring:message code="label.loan.transaction.amount"/></label>
<input id="transactionAmount" name="transactionAmount" cssClass="text ui-widget-content ui-corner-all" title="" value="{{=$ctx.money(total)}}" />
<label for="transactionAmountFormatted"><spring:message code="label.loan.transaction.amount"/></label>
<input id="transactionAmountFormatted" name="transactionAmountFormatted" cssClass="text ui-widget-content ui-corner-all" title="" value="{{=$ctx.money(total)}}" />
<label for="transactionComment"><spring:message code="label.loan.action.note"/></label>
<textarea rows="3" cols="53" id="transactionComment" name="transactionComment" cssClass="text ui-widget-content ui-corner-all"></textarea>
<label for="comment"><spring:message code="label.loan.action.note"/></label>
<textarea rows="3" cols="53" id="comment" name="comment" cssClass="text ui-widget-content ui-corner-all"></textarea>
</form>
</script>