tidy up ui for loanproducts and offices after json changes.

This commit is contained in:
Keith Woodlock
2012-05-25 14:04:16 +01:00
parent 5ac62588f6
commit 63a1f6cd63
8 changed files with 74 additions and 251 deletions
@@ -16,7 +16,7 @@ label.client.search=Choose client:
option.client.search.first.choice=--Select Client--
link.add.new.client=Add a new client
page.client.account.title=View Client Account Details
page.client.account.title=View Client Account Detailscon
page.admin.home.title=Administration Home
page.admin.settings.title=Account Settings
@@ -281,7 +281,7 @@ dialog.title.configuration.currencies=Currency Configuration
form.label.configuration.available.currencies=Available currencies:
form.label.configuration.allowed.currencies=Allowed currencies:
validation.msg.organisation.allowed.currencies.cannot.be.blank=You must select at least one currency that is 'allowed' for your organisation.
validation.msg.configuration.currencies.cannot.be.empty=You must select at least one currency that is 'allowed' for your organisation.
# user account settings and admin screens
tab.settings=Settings
@@ -279,7 +279,7 @@ validation.msg.office.externalId.exceeds.max.length=External id exceeds max leng
form.label.configuration.available.currencies=Available currencies:(fr)
form.label.configuration.allowed.currencies=Allowed currencies:(fr)
validation.msg.organisation.allowed.currencies.cannot.be.blank=You must select at least one currency that is 'allowed' for your organisation.(fr)
validation.msg.configuration.currencies.cannot.be.empty=You must select at least one currency that is 'allowed' for your organisation.(fr)
# user account settings and admin screens
tab.settings=Settings(fr)
@@ -58,7 +58,23 @@
return false;
}
},
globalDate: function(localDateAsISOString) {
globalDate: function(dateParts) {
try {
var year = dateParts[0];
var month = parseInt(dateParts[1]) - 1; // month is zero indexed
var day = dateParts[2];
var d = new Date();
d.setFullYear(year,month,day);
return Globalize.format(d,"dd MMMM yyyy");
} catch(e) {
return "??";
}
},
globalDateAsISOString: function(localDateAsISOString) {
try {
var dateParts = localDateAsISOString.split("-")
var year = dateParts[0];
@@ -193,7 +209,7 @@
o[this.name].push(this.value || '');
} else {
if (this.name === 'selectedItems' || this.name === 'notSelectedItems') {
if (this.name === 'currencies' || this.name === 'notSelectedCurrencies') {
o[this.name] = new Array();
o[this.name].push(this.value || '');
} else {
@@ -228,11 +244,11 @@
var buttonsOpts = {};
buttonsOpts[saveButton] = function() {
$('#notSelectedItems option').each(function(i) {
$('#notSelectedCurrencies option').each(function(i) {
$(this).attr("selected", "selected");
});
$('#selectedItems option').each(function(i) {
$('#currencies option').each(function(i) {
$(this).attr("selected", "selected");
});
@@ -272,11 +288,11 @@
open: function (event, ui) {
$('#add').click(function() {
return !$('#notSelectedItems option:selected').remove().appendTo('#selectedItems');
return !$('#notSelectedCurrencies option:selected').remove().appendTo('#currencies');
});
$('#remove').click(function() {
return !$('#selectedItems option:selected').remove().appendTo('#notSelectedItems');
return !$('#currencies option:selected').remove().appendTo('#notSelectedCurrencies');
});
$('.datepickerfield').datepicker({constrainInput: true, maxDate: 0, dateFormat: 'dd MM yy'});
@@ -322,13 +338,12 @@
dataType: 'json',
cache: false,
beforeSend: function(xhr) {
console.log("base64: " + base64);
xhr.setRequestHeader("Authorization", "Basic " + base64);
},
success: function(data, textStatus, jqXHR) {
var productlistParent = new Object();
productlistParent.items = data.products;
productlistParent.products = data;
var productListHtml = $("#productListTemplate").render(productlistParent);
$("#listplaceholder").html(productListHtml);
@@ -336,7 +351,7 @@
$("a.editproduct").click( function(e) {
var linkId = this.id;
var productId = linkId.replace("editproduct", "");
var getUrl = baseApiUrl + 'loanproducts/' + productId;
var getUrl = baseApiUrl + 'loanproducts/' + productId + '?template=true';
var putUrl = baseApiUrl + 'loanproducts/' + productId;
var templateSelector = "#productFormTemplate";
@@ -423,12 +438,8 @@
},
success: function(data, textStatus, jqXHR) {
$.each(data.offices, function(i, item) {
//alert(item.name);
});
console.log(data);
var officelistParent = new Object();
officelistParent.items = data.offices;
officelistParent.offices = data;
var officeListHtml = $("#officeListTemplate").render(officelistParent);
$("#listplaceholder").html(officeListHtml);
@@ -436,7 +447,7 @@
$("a.edit").click( function(e) {
var linkId = this.id;
var entityId = linkId.replace("edit", "");
var getUrl = baseApiUrl + 'offices/' + entityId;
var getUrl = baseApiUrl + 'offices/' + entityId + '?template=true';
var putUrl = baseApiUrl + 'offices/' + entityId;
var templateSelector = "#officeFormTemplate";
@@ -170,7 +170,7 @@
</tr>
</thead>
<tbody>
{{#each items}}
{{#each products}}
<tr>
<td title='{{=description}}'>{{=name}}</td>
<td>{{=$ctx.globalDateTime(createdOn)}}</td>
@@ -201,7 +201,7 @@
</tr>
</thead>
<tbody>
{{#each items}}
{{#each offices}}
<tr>
<td>{{=name}}</td>
<td>{{=externalId}}</td>
@@ -261,8 +261,8 @@
<legend><spring:message code="form.legend.loan.product.currency"/></legend>
<div class="multiselectwidget" style="width:400px;height:125px;">
<label for="notSelectedItems"><spring:message code="form.label.configuration.available.currencies"/></label>
<select id="notSelectedItems" name="notSelectedItems" title="" class="multiselectwidget" multiple="multiple" style="width:400px;height:125px;">
<label for="notSelectedCurrencies"><spring:message code="form.label.configuration.available.currencies"/></label>
<select id="notSelectedCurrencies" name="notSelectedCurrencies" title="" class="multiselectwidget" multiple="multiple" style="width:400px;height:125px;">
{{#each currencyOptions}}
{{#if $ctx.number($parent.parent.data.code)===code}}
<option value="{{=code}}" selected="selected">{{=displayLabel}}</option>
@@ -275,8 +275,8 @@
</div>
<div class="multiselectwidget">
<label for="selectedItems"><spring:message code="form.label.configuration.allowed.currencies"/></label>
<select id="selectedItems" name="selectedItems" title="" class="multiselectwidget" multiple="multiple" style="width:400px;height:125px;">
<label for="currencies"><spring:message code="form.label.configuration.allowed.currencies"/></label>
<select id="currencies" name="currencies" title="" class="multiselectwidget" multiple="multiple" style="width:400px;height:125px;">
{{#each selectedCurrencyOptions}}
{{#if $ctx.number($parent.parent.data.code)===code}}
<option value="{{=code}}" selected="selected">{{=displayLabel}}</option>