# HG changeset patch # User Dustin Demuth # Date 1452180048 -3600 # Node ID fb424948de023ea286273fdeac48e79626ab54ab # Parent 092e245b13a487a7735ac6a12a878d903b1da7b2# Parent f9449df5f9fba4760b9bef41a3c2ee6da69c26a0 Merged heads diff -r f9449df5f9fb -r fb424948de02 app/controller/Filter.js --- a/app/controller/Filter.js Thu Jan 07 13:58:35 2016 +0100 +++ b/app/controller/Filter.js Thu Jan 07 16:20:48 2016 +0100 @@ -33,15 +33,15 @@ this.control({ // CSS like selector to select element in the viewport. See // ComponentQuery documentation for more details. - 'combobox[name=filter]': { + 'filterpanel combobox[name=filter]': { // Map Select event select: this.selectSql }, - 'button[action=search]': { + 'filterpanel button[action=search]': { // Map click event on Button. click: this.search }, - 'button[action=reset]': { + 'filterpanel button[action=reset]': { // Map click event on Button. click: this.reset }, diff -r f9449df5f9fb -r fb424948de02 app/controller/grid/Status.js --- a/app/controller/grid/Status.js Thu Jan 07 13:58:35 2016 +0100 +++ b/app/controller/grid/Status.js Thu Jan 07 16:20:48 2016 +0100 @@ -24,6 +24,9 @@ }, 'statusgrid button[action=add]': { click: this.add + }, + 'statusgrid button[action=reset]': { + click: this.reset } }); }, @@ -115,5 +118,54 @@ button.up('statusgrid').store.insert(lastrow, record); button.up('statusgrid').getPlugin('rowedit').startEdit(lastrow, 1); - } + }, + + /** + * Reset + * This Function instructs the server to reset the current status + * WIP / TODO + * + **/ + reset: function(button) { + var s = button.up('window').down('messungform').getRecord().get('status'); + var messId = button.up('window').down('messungform').getRecord().get('id'); + 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); + + Ext.Ajax.request({ + url: 'lada-server/status', + jsonData: record.getData(), + method: 'POST', + success: function(response) { + button.up('window').initData(); + }, + failure: function(response) { + // TODO sophisticated error handling, with understandable Texts + var json = Ext.JSON.decode(response.responseText); + if (json) { + if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ + formPanel.setMessages(json.errors, json.warnings); + } + if(json.message){ + Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title') + +' #'+json.message, + Lada.getApplication().bundle.getMsg(json.message)); + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), + i18n.getMsg('err.msg.generic.body')); + } + } else { + Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), + i18n.getMsg('err.msg.generic.body')); + } + } + }); + + } }); diff -r f9449df5f9fb -r fb424948de02 app/view/grid/Status.js --- a/app/view/grid/Status.js Thu Jan 07 13:58:35 2016 +0100 +++ b/app/view/grid/Status.js Thu Jan 07 16:20:48 2016 +0100 @@ -60,6 +60,12 @@ xtype: 'toolbar', dock: 'bottom', items: ['->', { + text: 'Zurücksetzen', + icon: 'resources/img/edit-redo.png', + action: 'reset', + probeId: this.probeId, + parentId: this.parentId + }, { text: 'Hinzufügen', icon: 'resources/img/list-add.png', action: 'add', @@ -179,9 +185,11 @@ if (b == true){ //Readonly this.down('button[action=add]').disable(); + this.down('button[action=reset]').disable(); }else{ //Writable this.down('button[action=add]').enable(); + this.down('button[action=reset]').enable(); } } }); diff -r f9449df5f9fb -r fb424948de02 resources/img/edit-redo.png Binary file resources/img/edit-redo.png has changed