tidy up new loan data returned for submit loan flow and ensure locale is posted for forms with numbers and monetary values in them.

This commit is contained in:
Keith Woodlock
2012-05-31 13:39:30 +01:00
parent 7a62b37210
commit 9d597e2add
6 changed files with 46 additions and 155 deletions
@@ -30,6 +30,7 @@ public class ApplicationPagesRoutesController {
BasicAuthUserDetails userDetails = (BasicAuthUserDetails) authentication.getPrincipal();
model.addAttribute("basicAuthKey", userDetails.getBasicAuthenticationKey());
model.addAttribute("baseApiUrl", userDetails.getFullApiUrl());
model.addAttribute("currentLocale", LocaleContextHolder.getLocale().toString());
return "redirect:/home";
}
@@ -40,6 +41,7 @@ public class ApplicationPagesRoutesController {
BasicAuthUserDetails userDetails = (BasicAuthUserDetails) authentication.getPrincipal();
model.addAttribute("basicAuthKey", userDetails.getBasicAuthenticationKey());
model.addAttribute("baseApiUrl", userDetails.getFullApiUrl());
model.addAttribute("currentLocale", LocaleContextHolder.getLocale().toString());
return new ModelAndView("/home");
}
@@ -56,6 +58,7 @@ public class ApplicationPagesRoutesController {
model.addAttribute("basicAuthKey", userDetails.getBasicAuthenticationKey());
model.addAttribute("baseApiUrl", userDetails.getFullApiUrl());
model.addAttribute("clientId", clientId);
model.addAttribute("currentLocale", LocaleContextHolder.getLocale().toString());
return "client/viewClientAccount";
}
@@ -75,6 +78,9 @@ public class ApplicationPagesRoutesController {
BasicAuthUserDetails userDetails = (BasicAuthUserDetails) authentication.getPrincipal();
model.addAttribute("basicAuthKey", userDetails.getBasicAuthenticationKey());
model.addAttribute("baseApiUrl", userDetails.getFullApiUrl());
model.addAttribute("currentLocale", LocaleContextHolder.getLocale().toString());
return "admin/userhome";
}
@@ -84,6 +90,9 @@ public class ApplicationPagesRoutesController {
model.addAttribute("basicAuthKey", userDetails.getBasicAuthenticationKey());
model.addAttribute("baseApiUrl", userDetails.getFullApiUrl());
model.addAttribute("userId", userDetails.getUserId());
model.addAttribute("currentLocale", LocaleContextHolder.getLocale().toString());
return "admin/accountsettings";
}
@@ -95,6 +104,8 @@ public class ApplicationPagesRoutesController {
model.addAttribute("baseApiUrl", userDetails.getFullApiUrl());
model.addAttribute("clientId", clientId);
model.addAttribute("currentLocale", LocaleContextHolder.getLocale().toString());
return "newloanapplication";
}
@@ -105,6 +116,8 @@ public class ApplicationPagesRoutesController {
model.addAttribute("basicAuthKey", userDetails.getBasicAuthenticationKey());
model.addAttribute("baseApiUrl", userDetails.getFullApiUrl());
model.addAttribute("currentLocale", LocaleContextHolder.getLocale().toString());
return "reports/flexireport";
}
}
@@ -27,7 +27,9 @@ $(document).ready(function() {
// these helpers are registered for the jsViews and jsRender functionality to fix bug with display zero!
$.views.registerHelpers({
currentLocale: function() {
return "${currentLocale}";
},
money: function(monetaryObj) {
Globalize.culture().numberFormat.currency.symbol = monetaryObj.displaySymbol;
@@ -57,7 +57,7 @@ $(document).ready(function() {
},
globalDate: function(dateParts) {
try {
if (dateParts === 'undefined' || dateParts === undefined) return "";
if (dateParts === null || dateParts === '') return "";
var year = dateParts[0];
@@ -69,7 +69,7 @@ $(document).ready(function() {
return Globalize.format(d,"dd MMMM yyyy");
} catch(e) {
return "??";
return dateParts + " ??";
}
},
globalDateAsISOString: function(localDateAsISOString) {
@@ -57,6 +57,8 @@
<input type="hidden" id="clientId" name="clientId" value="{{=clientId}}" />
<input type="hidden" id="currencyCode" name="currencyCode" value="{{=selectedProduct.principal.currencyCode}}" />
<input type="hidden" id="digitsAfterDecimal" name="digitsAfterDecimal" value="{{=$ctx.number(selectedProduct.principal.digitsAfterDecimal)}}" />
<input type="hidden" id="dateFormat" name="dateFormat" value="dd MMMM yyyy" />
<input type="hidden" id="locale" name="locale" value="${currentLocale}" />
<fieldset>
<legend><spring:message code="form.legend.loan.information"/></legend>
@@ -83,7 +85,6 @@
</td>
<td style="text-align:right;vertical-align:bottom;width:50px;">&nbsp;</td>
<td valign="top">
<input type="hidden" id="dateFormat" name="dateFormat" value="dd MMMM yyyy" />
<label for="submittedOnDate"><spring:message code="form.label.loan.submitted.on"/></label>
<input id="submittedOnDate" name="submittedOnDate" title="" type="text" class="datepickerfield" value="{{=$ctx.globalDate(submittedOnDate)}}" />
@@ -826,6 +827,8 @@
<div id="formerrors"></div>
<input type="hidden" id="dateFormat" name="dateFormat" value="dd MMMM yyyy" />
<input type="hidden" id="locale" name="locale" value="{{=$ctx.currentLocale()}}" />
<label for="transactionDate"><spring:message code="label.loan.transaction.on"/></label>
<input id="transactionDate" name="transactionDate" class="text ui-widget-content ui-corner-all datepickerfield" title=""d value="{{=$ctx.globalDate(date)}}"/>