wip javascript
This commit is contained in:
@@ -1143,10 +1143,10 @@
|
|||||||
<script id="changePasswordFormTemplate" type="text/x-jquery-tmpl">
|
<script id="changePasswordFormTemplate" type="text/x-jquery-tmpl">
|
||||||
<form id="entityform">
|
<form id="entityform">
|
||||||
<div id="formerrors"></div>
|
<div id="formerrors"></div>
|
||||||
<label for="password"><spring:message code="form.label.new.password"/></label>
|
<label for="password">{{=$ctx.doI18N("form.label.new.password")}}</label>
|
||||||
<input id="password" name="password" title="" type="password" value="{{=password}}" size="75"/>
|
<input id="password" name="password" title="" type="password" value="{{=password}}" size="75"/>
|
||||||
|
|
||||||
<label for="repeatPassword"><spring:message code="form.label.repeat.new.password"/></label>
|
<label for="repeatPassword">{{=$ctx.doI18N("form.label.repeat.new.password")}}</label>
|
||||||
<input id="repeatPassword" name="repeatPassword" title="" type="password" value="{{=passwordrepeat}}" size="75"/>
|
<input id="repeatPassword" name="repeatPassword" title="" type="password" value="{{=passwordrepeat}}" size="75"/>
|
||||||
</form>
|
</form>
|
||||||
</script>
|
</script>
|
||||||
@@ -1154,16 +1154,16 @@
|
|||||||
<script id="userSettingsFormTemplate" type="text/x-jquery-tmpl">
|
<script id="userSettingsFormTemplate" type="text/x-jquery-tmpl">
|
||||||
<form id="entityform">
|
<form id="entityform">
|
||||||
<div id="formerrors"></div>
|
<div id="formerrors"></div>
|
||||||
<label for="username"><spring:message code="form.label.username"/></label>
|
<label for="username">{{=$ctx.doI18N("form.label.username")}}</label>
|
||||||
<input id="username" name="username" title="" type="text" value="{{=username}}" size="75"/>
|
<input id="username" name="username" title="" type="text" value="{{=username}}" size="75"/>
|
||||||
|
|
||||||
<label for="firstname"><spring:message code="form.label.firstname"/></label>
|
<label for="firstname">{{=$ctx.doI18N("form.label.firstname")}}</label>
|
||||||
<input id="firstname" name="firstname" title="The first name of user." type="text" value="{{=firstname}}" size="75"/>
|
<input id="firstname" name="firstname" title="The first name of user." type="text" value="{{=firstname}}" size="75"/>
|
||||||
|
|
||||||
<label for="lastname"><spring:message code="form.label.lastname"/></label>
|
<label for="lastname">{{=$ctx.doI18N("form.label.lastname")}}</label>
|
||||||
<input id="lastname" name="lastname" title="The last name of user." type="text" value="{{=lastname}}" size="75"/>
|
<input id="lastname" name="lastname" title="The last name of user." type="text" value="{{=lastname}}" size="75"/>
|
||||||
|
|
||||||
<label for="email"><spring:message code="form.label.email"/></label>
|
<label for="email">{{=$ctx.doI18N("form.label.email")}}</label>
|
||||||
<input id="email" name="email" title="" type="text" value="{{=email}}" size="75"/>
|
<input id="email" name="email" title="" type="text" value="{{=email}}" size="75"/>
|
||||||
</form>
|
</form>
|
||||||
</script>
|
</script>
|
||||||
@@ -1401,6 +1401,16 @@
|
|||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|
||||||
|
#settings {
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 16px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
#toptable {
|
#toptable {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@@ -1409,7 +1419,7 @@
|
|||||||
<div id="container"></div>
|
<div id="container"></div>
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript" src="resources/jsrenderExtra.js"></script>
|
<script type="text/javascript" src="resources/IndividualLendingCode.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|||||||
+20
-21
@@ -86,9 +86,9 @@ function showMainContainer(containerDivName, username) {
|
|||||||
htmlVar += ' <li><a href="?lang=zh">zh</a></li>';
|
htmlVar += ' <li><a href="?lang=zh">zh</a></li>';
|
||||||
htmlVar += ' </ul>';
|
htmlVar += ' </ul>';
|
||||||
htmlVar += ' </li>';
|
htmlVar += ' </li>';
|
||||||
htmlVar += ' <li><a href="unknown.html" onclick="showILAccountSettings(1);return false;" class="dmenu">' + username + '</a>';
|
htmlVar += ' <li><a href="unknown.html" onclick="showILAccountSettings();return false;" class="dmenu">' + username + '</a>';
|
||||||
htmlVar += ' <ul>';
|
htmlVar += ' <ul>';
|
||||||
htmlVar += ' <li><a href="unknown.html" onclick="showILAccountSettings(1);return false;">' + doI18N("link.topnav.account.settings") + '</a></li>';
|
htmlVar += ' <li><a href="unknown.html" onclick="showILAccountSettings();return false;">' + doI18N("link.topnav.account.settings") + '</a></li>';
|
||||||
htmlVar += ' </ul>';
|
htmlVar += ' </ul>';
|
||||||
htmlVar += ' </li>';
|
htmlVar += ' </li>';
|
||||||
htmlVar += ' <li><a href="unknown.html" onclick="signOut(' + "'" + containerDivName + "'" + ');return false;">' + doI18N("link.signout") + '</a></li>';
|
htmlVar += ' <li><a href="unknown.html" onclick="signOut(' + "'" + containerDivName + "'" + ');return false;">' + doI18N("link.signout") + '</a></li>';
|
||||||
@@ -107,9 +107,9 @@ function showMainContainer(containerDivName, username) {
|
|||||||
function showILLogon(logonDivName) {
|
function showILLogon(logonDivName) {
|
||||||
|
|
||||||
var htmlVar = '<form name = "logonform"><table><tr><td>User Name:</td><td><input type="text" name="username"></td></tr>';
|
var htmlVar = '<form name = "logonform"><table><tr><td>User Name:</td><td><input type="text" name="username"></td></tr>';
|
||||||
htmlVar += '<tr><td>Password: </td><td><input type="password" name="password"></td></tr>';
|
htmlVar += '<tr><td>Password: </td><td><input type="password" name="pwd"></td></tr>';
|
||||||
htmlVar += '<tr><td><input type="button" value="Logon" name="Submit" ';
|
htmlVar += '<tr><td><input type="button" value="Logon" name="Submit" ';
|
||||||
htmlVar += 'onclick= "setBasicAuthKey(' + "'" + logonDivName + "'" + ', document.logonform.username.value, document.logonform.password.value )"></td><td></td></tr></table></form>';
|
htmlVar += 'onclick= "setBasicAuthKey(' + "'" + logonDivName + "'" + ', document.logonform.username.value, document.logonform.pwd.value )"></td><td></td></tr></table></form>';
|
||||||
|
|
||||||
$("#" + logonDivName).html(htmlVar);
|
$("#" + logonDivName).html(htmlVar);
|
||||||
}
|
}
|
||||||
@@ -118,6 +118,7 @@ function showILLogon(logonDivName) {
|
|||||||
function setBasicAuthKey(logonDivName, username, password)
|
function setBasicAuthKey(logonDivName, username, password)
|
||||||
{
|
{
|
||||||
base64 = "";
|
base64 = "";
|
||||||
|
currentUser = -1;
|
||||||
var jqxhr = $.ajax({
|
var jqxhr = $.ajax({
|
||||||
url : baseApiUrl + "authentication?username=" + username + "&password=" + password,
|
url : baseApiUrl + "authentication?username=" + username + "&password=" + password,
|
||||||
type : 'POST',
|
type : 'POST',
|
||||||
@@ -127,6 +128,7 @@ function setBasicAuthKey(logonDivName, username, password)
|
|||||||
cache : false,
|
cache : false,
|
||||||
success : function(data, textStatus, jqXHR) {
|
success : function(data, textStatus, jqXHR) {
|
||||||
base64 = data.base64EncodedAuthenticationKey;
|
base64 = data.base64EncodedAuthenticationKey;
|
||||||
|
currentUser = data.userId;
|
||||||
showMainContainer(logonDivName, username);
|
showMainContainer(logonDivName, username);
|
||||||
showILClientListing();
|
showILClientListing();
|
||||||
return false;
|
return false;
|
||||||
@@ -259,7 +261,7 @@ function setAccountSettingsContent(divName) {
|
|||||||
|
|
||||||
var htmlVar = '<div id="tabs">';
|
var htmlVar = '<div id="tabs">';
|
||||||
htmlVar += ' <ul>';
|
htmlVar += ' <ul>';
|
||||||
htmlVar += ' <li><a href="unknown.html" onclick="refreshUsersView();return false;" title="settings"' + doI18N("tab.settings") + '</a></li>';
|
htmlVar += ' <li><a href="#settingstab" title="settings">' + doI18N("tab.settings") + '</a></li>';
|
||||||
htmlVar += ' </ul>';
|
htmlVar += ' </ul>';
|
||||||
htmlVar += ' <div id="settings"></div>';
|
htmlVar += ' <div id="settings"></div>';
|
||||||
htmlVar += '</div>';
|
htmlVar += '</div>';
|
||||||
@@ -610,7 +612,7 @@ function jsViewsRegisterHelpers() {
|
|||||||
}).dialog('open');
|
}).dialog('open');
|
||||||
}
|
}
|
||||||
|
|
||||||
function popupDialogWithPostOnlyFormView(postUrl, titleCode, templateSelector, width, height, saveSuccessFunction, minOffset, defaultOffset, maxOffset) {
|
function popupDialogWithPostOnlyFormView(postUrl, submitType, titleCode, templateSelector, width, height, saveSuccessFunction, minOffset, defaultOffset, maxOffset) {
|
||||||
var dialogDiv = $("<div id='dialog-form'></div>");
|
var dialogDiv = $("<div id='dialog-form'></div>");
|
||||||
var data = new Object();
|
var data = new Object();
|
||||||
var formHtml = $(templateSelector).render(data);
|
var formHtml = $(templateSelector).render(data);
|
||||||
@@ -627,7 +629,7 @@ function jsViewsRegisterHelpers() {
|
|||||||
var newFormData = JSON.stringify($('#entityform').serializeObject());
|
var newFormData = JSON.stringify($('#entityform').serializeObject());
|
||||||
console.log(newFormData);
|
console.log(newFormData);
|
||||||
|
|
||||||
executeAjaxRequest(postUrl, "POST", newFormData, saveSuccessFunction, formErrorFunction);
|
executeAjaxRequest(postUrl, submitType, newFormData, saveSuccessFunction, formErrorFunction);
|
||||||
};
|
};
|
||||||
buttonsOpts[cancelButton] = function() {$(this).dialog( "close" );};
|
buttonsOpts[cancelButton] = function() {$(this).dialog( "close" );};
|
||||||
|
|
||||||
@@ -755,7 +757,6 @@ function showILClient(clientId) {
|
|||||||
var clientUrl = 'clients/' + clientId
|
var clientUrl = 'clients/' + clientId
|
||||||
setClientContent("content");
|
setClientContent("content");
|
||||||
$newtabs = $("#newtabs").tabs({
|
$newtabs = $("#newtabs").tabs({
|
||||||
|
|
||||||
"add": function( event, ui ) {
|
"add": function( event, ui ) {
|
||||||
$newtabs.tabs('select', '#' + ui.panel.id);
|
$newtabs.tabs('select', '#' + ui.panel.id);
|
||||||
}
|
}
|
||||||
@@ -775,7 +776,6 @@ function showILClient(clientId) {
|
|||||||
|
|
||||||
var tableHtml = $("#clientDataTabTemplate").render(data);
|
var tableHtml = $("#clientDataTabTemplate").render(data);
|
||||||
$("#clienttab").html(tableHtml);
|
$("#clienttab").html(tableHtml);
|
||||||
|
|
||||||
$("#clienttabname").html(data.displayName);
|
$("#clienttabname").html(data.displayName);
|
||||||
|
|
||||||
// retrieve accounts summary info
|
// retrieve accounts summary info
|
||||||
@@ -1088,7 +1088,7 @@ function loadILLoan(loanId) {
|
|||||||
var height = 350;
|
var height = 350;
|
||||||
var defaultOffset = offsetToSubmittedDate;
|
var defaultOffset = offsetToSubmittedDate;
|
||||||
|
|
||||||
popupDialogWithPostOnlyFormView(postUrl, 'dialog.title.reject.loan', templateSelector, width, height, saveSuccessFunctionReloadClient, offsetToSubmittedDate, defaultOffset, maxOffset);
|
popupDialogWithPostOnlyFormView(postUrl, 'POST', 'dialog.title.reject.loan', templateSelector, width, height, saveSuccessFunctionReloadClient, offsetToSubmittedDate, defaultOffset, maxOffset);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
$('button.rejectloan span').text(doI18N('dialog.button.reject.loan'));
|
$('button.rejectloan span').text(doI18N('dialog.button.reject.loan'));
|
||||||
@@ -1101,7 +1101,7 @@ function loadILLoan(loanId) {
|
|||||||
var width = 500;
|
var width = 500;
|
||||||
var height = 350;
|
var height = 350;
|
||||||
var defaultOffset = offsetToSubmittedDate;
|
var defaultOffset = offsetToSubmittedDate;
|
||||||
popupDialogWithPostOnlyFormView(postUrl, 'dialog.title.loan.withdrawn.by.client', templateSelector, width, height, saveSuccessFunctionReloadClient, offsetToSubmittedDate, defaultOffset, maxOffset)
|
popupDialogWithPostOnlyFormView(postUrl, 'POST', 'dialog.title.loan.withdrawn.by.client', templateSelector, width, height, saveSuccessFunctionReloadClient, offsetToSubmittedDate, defaultOffset, maxOffset)
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
$('button.withdrawnbyapplicantloan span').text(doI18N('dialog.button.withdrawn.by.client.loan'));
|
$('button.withdrawnbyapplicantloan span').text(doI18N('dialog.button.withdrawn.by.client.loan'));
|
||||||
@@ -1115,7 +1115,7 @@ function loadILLoan(loanId) {
|
|||||||
var width = 500;
|
var width = 500;
|
||||||
var height = 350;
|
var height = 350;
|
||||||
var defaultOffset = offsetToSubmittedDate;
|
var defaultOffset = offsetToSubmittedDate;
|
||||||
popupDialogWithPostOnlyFormView(postUrl, 'dialog.title.approve.loan', templateSelector, width, height, saveSuccessFunctionReloadLoan , offsetToSubmittedDate, defaultOffset, maxOffset)
|
popupDialogWithPostOnlyFormView(postUrl, 'POST', 'dialog.title.approve.loan', templateSelector, width, height, saveSuccessFunctionReloadLoan , offsetToSubmittedDate, defaultOffset, maxOffset)
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
$('button.approveloan span').text(doI18N('dialog.button.approve.loan'));
|
$('button.approveloan span').text(doI18N('dialog.button.approve.loan'));
|
||||||
@@ -1129,7 +1129,7 @@ function loadILLoan(loanId) {
|
|||||||
var width = 500;
|
var width = 500;
|
||||||
var height = 350;
|
var height = 350;
|
||||||
var defaultOffset = offsetToSubmittedDate;
|
var defaultOffset = offsetToSubmittedDate;
|
||||||
popupDialogWithPostOnlyFormView(postUrl, 'dialog.title.undo.loan.approval', templateSelector, width, height, saveSuccessFunctionReloadLoan , offsetToSubmittedDate, defaultOffset, maxOffset)
|
popupDialogWithPostOnlyFormView(postUrl, 'POST', 'dialog.title.undo.loan.approval', templateSelector, width, height, saveSuccessFunctionReloadLoan , offsetToSubmittedDate, defaultOffset, maxOffset)
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
$('button.undoapproveloan span').text(doI18N('dialog.button.undo.loan.approval'));
|
$('button.undoapproveloan span').text(doI18N('dialog.button.undo.loan.approval'));
|
||||||
@@ -1157,7 +1157,7 @@ function loadILLoan(loanId) {
|
|||||||
var width = 500;
|
var width = 500;
|
||||||
var height = 350;
|
var height = 350;
|
||||||
var defaultOffset = offsetToApprovalDate;
|
var defaultOffset = offsetToApprovalDate;
|
||||||
popupDialogWithPostOnlyFormView(postUrl, 'dialog.title.disburse.loan', templateSelector, width, height, saveSuccessFunctionReloadLoan , offsetToSubmittedDate, defaultOffset, maxOffset)
|
popupDialogWithPostOnlyFormView(postUrl, 'POST', 'dialog.title.disburse.loan', templateSelector, width, height, saveSuccessFunctionReloadLoan , offsetToSubmittedDate, defaultOffset, maxOffset)
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
$('button.disburseloan span').text(doI18N('dialog.button.disburse.loan'));
|
$('button.disburseloan span').text(doI18N('dialog.button.disburse.loan'));
|
||||||
@@ -1171,7 +1171,7 @@ function loadILLoan(loanId) {
|
|||||||
var width = 500;
|
var width = 500;
|
||||||
var height = 350;
|
var height = 350;
|
||||||
var defaultOffset = offsetToApprovalDate;
|
var defaultOffset = offsetToApprovalDate;
|
||||||
popupDialogWithPostOnlyFormView(postUrl, 'dialog.title.undo.loan.disbursal', templateSelector, width, height, saveSuccessFunctionReloadLoan , offsetToSubmittedDate, defaultOffset, maxOffset)
|
popupDialogWithPostOnlyFormView(postUrl, 'POST', 'dialog.title.undo.loan.disbursal', templateSelector, width, height, saveSuccessFunctionReloadLoan , offsetToSubmittedDate, defaultOffset, maxOffset)
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
$('button.undodisbursalloan span').text(doI18N('dialog.button.undo.loan.disbursal'));
|
$('button.undodisbursalloan span').text(doI18N('dialog.button.undo.loan.disbursal'));
|
||||||
@@ -1598,7 +1598,7 @@ function selectNewThousandsSep(selectedVal) {
|
|||||||
|
|
||||||
//account settings
|
//account settings
|
||||||
|
|
||||||
function showILAccountSettings(userId) {
|
function showILAccountSettings() {
|
||||||
|
|
||||||
setAccountSettingsContent("content");
|
setAccountSettingsContent("content");
|
||||||
$tabs = $("#tabs").tabs({
|
$tabs = $("#tabs").tabs({
|
||||||
@@ -1617,7 +1617,7 @@ function showILAccountSettings(userId) {
|
|||||||
$("#settings").html(tableHtml);
|
$("#settings").html(tableHtml);
|
||||||
|
|
||||||
$('#changepassword').click(function(e) {
|
$('#changepassword').click(function(e) {
|
||||||
var putUrl = 'users/' + userId;
|
var putUrl = 'users/' + currentUser;
|
||||||
var templateSelector = "#changePasswordFormTemplate";
|
var templateSelector = "#changePasswordFormTemplate";
|
||||||
var width = 600;
|
var width = 600;
|
||||||
var height = 350;
|
var height = 350;
|
||||||
@@ -1627,13 +1627,12 @@ function showILAccountSettings(userId) {
|
|||||||
$("#tabs").tabs('load', 0);
|
$("#tabs").tabs('load', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
popupDialogWithPostOnlyFormView(putUrl, 'PUT', 'dialog.title.update.password', templateSelector, width, height, saveSuccessFunction);
|
popupDialogWithPostOnlyFormView(putUrl, 'PUT', 'dialog.title.update.password', templateSelector, width, height, saveSuccessFunction, 0, 0, 0);
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#changedetails').click(function(e) {
|
$('#changedetails').click(function(e) {
|
||||||
var getAndPutUrl = 'users/' + userId;
|
var getAndPutUrl = 'users/' + currentUser;
|
||||||
var templateSelector = "#userSettingsFormTemplate";
|
var templateSelector = "#userSettingsFormTemplate";
|
||||||
var width = 600;
|
var width = 600;
|
||||||
var height = 350;
|
var height = 350;
|
||||||
@@ -1649,7 +1648,7 @@ function showILAccountSettings(userId) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
executeAjaxRequest("users/" + userId, 'GET', "", successFunction, errorFunction);
|
executeAjaxRequest("users/" + currentUser, 'GET', "", successFunction, errorFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user