Changes the form field type to a suggest box so now the user needs to type the 4 first letters of the first name, last name or username field in order to retrieve the field

This commit is contained in:
Gustavo Cruz
2015-02-12 11:09:24 -04:00
parent 987a8ffbad
commit d06b0a941a
2 changed files with 75 additions and 56 deletions

View File

@@ -25,33 +25,17 @@ var textJump;
var ids = '';
var winReassignInCasesList;
function formatAMPM(date, initVal, calendarDate) {
var currentDate = new Date();
var currentDay = currentDate.getDate();
var currentMonth = currentDate.getMonth()+1;
if (currentDay < 10) {
currentDay = '0' + currentDay;
}
if (currentMonth < 10) {
currentMonth = '0' + currentMonth;
}
currentDate = currentMonth + '-' + currentDay;
if (currentDate == calendarDate) {
var hours = date.getHours();
var minutes = (initVal === true)? ((date.getMinutes()<15)? 15: ((date.getMinutes()<30)? 30: ((date.getMinutes()<45)? 45: 45))): date.getMinutes();
var ampm = hours >= 12 ? 'PM' : 'AM';
hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12'
minutes = minutes < 10 ? '0' + minutes : minutes;
var strTime = hours + ':' + minutes + ' ' + ampm;
} else {
var strTime = '12:00 AM';
}
function formatAMPM(date, initVal) {
var hours = date.getHours();
var minutes = (initVal === true)? ((date.getMinutes()<15)? 0: ((date.getMinutes()<30)? 15: ((date.getMinutes()<45)? 30: 45))): date.getMinutes();
var ampm = hours >= 12 ? 'PM' : 'AM';
hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12'
minutes = minutes < 10 ? '0' + minutes : minutes;
var strTime = hours + ':' + minutes + ' ' + ampm;
return strTime;
}
Ext.Ajax.timeout = 4 * 60 * 1000;
var caseSummary = function() {
@@ -264,14 +248,13 @@ function pauseCase(date){
items: [
{
html: '<div align="center" style="font: 14px tahoma,arial,helvetica,sans-serif">' + _('ID_PAUSE_CASE_TO_DATE') +' '+date.format('M j, Y')+'? </div> <br/>'
},
new Ext.form.TimeField({
id: 'unpauseTime',
fieldLabel: _('ID_UNPAUSE_TIME'),
name: 'unpauseTime',
value: formatAMPM(new Date(), false, date.format('m-d')),
minValue: formatAMPM(new Date(), true, date.format('m-d')),
value: formatAMPM(new Date(), false),
minValue: formatAMPM(new Date(), true),
format: 'h:i A'
}),
{
@@ -1147,44 +1130,59 @@ Ext.onReady ( function() {
});
// ComboBox creation processValues
var comboUser = new Ext.form.ComboBox({
store : new Ext.data.Store( {
proxy : new Ext.data.HttpProxy( {
url : 'casesList_Ajax?actionAjax=userValues&action='+action,
method : 'POST'
}),
reader : new Ext.data.JsonReader( {
fields : [ {
name : 'USR_UID'
}, {
name : 'USR_FULLNAME'
} ]
})
}),
var userStore = new Ext.data.Store( {
proxy : new Ext.data.HttpProxy( {
url : 'casesList_Ajax?actionAjax=userValues&action='+action,
method : 'POST'
}),
reader : new Ext.data.JsonReader( {
fields : [ {
name : 'USR_UID'
}, {
name : 'USR_FULLNAME'
} ]
})
});
var userStore = new Ext.data.Store( {
proxy : new Ext.data.HttpProxy({
url : 'casesList_Ajax?actionAjax=userValues&action='+action,
method : 'POST'
}),
reader : new Ext.data.JsonReader({
fields : [{
name : 'USR_UID'
}, {
name : 'USR_FULLNAME'
}]
})
});
var suggestUser = new Ext.form.ComboBox({
store: userStore,
valueField : 'USR_UID',
displayField : 'USR_FULLNAME',
triggerAction : 'all',
displayField:'USR_FULLNAME',
typeAhead: true,
triggerAction: 'all',
emptyText : _('ID_ALL_USERS'),
selectOnFocus : true,
editable : false,
editable : true,
width: 180,
allowBlank : true,
autocomplete: true,
typeAhead: true,
//allowBlankText : _('ID_SHOULD_SELECT_LANGUAGE_FROM_LIST'),
hideTrigger:true,
listeners:{
scope: this,
'select': function() {
storeCases.setBaseParam("user", comboUser.store.getAt(0).get(comboUser.valueField));
filterUser = comboUser.value;
storeCases.setBaseParam( 'user', filterUser);
storeCases.setBaseParam( 'start', 0);
storeCases.setBaseParam( 'limit', pageSize);
//storeCases.load();
//storeCases.setBaseParam( 'user', comboUser.store.getAt(0).get(comboUser.valueField));
filterUser = suggestUser.value;
storeCases.setBaseParam( 'user', filterUser);
storeCases.setBaseParam( 'start', 0);
storeCases.setBaseParam( 'limit', pageSize);
}
}
});
});
var textSearch = new Ext.form.TextField ({
allowBlank: true,
@@ -1858,7 +1856,8 @@ Ext.onReady ( function() {
comboStatus,
"-",
_("ID_USER"),
comboUser,
//comboUser,
suggestUser,
'&nbsp;&nbsp;&nbsp;'
//'-',
//textSearch,