Improvement form Dashboard

This commit is contained in:
Marco Antonio Nina Mena
2015-04-29 11:24:06 -04:00
parent ea7e63188f
commit ce8bbd44ef
2 changed files with 272 additions and 274 deletions

View File

@@ -404,7 +404,7 @@ class AppDelegation extends BaseAppDelegation
}
//Risk date
$riskDate = $calendar->dashCalculateDate($this->getDelDelegateDate(), round($riskTime), $data['TAS_TIMEUNIT'], $arrayCalendarData);
$riskDate = $calendar->dashCalculateDate($this->getDelDelegateDate(), $riskTime, $data['TAS_TIMEUNIT'], $arrayCalendarData);
return $riskDate;
} catch (Exception $e) {

View File

@@ -41,7 +41,6 @@ var frmDashboard;
var addTabButton;
var tabPanel;
var dashboardIndicatorFields;
var dashboardIndicatorPanel;
var store;
var indexTab = 0;
@@ -49,7 +48,7 @@ var comboPageSize = 10;
var resultTpl;
var storeIndicatorType;
var storeGraphic;
var storeFrecuency;
var storeFrequency;
var storeProject;
var storeGroup;
var storeUsers;
@@ -63,13 +62,13 @@ var tabActivate = [];
Ext.onReady( function() {
myMask = new Ext.LoadMask(Ext.getBody(), {msg:_('ID_LOADING')});
Ext.QuickTips.init();
resultTpl = new Ext.XTemplate(
'<tpl for="."><div class="x-combo-list-item" style="white-space:normal !important;word-wrap: break-word;">',
'<span> {APP_PRO_TITLE}</span>',
'<span> {APP_PRO_TITLE}</span>',
'</div></tpl>'
);
@@ -79,20 +78,21 @@ Ext.onReady( function() {
items : [
{
id : 'DAS_TITLE',
fieldLabel : _('ID_DASHBOARD_TITLE'),
fieldLabel : '<span style=\"color:red;\" ext:qtip="'+ _('ID_FIELD_REQUIRED', _('ID_DASHBOARD_TITLE')) +'"> * </span>' + _('ID_DASHBOARD_TITLE'),
xtype : 'textfield',
anchor : '85%',
maxLength : 250,
maskRe : /([a-zA-Z0-9\s]+)$/,
maskRe : /([a-zA-Z0-9_'\s]+)$/,
regex : /([a-zA-Z0-9_'\s]+)$/,
regexText : _('ID_INVALID_VALUE', _('ID_DASHBOARD_TITLE')),
allowBlank : false
},
{
xtype : 'textarea',
id : 'DAS_DESCRIPTION',
fieldLabel : _('ID_DESCRIPTION'),
labelSeparator : '',
anchor : '85%',
maskRe : /([a-zA-Z0-9\s]+)$/,
maskRe : /([a-zA-Z0-9_'\s]+)$/,
height : 50,
}
]
@@ -238,7 +238,7 @@ Ext.onReady( function() {
}
});
storeIndicatorType = new Ext.data.GroupingStore( {
proxy : new Ext.data.HttpProxy({
api: {
@@ -295,7 +295,7 @@ Ext.onReady( function() {
}
});
storeFrecuency = new Ext.data.GroupingStore( {
storeFrequency = new Ext.data.GroupingStore( {
proxy : new Ext.data.HttpProxy({
api: {
read : urlProxy + 'catalog/periodicity'
@@ -448,7 +448,7 @@ Ext.onReady( function() {
return '<div class="search-item">' +
'<h3><span>{owner_uid}</span>{owner_label}</h3>' +
'{excerpt}' +
'</div>';
'</div>';
}
},
//pageSize : 10,
@@ -528,23 +528,24 @@ Ext.onReady( function() {
flag = true;
break;
case 'yes':
tabPanel.getItem(component.id).show();
flag = false;
var dasIndUid = Ext.getCmp('DAS_IND_UID_'+component.id).getValue();
if (typeof dasIndUid != 'undefined' && dasIndUid != '') {
removeIndicator(dasIndUid);
}
tabActivate.remove(component.id);
tabPanel.remove(component);
tabPanel.remove(component, true);
break;
}
},
scope: that
});
return false;
return false;
} else {
flag = true;
}
},
tabchange : function ( that, tab ) {
var id = tabPanel.getActiveTab().id;
@@ -626,7 +627,7 @@ Ext.onReady( function() {
items : [
addTabButton,
tabPanel
]
});
@@ -644,11 +645,11 @@ Ext.onReady( function() {
waitMsgTarget : true,
frame : true,
defaults : {
anchor : '100%',
allowBlank : false,
resizable : true,
msgTarget : 'side',
align : 'center'
anchor : '100%',
allowBlank : false,
resizable : true,
msgTarget : 'side',
align : 'center'
},
items : [
dashboardFields,
@@ -671,10 +672,9 @@ Ext.onReady( function() {
]
});
ownerInfoGrid.store.load();
ownerInfoGrid.on("afterrender", function(component) {
component.getBottomToolbar().refresh.hideParent = true;
component.getBottomToolbar().refresh.hide();
component.getBottomToolbar().refresh.hide();
});
viewport = new Ext.Viewport({
@@ -698,6 +698,7 @@ Ext.onReady( function() {
}
dashboardOwnerFields.items.items[0].bindStore(dataUserGroup);
} );
storeUsers.on( 'load', function( store, records, options ) {
for (var i=0; i< store.data.length; i++) {
row = [];
@@ -730,243 +731,245 @@ var addTab = function (flag) {
return false;
}
var tab = {
title : _('ID_INDICATOR')+ ' '+ (++indexTab),
id : indexTab,
iconCls : 'tabs',
width : "100%",
items : [
new Ext.Panel({
height : 230,
width : "100%",
border : true,
bodyStyle : 'padding:10px',
items : [
new Ext.form.FieldSet({
labelWidth : 150,
labelAlign :'right',
items : [
{
id : 'DAS_IND_UID_' + indexTab,
xtype : 'textfield',
hidden : true
},
{
fieldLabel : _('ID_INDICATOR_TITLE'),
id : 'IND_TITLE_'+ indexTab,
xtype : 'textfield',
anchor : '85%',
maskRe : /([a-zA-Z0-9\s]+)$/,
maxLength : 250,
allowBlank : false
},
new Ext.form.ComboBox({
anchor : '85%',
editable : false,
id : 'IND_TYPE_'+ indexTab,
fieldLabel : _('ID_INDICATOR_TYPE'),
displayField : 'CAT_LABEL_ID',
valueField : 'CAT_UID',
forceSelection : false,
emptyText : _('ID_SELECT'),
selectOnFocus : true,
typeAhead : true,
autocomplete : true,
triggerAction : 'all',
store : storeIndicatorType,
listeners:{
scope: this,
select: function(combo, record, index) {
var value = combo.getValue();
var field = '';
var index = tabPanel.getActiveTab().id;
var fields = ['DAS_IND_FIRST_FIGURE_'+index,'DAS_IND_FIRST_FREQUENCY_'+index,'DAS_IND_SECOND_FIGURE_'+index, 'DAS_IND_SECOND_FREQUENCY_'+index];
if (value == '1050') {
field = Ext.getCmp('IND_PROCESS_'+index);
title : _('ID_INDICATOR')+ ' '+ (++indexTab),
id : indexTab,
iconCls : 'tabs',
width : "100%",
items : [
new Ext.Panel({
height : 230,
width : "100%",
border : true,
bodyStyle : 'padding:10px',
items : [
new Ext.form.FieldSet({
labelWidth : 150,
labelAlign :'right',
items : [
{
id : 'DAS_IND_UID_' + indexTab,
xtype : 'textfield',
hidden : true
},
{
fieldLabel : '<span style=\"color:red;\" ext:qtip="'+ _('ID_FIELD_REQUIRED', _('ID_INDICATOR_TITLE')) +'"> * </span>' + _('ID_INDICATOR_TITLE'),
id : 'IND_TITLE_'+ indexTab,
xtype : 'textfield',
anchor : '85%',
maskRe : /([a-zA-Z0-9_'\s]+)$/,
regex : /([a-zA-Z0-9_'\s]+)$/,
regexText : _('ID_INVALID_VALUE', _('ID_INDICATOR_TITLE')),
maxLength : 250,
allowBlank : false
},
new Ext.form.ComboBox({
anchor : '85%',
editable : false,
id : 'IND_TYPE_'+ indexTab,
fieldLabel : '<span style=\"color:red;\" ext:qtip="'+ _('ID_FIELD_REQUIRED', _('ID_INDICATOR_TYPE')) +'"> * </span>' + _('ID_INDICATOR_TYPE'),
displayField : 'CAT_LABEL_ID',
valueField : 'CAT_UID',
forceSelection : false,
emptyText : _('ID_SELECT'),
selectOnFocus : true,
typeAhead : true,
autocomplete : true,
triggerAction : 'all',
store : storeIndicatorType,
listeners:{
scope: this,
select: function(combo, record, index) {
var value = combo.getValue();
var field = '';
var index = tabPanel.getActiveTab().id;
var fields = ['DAS_IND_FIRST_FIGURE_'+index,'DAS_IND_FIRST_FREQUENCY_'+index,'DAS_IND_SECOND_FIGURE_'+index, 'DAS_IND_SECOND_FREQUENCY_'+index];
if (value == '1050') {
field = Ext.getCmp('IND_PROCESS_'+index);
field.setValue('0');
field.disable();
field.hide();
} else {
field = Ext.getCmp('IND_PROCESS_'+index);
field.enable();
field.show();
}
if (value == '1010' || value == '1030' || value == '1050') {
for (var i=0; i<fields.length; i++) {
field = Ext.getCmp(fields[i]);
field.disable();
field.hide();
} else {
field = Ext.getCmp('IND_PROCESS_'+index);
}
} else {
for (var i=0; i<fields.length; i++) {
field = Ext.getCmp(fields[i]);
field.enable();
field.show();
}
if (value == '1010' || value == '1030' || value == '1050') {
for (var i=0; i<fields.length; i++) {
field = Ext.getCmp(fields[i]);
field.disable();
field.hide();
}
} else {
for (var i=0; i<fields.length; i++) {
field = Ext.getCmp(fields[i]);
field.enable();
field.show();
}
}
}
}
}),
new Ext.form.FieldSet({
title : _('ID_INDICATOR_GOAL'),
width : "90%",
id : 'fieldSet_'+ indexTab,
bodyStyle: 'paddingLeft: 75px;',
paddingLeft: "30px",
marginLeft : "60px",
layout : 'hbox',
hidden : true,
items : [
new Ext.form.ComboBox({
editable : false,
id : 'DAS_IND_DIRECTION_'+ indexTab,
displayField : 'label',
valueField : 'id',
value : '2',
forceSelection : false,
selectOnFocus : true,
typeAhead : true,
autocomplete : true,
width : 90,
triggerAction : 'all',
mode : 'local',
allowBlank : false,
store : new Ext.data.ArrayStore({
id: 2,
fields: [
'id',
'label'
],
data: [['1', _('ID_LESS_THAN')], ['2', _('ID_MORE_THAN')]]
})
}),
{
fieldLabel : _('ID_INDICATOR_GOAL'),
id : 'IND_GOAL_'+ indexTab,
xtype : 'textfield',
anchor : '40%',
maskRe : /([0-9\.]+)$/,
maxLength : 9,
value : 1,
width : 80,
allowBlank : false,
listeners : {
focus : function(tb, e) {
Ext.QuickTips.register({
target: tb,
title: _('ID_HELP'),
text: _('ID_GOAL_HELP')
});
}
}
}
],
listeners:
}
}
}),
new Ext.form.FieldSet({
title : _('ID_INDICATOR_GOAL'),
width : "90%",
id : 'fieldSet_'+ indexTab,
bodyStyle: 'paddingLeft: 75px;',
paddingLeft: "30px",
marginLeft : "60px",
layout : 'hbox',
hidden : true,
items : [
new Ext.form.ComboBox({
editable : false,
id : 'DAS_IND_DIRECTION_'+ indexTab,
displayField : 'label',
valueField : 'id',
value : '2',
forceSelection : false,
selectOnFocus : true,
typeAhead : true,
autocomplete : true,
width : 90,
triggerAction : 'all',
mode : 'local',
allowBlank : false,
store : new Ext.data.ArrayStore({
id: 2,
fields: [
'id',
'label'
],
data: [['1', _('ID_LESS_THAN')], ['2', _('ID_MORE_THAN')]]
})
}),
{
render: function()
{
var index = tabPanel.getActiveTab().id;
var myfieldset = document.getElementById('fieldSet_'+index);
myfieldset.style.marginLeft = "70px";
myfieldset.style.marginRight = "70px";
fieldLabel : _('ID_INDICATOR_GOAL'),
id : 'IND_GOAL_'+ indexTab,
xtype : 'textfield',
anchor : '40%',
maskRe : /([0-9\.]+)$/,
maxLength : 9,
value : 1,
width : 80,
allowBlank : false,
listeners : {
focus : function(tb, e) {
Ext.QuickTips.register({
target: tb,
title: _('ID_HELP'),
text: _('ID_GOAL_HELP')
});
}
}
}
],
listeners:
{
render: function()
{
var index = tabPanel.getActiveTab().id;
var myfieldset = document.getElementById('fieldSet_'+index);
myfieldset.style.marginLeft = "70px";
myfieldset.style.marginRight = "70px";
}
}
}),
new Ext.form.ComboBox({
anchor : '85%',
editable : false,
fieldLabel : _('ID_PROCESS'),
id : 'IND_PROCESS_'+ indexTab,
displayField : 'prj_name',
valueField : 'prj_uid',
forceSelection : false,
emptyText : _('ID_EMPTY_PROCESSES'),
selectOnFocus : true,
hidden : true,
typeAhead : true,
autocomplete : true,
triggerAction : 'all',
value : '0',
store : storeProject
}),
new Ext.form.ComboBox({
anchor : '85%',
editable : false,
fieldLabel : _('ID_FIRST_FIGURE'),
displayField : 'CAT_LABEL_ID',
id : 'DAS_IND_FIRST_FIGURE_'+ indexTab,
valueField : 'CAT_UID',
forceSelection : false,
emptyText : _('ID_SELECT'),
selectOnFocus : true,
hidden : true,
typeAhead : true,
autocomplete : true,
triggerAction : 'all',
store : storeGraphic
}),
new Ext.form.ComboBox({
anchor : '85%',
editable : false,
fieldLabel : _('ID_PERIODICITY'),
displayField : 'CAT_LABEL_ID',
id : 'DAS_IND_FIRST_FREQUENCY_'+ indexTab,
valueField : 'CAT_UID',
forceSelection : false,
emptyText : _('ID_SELECT'),
selectOnFocus : true,
hidden : true,
typeAhead : true,
autocomplete : true,
triggerAction : 'all',
store : storeFrecuency
}),
new Ext.form.ComboBox({
anchor : '85%',
editable : false,
fieldLabel : _('ID_SECOND_FIGURE'),
id : 'DAS_IND_SECOND_FIGURE_'+ indexTab,
displayField : 'CAT_LABEL_ID',
valueField : 'CAT_UID',
forceSelection : false,
emptyText : _('ID_SELECT'),
selectOnFocus : true,
hidden : true,
typeAhead : true,
autocomplete : true,
triggerAction : 'all',
store : storeGraphic
}),
new Ext.form.ComboBox({
anchor : '85%',
editable : false,
fieldLabel : _('ID_PERIODICITY'),
displayField : 'CAT_LABEL_ID',
id : 'DAS_IND_SECOND_FREQUENCY_'+ indexTab,
valueField : 'CAT_UID',
forceSelection : false,
emptyText : _('ID_SELECT'),
selectOnFocus : true,
hidden : true,
typeAhead : true,
autocomplete : true,
triggerAction : 'all',
store : storeFrecuency
})
]
})
]
})
],
listeners : {
scope: this,
activate : function (that) {
if (tabActivate.indexOf(that.id) == -1 ) {
tabActivate.push(that.id);
}
},
}),
new Ext.form.ComboBox({
anchor : '85%',
editable : false,
fieldLabel : '<span style=\"color:red;\" ext:qtip="'+ _('ID_FIELD_REQUIRED', _('ID_PROCESS')) +'"> * </span>' + _('ID_PROCESS'),
id : 'IND_PROCESS_'+ indexTab,
displayField : 'prj_name',
valueField : 'prj_uid',
forceSelection : true,
emptyText : _('ID_EMPTY_PROCESSES'),
selectOnFocus : true,
hidden : true,
typeAhead : true,
autocomplete : true,
triggerAction : 'all',
store : storeProject
}),
new Ext.form.ComboBox({
anchor : '85%',
editable : false,
fieldLabel : _('ID_FIRST_FIGURE'),
displayField : 'CAT_LABEL_ID',
id : 'DAS_IND_FIRST_FIGURE_'+ indexTab,
valueField : 'CAT_UID',
forceSelection : false,
emptyText : _('ID_SELECT'),
selectOnFocus : true,
hidden : true,
typeAhead : true,
autocomplete : true,
triggerAction : 'all',
store : storeGraphic
}),
new Ext.form.ComboBox({
anchor : '85%',
editable : false,
fieldLabel : _('ID_PERIODICITY'),
displayField : 'CAT_LABEL_ID',
id : 'DAS_IND_FIRST_FREQUENCY_'+ indexTab,
valueField : 'CAT_UID',
forceSelection : false,
emptyText : _('ID_SELECT'),
selectOnFocus : true,
hidden : true,
typeAhead : true,
autocomplete : true,
triggerAction : 'all',
store : storeFrequency
}),
new Ext.form.ComboBox({
anchor : '85%',
editable : false,
fieldLabel : _('ID_SECOND_FIGURE'),
id : 'DAS_IND_SECOND_FIGURE_'+ indexTab,
displayField : 'CAT_LABEL_ID',
valueField : 'CAT_UID',
forceSelection : false,
emptyText : _('ID_SELECT'),
selectOnFocus : true,
hidden : true,
typeAhead : true,
autocomplete : true,
triggerAction : 'all',
store : storeGraphic
}),
new Ext.form.ComboBox({
anchor : '85%',
editable : false,
fieldLabel : _('ID_PERIODICITY'),
displayField : 'CAT_LABEL_ID',
id : 'DAS_IND_SECOND_FREQUENCY_'+ indexTab,
valueField : 'CAT_UID',
forceSelection : false,
emptyText : _('ID_SELECT'),
selectOnFocus : true,
hidden : true,
typeAhead : true,
autocomplete : true,
triggerAction : 'all',
store : storeFrequency
})
]
})
]
})
],
listeners : {
scope: this,
activate : function (that) {
if (tabActivate.indexOf(that.id) == -1 ) {
tabActivate.push(that.id);
}
},
closable:true
};
},
closable:true
};
if (flag != 'load') {
tabPanel.add(tab).show();
} else {
@@ -1028,7 +1031,7 @@ var validateNameDashboard = function () {
PMExt.warning(_('ID_DASHBOARD'), _('ID_DIRECTORY_NAME_EXISTS_ENTER_ANOTHER', title));
return;
}
}
}
saveDashboard();
},
failure: function (response) {
@@ -1086,7 +1089,6 @@ var saveDashboard = function () {
},
data: JSON.stringify(data),
success: function (response) {
var jsonResp = Ext.util.JSON.decode(response.responseText);
saveAllDashboardOwner(DAS_UID);
saveAllIndicators(DAS_UID);
myMask.hide();
@@ -1109,11 +1111,25 @@ var saveAllIndicators = function (DAS_UID) {
tabPanel.getItem(tabActivate[tab]).show();
var fieldsTab = tabPanel.getItem(tabActivate[tab]).items.items[0].items.items[0].items.items;
if (fieldsTab[1].getValue().trim() == '') {
PMExt.warning(_('ID_DASHBOARD'), _('ID_INDICATOR_TITLE_REQUIRED', tabPanel.getItem(tabActivate[tab]).title));
fieldsTab[1].focus(true,10);
return false;
} else if (fieldsTab[2].getValue().trim() == '') {
PMExt.warning(_('ID_DASHBOARD'), _('ID_INDICATOR_TYPE_REQUIRED', tabPanel.getItem(tabActivate[tab]).title));
fieldsTab[2].focus(true,10);
return false;
} else if (fieldsTab[2].getValue() != '1050' && fieldsTab[4].getValue().trim() == '') {
PMExt.warning(_('ID_DASHBOARD'), _('ID_INDICATOR_PROCESS_REQUIRED', tabPanel.getItem(tabActivate[tab]).title));
fieldsTab[4].focus(true,10);
return false;
}
var goal = fieldsTab[3];
fieldsTab.push(goal.items.items[0]);
fieldsTab.push(goal.items.items[1]);
data = [];
var data = [];
data['DAS_UID'] = DAS_UID;
for (var index in fieldsTab) {
@@ -1122,12 +1138,12 @@ var saveAllIndicators = function (DAS_UID) {
continue;
}
id = node.id;
var id = node.id;
if (typeof id == 'undefined' || id.indexOf('fieldSet_') != -1 ) {
continue;
}
id = id.split('_');
field = '';
var field = '';
for (var part = 0; part<id.length-1; part++) {
if (part == 0) {
field = id[part];
@@ -1135,25 +1151,7 @@ var saveAllIndicators = function (DAS_UID) {
field = field+'_'+id[part];
}
}
value = node.getValue();
if (field == 'IND_TITLE' && value.trim() == '') {
PMExt.warning(_('ID_DASHBOARD'), _('ID_INDICATOR_TITLE_REQUIRED', tabPanel.getItem(tabActivate[tab]).title));
node.focus(true,10);
return false;
} else if (field == 'IND_TYPE' && value.trim() == '') {
PMExt.warning(_('ID_DASHBOARD'), _('ID_INDICATOR_TYPE_REQUIRED', tabPanel.getItem(tabActivate[tab]).title));
node.focus(true,10);
return false;
} else if (field == 'IND_GOAL' && value.trim() == '') {
PMExt.warning(_('ID_DASHBOARD'), _('ID_INDICATOR_GOAL_REQUIRED', tabPanel.getItem(tabActivate[tab]).title));
node.focus(true,10);
return false;
} else if (field == 'IND_PROCESS' && value.trim() == '') {
PMExt.warning(_('ID_DASHBOARD'), _('ID_INDICATOR_PROCESS_REQUIRED', tabPanel.getItem(tabActivate[tab]).title));
node.focus(true,10);
return false;
}
var value = node.getValue();
field = field == 'IND_TITLE' ? 'DAS_IND_TITLE' : field;
field = field == 'IND_TYPE' ? 'DAS_IND_TYPE' : field;
@@ -1271,7 +1269,7 @@ var loadIndicators = function (DAS_UID) {
addTab('load');
}
dataIndicator = jsonResp;
for (var i=0; i<=jsonResp.length-1; i++) {
addTab('load');
tabPanel.getItem(i+1).setTitle(jsonResp[i]['DAS_IND_TITLE']);