OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/assets/javascripts/rates.js

30 lines
729 B

function addRate(date_field) {
var my_date = date_field.value;
var date_elements = $(RatesForm.parentElement).select('input.date');
var highest_date = null;
for each (var e in date_elements) {
if (e.value > my_date) {
highest_date = e;
} else {
break;
}
}
switch (highest_date) {
case null:
RatesForm.add_on_top()
var e = $(RatesForm.parentElement).down("tr");
break;
default:
var after = highest_date.up('tr');
RatesForm.add_after(after);
var e = after.next();
break;
}
var new_date_field = e.down('input.date')
new_date_field.value = date_field.value;
date_field.value = "";
e.down('td.currency').down('input').select();
}