Merged in feature/PMC-814 (pull request #6908)

PMC-814

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Rodrigo Quelca
2019-05-24 14:29:24 +00:00
committed by Julio Cesar Laura Avendaño

View File

@@ -28,6 +28,9 @@ var casesNewTab;
var mask; var mask;
var loadingMessage; var loadingMessage;
var timeoutMark = false; var timeoutMark = false;
var processProxy;
var processStore;
var comboCategory;
function formatAMPM(date, initVal, calendarDate) { function formatAMPM(date, initVal, calendarDate) {
@@ -994,11 +997,13 @@ Ext.onReady ( function() {
} }
}); });
var processStore = new Ext.data.Store( { processProxy = new Ext.data.HttpProxy( {
proxy : new Ext.data.HttpProxy( { url : 'casesList_Ajax?actionAjax=processListExtJs&action='+action,
url : 'casesList_Ajax?actionAjax=processListExtJs&action='+action, method : 'POST'
method : 'POST' });
}),
processStore = new Ext.data.Store( {
proxy : processProxy,
reader : new Ext.data.JsonReader( { reader : new Ext.data.JsonReader( {
fields : [ { fields : [ {
name : 'PRO_UID' name : 'PRO_UID'
@@ -1075,7 +1080,7 @@ Ext.onReady ( function() {
} }
}; };
var comboCategory = new Ext.form.ComboBox({ comboCategory = new Ext.form.ComboBox({
width : 180, width : 180,
boxMaxWidth : 200, boxMaxWidth : 200,
editable : false, editable : false,
@@ -1108,12 +1113,28 @@ Ext.onReady ( function() {
action: action, action: action,
CATEGORY_UID: filterCategory}, CATEGORY_UID: filterCategory},
success: function ( result, request ) { success: function ( result, request ) {
var data = Ext.util.JSON.decode(result.responseText); var data = Ext.util.JSON.decode(result.responseText),
url = "";
suggestProcess.getStore().removeAll(); suggestProcess.getStore().removeAll();
suggestProcess.getStore().loadData( data ); suggestProcess.getStore().loadData( data );
suggestProcess.setValue(''); suggestProcess.setValue('');
// processStore proxy url must be updated every time when the category was changed
url = 'casesList_Ajax?actionAjax=processListExtJs&action=' + action;
url = comboCategory.value ? url + '&CATEGORY_UID=' + comboCategory.value : url;
processProxy = new Ext.data.HttpProxy( {
url : url,
method : 'POST'
});
processStore.proxy = processProxy;
}, },
failure: function ( result, request) { failure: function ( result, request) {
// processStore will be restored to default value if something failed.
var url = 'casesList_Ajax?actionAjax=processListExtJs&action=' + action;
processProxy = new Ext.data.HttpProxy( {
url : url,
method : 'POST'
});
processStore.proxy = processProxy;
if (typeof(result.responseText) != 'undefined') { if (typeof(result.responseText) != 'undefined') {
Ext.MessageBox.alert(_('ID_FAILED'), result.responseText); Ext.MessageBox.alert(_('ID_FAILED'), result.responseText);
} }