Mercurial > lada > lada-client
changeset 996:bf7bb9583a40
Statusworkflow: More work on the reset Button
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Fri, 08 Jan 2016 14:34:27 +0100 |
parents | fb424948de02 |
children | c943340176d4 |
files | app/controller/grid/Status.js app/view/grid/Status.js app/view/window/MessungEdit.js |
diffstat | 3 files changed, 40 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controller/grid/Status.js Thu Jan 07 16:20:48 2016 +0100 +++ b/app/controller/grid/Status.js Fri Jan 08 14:34:27 2016 +0100 @@ -132,11 +132,13 @@ var recentStatus = button.up('statusgrid').store.getById(s); //Set Status to 'Resetted' (8) - var record = recentStatus.copy(); - record.set('datum', new Date()); - record.set('statusWert', 8); - record.set('id', null); - record.set('text', null); + if (recentStatus) { + var record = recentStatus.copy(); + record.set('datum', new Date()); + record.set('statusWert', 8); + record.set('id', null); + record.set('text', null); + } Ext.Ajax.request({ url: 'lada-server/status', @@ -144,6 +146,7 @@ method: 'POST', success: function(response) { button.up('window').initData(); + button.up('grid').initData(); }, failure: function(response) { // TODO sophisticated error handling, with understandable Texts
--- a/app/view/grid/Status.js Thu Jan 07 16:20:48 2016 +0100 +++ b/app/view/grid/Status.js Fri Jan 08 14:34:27 2016 +0100 @@ -185,11 +185,17 @@ if (b == true){ //Readonly this.down('button[action=add]').disable(); - this.down('button[action=reset]').disable(); }else{ //Writable this.down('button[action=add]').enable(); + } + }, + + setResetable: function(b) { + if (b == true){ this.down('button[action=reset]').enable(); + }else{ + this.down('button[action=reset]').disable(); } } });
--- a/app/view/window/MessungEdit.js Thu Jan 07 16:20:48 2016 +0100 +++ b/app/view/window/MessungEdit.js Fri Jan 08 14:34:27 2016 +0100 @@ -178,6 +178,14 @@ else { this.disableStatusEdit(); } + //Check if it is allowed to reset Status + // TODO additional requirements? + if (this.record.get('statusEdit') === true) { + this.enableStatusReset(); + } + else { + this.disableStatusReset(); + } }, scope: this }); @@ -210,6 +218,7 @@ this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(true); this.down('fset[name=messungskommentare]').down('mkommentargrid').readOnly = true; this.disableStatusEdit(); + this.disableStatusReset(); }, /** @@ -221,12 +230,26 @@ this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(false); this.down('fset[name=messungskommentare]').down('mkommentargrid').readOnly = false; this.enableStatusEdit(); + this.enableStatusReset(); }, /** + * Enable to reset the statusgrid + */ + enableStatusReset: function() { + this.down('fset[name=messungstatus]').down('statusgrid').setResetable(true); + }, + + /** + * Disable to reset the statusgrid + */ + disableStatusReset: function() { + this.down('fset[name=messungstatus]').down('statusgrid').setResetable(false); + }, + /** * Enable to edit the statusgrid */ - enableStatusEdit: function () { + enableStatusEdit: function() { this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(false); this.down('fset[name=messungstatus]').down('statusgrid').readOnly = false; }, @@ -234,7 +257,7 @@ /** * Disable to edit the statusgrid */ - disableStatusEdit: function () { + disableStatusEdit: function() { this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(true); this.down('fset[name=messungstatus]').down('statusgrid').readOnly = true; },