# HG changeset patch # User Dustin Demuth # Date 1436545133 -7200 # Node ID 99c5dd8e9b0f9ebe68ce14989a53e7f4de72bf63 # Parent 03f39ddae5965114210a39835ff800ba61f62ac9# Parent 6249b731d4385c58abc6ee288b724d67533c2b69 merged heads diff -r 6249b731d438 -r 99c5dd8e9b0f app/controller/FilterResult.js --- a/app/controller/FilterResult.js Fri Jul 10 18:13:24 2015 +0200 +++ b/app/controller/FilterResult.js Fri Jul 10 18:18:53 2015 +0200 @@ -34,6 +34,9 @@ 'filterresultgrid toolbar button[action=addMessprogramm]': { click: this.addMessprogrammItem }, + 'filterresultgrid toolbar button[action=genProbenFromMessprogramm]': { + click: this.genProbenFromMessprogramm + }, 'filterresultgrid toolbar button[action=import]': { click: this.uploadFile }, @@ -101,6 +104,46 @@ }, /** + * This button creates a window to generate Proben + * from a selected messprogramm. + */ + genProbenFromMessprogramm: function(button) { + var grid = button.up('grid'); + var selection = grid.getView().getSelectionModel().getSelection(); + var i18n = Lada.getApplication().bundle; + var proben = []; + for (var i = 0; i < selection.length; i++) { + proben.push(selection[i].get('id')); + } + var me = this; + + var winname = 'Lada.view.window.GenProbenFromMessprogramm'; + for (p in proben) { + grid.setLoading(true); + Ext.ClassManager.get('Lada.model.Messprogramm').load(proben[p], { + failure: function(record, action) { + me.setLoading(false); + // TODO + console.log('An unhandled Failure occured. See following Response and Record'); + console.log(action); + console.log(record); + }, + success: function(record, response) { + grid.setLoading(false); + + var win = Ext.create(winname, { + record: record, + parentWindow: null + }); + win.show(); + win.initData(); + }, + scope: this + }); + } + }, + + /** * This function opens a {@link Lada.view.window.FileUpload} * window to upload a LAF-File */ diff -r 6249b731d438 -r 99c5dd8e9b0f app/view/grid/FilterResult.js --- a/app/view/grid/FilterResult.js Fri Jul 10 18:13:24 2015 +0200 +++ b/app/view/grid/FilterResult.js Fri Jul 10 18:18:53 2015 +0200 @@ -42,13 +42,6 @@ action: 'addProbe', disabled: false }, { - text: 'Messprogramm erstellen', - icon: 'resources/img/list-add.png', - action: 'addMessprogramm', - disabled: true - }, - '-', - { text: 'Proben Importieren', icon: 'resources/img/svn-commit.png', action: 'import', @@ -58,8 +51,19 @@ icon: 'resources/img/svn-update.png', action: 'export', disabled: true - } - ] + }, + '-', + { + text: 'Messprogramm erstellen', + icon: 'resources/img/list-add.png', + action: 'addMessprogramm', + disabled: true + }, { + text: 'Proben generieren', + icon: 'resources/img/view-time-schedule-insert.png', + action: 'genProbenFromMessprogramm', + disabled: true + }] }]; this.columns = []; this.callParent(arguments); @@ -94,6 +98,7 @@ if (store.model.modelName == 'Lada.model.ProbeList'){ t.setText(i18n.getMsg('probelist')); this.down('button[action=addMessprogramm]').disable(); + this.down('button[action=genProbenFromMessprogramm]').disable(); this.down('button[action=addProbe]').enable(); this.down('button[action=import]').enable(); this.down('button[action=export]').enable(); @@ -101,6 +106,7 @@ else if (store.model.modelName == 'Lada.model.MessprogrammList') { t.setText(i18n.getMsg('probeplanning')); this.down('button[action=addMessprogramm]').enable(); + this.down('button[action=genProbenFromMessprogramm]').enable(); this.down('button[action=addProbe]').disable(); this.down('button[action=import]').disable(); this.down('button[action=export]').disable(); diff -r 6249b731d438 -r 99c5dd8e9b0f app/view/window/GenProbenFromMessprogramm.js --- a/app/view/window/GenProbenFromMessprogramm.js Fri Jul 10 18:13:24 2015 +0200 +++ b/app/view/window/GenProbenFromMessprogramm.js Fri Jul 10 18:18:53 2015 +0200 @@ -125,7 +125,9 @@ this.getEl().addCls('window-inactive'); }, close: function () { - this.parentWindow.probenWindow = null; + if (this.parentWindow) { + this.parentWindow.probenWindow = null; + } } });