Directives integer, min, max, and awlookup now working. Lookups now allow user to enter a value, the name is validated, and capitalization is corrected.

This commit is contained in:
chouseknecht
2013-05-15 12:53:53 -04:00
parent b3615465d1
commit 86bd91dfb8
28 changed files with 16588 additions and 55 deletions

View File

@@ -24,15 +24,19 @@ angular.module('LookUpHelper', [ 'RestServices', 'Utilities', 'SearchHelper', 'P
var current_item = params.current_item; //id of the item that should be selected on open
var list = params.list; // list object
var field = params.field; // form field
var postAction = params.postAction //action to perform post user selection
// Show pop-up to select user
var name = list.iterator.charAt(0).toUpperCase() + list.iterator.substring(1);
var defaultUrl = (list.name == 'inventories') ? GetBasePath('inventory') : GetBasePath(list.name);
$('input[name="' + form.fields[field].sourceModel + '_' + form.fields[field].sourceField + '"]').attr('data-url',defaultUrl +
'?' + form.fields[field].sourceField + '__' + 'iexact=:value');
$('input[name="' + form.fields[field].sourceModel + '_' + form.fields[field].sourceField + '"]').attr('data-source',field);
scope['lookUp' + name] = function() {
var listGenerator = GenerateList;
var listScope = listGenerator.inject(list, { mode: 'lookup', hdr: 'Select ' + name });
var defaultUrl = (list.name == 'inventories') ? GetBasePath('inventory') : GetBasePath(list.name);
listScope.selectAction = function() {
var found = false;
var name;
@@ -43,6 +47,8 @@ angular.module('LookUpHelper', [ 'RestServices', 'Utilities', 'SearchHelper', 'P
if (form.fields[field] && form.fields[field].sourceModel) {
scope[form.fields[field].sourceModel + '_' + form.fields[field].sourceField] =
listScope[list.name][i][form.fields[field].sourceField];
scope[form.name + '_form'][form.fields[field].sourceModel + '_' + form.fields[field].sourceField]
.$setValidity('awlookup',true);
}
if (scope[form.name + '_form']) {
scope[form.name + '_form'].$setDirty();
@@ -54,6 +60,11 @@ angular.module('LookUpHelper', [ 'RestServices', 'Utilities', 'SearchHelper', 'P
Alert('Missing Selection', 'Oops, you failed to make a selection. Click on a row to make your selection, ' +
'and then click the Select button.');
}
else {
if (postAction) {
postAction();
}
}
}
listScope['toggle_' + list.iterator] = function(id) {