2010-07-16 00:52:57 -07:00
|
|
|
/**
|
|
|
|
|
* file: addpurchaseorder.js
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
|
|
|
|
|
|
$('#PurchaseOrderIssueDateDisplay').datepicker({
|
|
|
|
|
showButtonPanel: true,
|
|
|
|
|
dateFormat: 'DD d MM yy',
|
|
|
|
|
altFormat: 'yy-mm-dd',
|
|
|
|
|
altField: '#PurchaseOrderIssueDate'
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#PurchaseOrderDispatchDateDisplay').datepicker({
|
|
|
|
|
showButtonPanel: true,
|
|
|
|
|
dateFormat: 'DD d MM yy',
|
|
|
|
|
altFormat: 'yy-mm-dd',
|
|
|
|
|
altField: '#PurchaseOrderDispatchDate'
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#PurchaseOrderDateArrivedDisplay').datepicker({
|
|
|
|
|
showButtonPanel: true,
|
|
|
|
|
dateFormat: 'DD d MM yy',
|
|
|
|
|
altFormat: 'yy-mm-dd',
|
|
|
|
|
altField: '#PurchaseOrderDateArrived'
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2011-10-23 20:20:07 -07:00
|
|
|
/**
|
|
|
|
|
* A more generic way of handling the HABTM <ul> <li>[REMOVE BUTTON] NAME [HIDDEN INPUT]</li> </ul>
|
|
|
|
|
*/
|
|
|
|
|
function addToList(modelName, id, value, ULelement) {
|
|
|
|
|
var thisLI = $('<li></li>');
|
|
|
|
|
var thisButton = $('<button>X</button>');
|
|
|
|
|
thisButton.addClass('removeFromList');
|
|
|
|
|
thisButton.button();
|
|
|
|
|
|
|
|
|
|
var thisHiddenInput = $('<input type="hidden">');
|
|
|
|
|
|
|
|
|
|
var modelString = '['+modelName+']';
|
|
|
|
|
|
|
|
|
|
thisHiddenInput.attr('name', 'data'+modelString+modelString+'[]');
|
|
|
|
|
|
|
|
|
|
thisHiddenInput.attr('value', id);
|
|
|
|
|
|
|
|
|
|
thisLI.attr('id', modelName+'ID_'+id);
|
|
|
|
|
thisLI.html(value);
|
|
|
|
|
thisLI.prepend(thisButton);
|
|
|
|
|
thisLI.append(thisHiddenInput);
|
|
|
|
|
ULelement.append(thisLI);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-16 00:52:57 -07:00
|
|
|
});
|