Mercurial > lada > lada-client
changeset 588:e24bc8cf8e1d
Renamed messungen grid and controller.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 11 Mar 2015 15:21:27 +0100 |
parents | cf328526b5bb |
children | 4c97717b92da |
files | app.js app/controller/grid/Messung.js app/controller/grid/Messungen.js app/view/grid/Messung.js app/view/grid/Messungen.js app/view/window/ProbeEdit.js |
diffstat | 6 files changed, 264 insertions(+), 264 deletions(-) [+] |
line wrap: on
line diff
--- a/app.js Wed Mar 11 13:39:04 2015 +0100 +++ b/app.js Wed Mar 11 15:21:27 2015 +0100 @@ -107,6 +107,6 @@ 'Lada.controller.grid.Ort', 'Lada.controller.grid.Probenzusatzwert', 'Lada.controller.grid.PKommentar', - 'Lada.controller.grid.Messungen' + 'Lada.controller.grid.Messung', ] });
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/controller/grid/Messung.js Wed Mar 11 15:21:27 2015 +0100 @@ -0,0 +1,65 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +/* + * Controller for a Messungengrid + */ +Ext.define('Lada.controller.grid.Messung', { + extend: 'Ext.app.Controller', + + requires: [ + 'Lada.view.window.MessungEdit' + ], + + init: function() { + this.control({ + 'messungengrid': { + itemdblclick: this.editItem + }, + 'messungengrid button[action=add]': { + click: this.add + }, + 'messungengrid button[action=delete]': { + click: this.remove + } + }); + }, + + editItem: function(grid, record) { + console.log(record); + var win = Ext.create('Lada.view.window.MessungEdit', { + record: record + }); + win.show(); + win.initData(); + }, + + add: function() { + // TODO + console.log('add'); + }, + + remove: function(button) { + var grid = button.up('grid'); + var selection = grid.getView().getSelectionModel().getSelection()[0]; + Ext.MessageBox.confirm( + 'Messung löschen', + 'Sind Sie sicher?', + function(btn) { + if (btn === 'yes') { + selection.destroy({ + success: function() { + button.up('window').initData(); + }, + failure: function() { + } + }); + } + }); + } +});
--- a/app/controller/grid/Messungen.js Wed Mar 11 13:39:04 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz - * Software engineering by Intevation GmbH - * - * This file is Free Software under the GNU GPL (v>=3) - * and comes with ABSOLUTELY NO WARRANTY! Check out - * the documentation coming with IMIS-Labordaten-Application for details. - */ - -/* - * Controller for a Messungengrid - */ -Ext.define('Lada.controller.grid.Messungen', { - extend: 'Ext.app.Controller', - - requires: [ - 'Lada.view.window.MessungEdit' - ], - - init: function() { - this.control({ - 'messungengrid': { - itemdblclick: this.open - }, - 'messungengrid button[action=add]': { - click: this.add - }, - 'messungengrid button[action=delete]': { - click: this.remove - } - }); - }, - - open: function(grid, record) { - //Opens a detailed view of the Messung - var win = Ext.create('Lada.view.window.MessungEdit', { - record: record - }); - win.show(); - win.initData(); - }, - - add: function() { - // TODO - console.log('add'); - }, - - remove: function(button) { - var grid = button.up('grid'); - var selection = grid.getView().getSelectionModel().getSelection()[0]; - Ext.MessageBox.confirm( - 'Messung löschen', - 'Sind Sie sicher?', - function(btn) { - if (btn === 'yes') { - selection.destroy({ - success: function() { - button.up('window').initData(); - }, - failure: function() { - } - }); - } - }); - } -});
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/grid/Messung.js Wed Mar 11 15:21:27 2015 +0100 @@ -0,0 +1,197 @@ +/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=3) + * and comes with ABSOLUTELY NO WARRANTY! Check out + * the documentation coming with IMIS-Labordaten-Application for details. + */ + +/* + * Grid to list Messungen + */ +Ext.define('Lada.view.grid.Messung', { + extend: 'Ext.grid.Panel', + alias: 'widget.messunggrid', + + maxHeight: 350, + emptyText: 'Keine Messungen gefunden', + minHeight: 110, + viewConfig: { + deferEmptyText: false + }, + margin: '0, 5, 5, 5', + + recordId: null, + + warnings: null, + errors: null, + + initComponent: function() { + this.dockedItems = [{ + xtype: 'toolbar', + dock: 'bottom', + items: ['->', { + text: 'Hinzufügen', + icon: 'resources/img/list-add.png', + action: 'add', + probeId: this.probeId + }, { + text: 'Löschen', + icon: 'resources/img/list-remove.png', + action: 'delete' + }] + }]; + this.columns = [{ + header: 'Mess-ID', + dataIndex: 'id', + flex: 1, + editor: { + allowBlank: false + } + }, { + header: 'Nebenproben-Nr.', + dataIndex: 'nebenprobenNr', + flex: 1, + editor: { + allowBlank: false + } + }, { + header: 'MMT', + dataIndex: 'mmtId', + flex: 1, + editor: { + allowBlank: false + } + }, { + header: 'Messzeit', + dataIndex: 'messzeitpunkt', + flex: 2, + editor: { + xtype: 'datefield', + allowBlank: false, + format: 'd.m.Y', + // minValue: '01.01.2001', //todo: gibt es das? + // minText: 'Das Datum der Messung darf nicht vor dem 01.01.2001 liegen.', + maxValue: Ext.Date.format(new Date(), 'd.m.Y') + } + }, { + header: 'Status', + flex: 1, + dataIndex: 'id', + renderer: function(value) { + var id = 'messung-status-item' + value; + this.updateStatus(value, id); + return '<div id="' + id + '">Lade...</div>'; + } + }, { + header: 'OK-Flag', + dataIndex: 'fertig', + flex: 1, + renderer: function(value) { + if (value) { + return 'Ja'; + } + return 'Nein'; + }, + editor: { + xtype: 'checkboxfield', + allowBlank: false + } + }, { + header: 'Anzahl Nuklide', + // Gibt die Anzahl der Messwerte wieder, + // NICHT die Anzahl der verschiedenen Nukleide + // Eventuell ist die Bezeichnug daher irreführend + dataIndex: 'id', + flex: 1, + renderer: function(value) { + var id = 'messung-nuklid-item' + value; + this.updateNuklide(value, id); + return '<div id="' + id + '">Lade...</div>'; + } + }, { + header: 'Anzahl Kommentare', + flex: 1, + dataIndex: 'id', + renderer: function(value) { + var id = 'messung-kommentar-item' + value; + this.updateKommentare(value, id); + return '<div id="' + id + '">Lade...</div>'; + } + }]; + this.initData(); + this.callParent(arguments); + }, + + initData: function() { + this.store = Ext.create('Lada.store.Messungen'); + this.store.load({ + params: { + probeId: this.recordId + } + }); + }, + + updateStatus: function(value, divId) { + var statusStore = Ext.create('Lada.store.Status'); + statusStore.on('load', + this.updateStatusColumn, + this, + {divId: divId}); + statusStore.load({ + params: { + messungsId: value + } + }); + }, + + updateNuklide: function(value, divId) { + var messwerte = Ext.create('Lada.store.Messwerte'); + messwerte.on('load', + this.updateColumn, + this, + {divId: divId}); + messwerte.load({ + params: { + messungsId: value + } + }); + }, + + updateKommentare: function(value, divId) { + var kommentare = Ext.create('Lada.store.MKommentare'); + kommentare.on('load', + this.updateColumn, + this, + {divId: divId}); + kommentare.load({ + params: { + messungsId: value + } + }); + }, + + updateColumn: function(store, record, success, opts) { + var value; + if (store.getTotalCount() === 0) { + value = 'Keine'; + } + else { + value = store.getTotalCount(); + } + Ext.fly(opts.divId).update(value); + }, + + updateStatusColumn: function(sstore, record, success, opts) { + var value; + if (sstore.getTotalCount() === 0) { + value = 'unbekannt'; + } + else { + value = sstore.last().get('status'); + } + if (Ext.fly(opts.divId)) { + Ext.fly(opts.divId).update(value); + } + } +});
--- a/app/view/grid/Messungen.js Wed Mar 11 13:39:04 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,197 +0,0 @@ -/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz - * Software engineering by Intevation GmbH - * - * This file is Free Software under the GNU GPL (v>=3) - * and comes with ABSOLUTELY NO WARRANTY! Check out - * the documentation coming with IMIS-Labordaten-Application for details. - */ - -/* - * Grid to list Messungen - */ -Ext.define('Lada.view.grid.Messungen', { - extend: 'Ext.grid.Panel', - alias: 'widget.messungengrid', - - maxHeight: 350, - emptyText: 'Keine Messungen gefunden', - minHeight: 110, - viewConfig: { - deferEmptyText: false - }, - margin: '0, 5, 5, 5', - - recordId: null, - - warnings: null, - errors: null, - - initComponent: function() { - this.dockedItems = [{ - xtype: 'toolbar', - dock: 'bottom', - items: ['->', { - text: 'Hinzufügen', - icon: 'resources/img/list-add.png', - action: 'add', - probeId: this.probeId - }, { - text: 'Löschen', - icon: 'resources/img/list-remove.png', - action: 'delete' - }] - }]; - this.columns = [{ - header: 'Mess-ID', - dataIndex: 'id', - flex: 1, - editor: { - allowBlank: false - } - }, { - header: 'Nebenproben-Nr.', - dataIndex: 'nebenprobenNr', - flex: 1, - editor: { - allowBlank: false - } - }, { - header: 'MMT', - dataIndex: 'mmtId', - flex: 1, - editor: { - allowBlank: false - } - }, { - header: 'Messzeit', - dataIndex: 'messzeitpunkt', - flex: 2, - editor: { - xtype: 'datefield', - allowBlank: false, - format: 'd.m.Y', - // minValue: '01.01.2001', //todo: gibt es das? - // minText: 'Das Datum der Messung darf nicht vor dem 01.01.2001 liegen.', - maxValue: Ext.Date.format(new Date(), 'd.m.Y') - } - }, { - header: 'Status', - flex: 1, - dataIndex: 'id', - renderer: function(value) { - var id = 'messung-status-item' + value; - this.updateStatus(value, id); - return '<div id="' + id + '">Lade...</div>'; - } - }, { - header: 'OK-Flag', - dataIndex: 'fertig', - flex: 1, - renderer: function(value) { - if (value) { - return 'Ja'; - } - return 'Nein'; - }, - editor: { - xtype: 'checkboxfield', - allowBlank: false - } - }, { - header: 'Anzahl Nuklide', - // Gibt die Anzahl der Messwerte wieder, - // NICHT die Anzahl der verschiedenen Nukleide - // Eventuell ist die Bezeichnug daher irreführend - dataIndex: 'id', - flex: 1, - renderer: function(value) { - var id = 'messung-nuklid-item' + value; - this.updateNuklide(value, id); - return '<div id="' + id + '">Lade...</div>'; - } - }, { - header: 'Anzahl Kommentare', - flex: 1, - dataIndex: 'id', - renderer: function(value) { - var id = 'messung-kommentar-item' + value; - this.updateKommentare(value, id); - return '<div id="' + id + '">Lade...</div>'; - } - }]; - this.initData(); - this.callParent(arguments); - }, - - initData: function() { - this.store = Ext.create('Lada.store.Messungen'); - this.store.load({ - params: { - probeId: this.recordId - } - }); - }, - - updateStatus: function(value, divId) { - var statusStore = Ext.create('Lada.store.Status'); - statusStore.on('load', - this.updateStatusColumn, - this, - {divId: divId}); - statusStore.load({ - params: { - messungsId: value - } - }); - }, - - updateNuklide: function(value, divId) { - var messwerte = Ext.create('Lada.store.Messwerte'); - messwerte.on('load', - this.updateColumn, - this, - {divId: divId}); - messwerte.load({ - params: { - messungsId: value - } - }); - }, - - updateKommentare: function(value, divId) { - var kommentare = Ext.create('Lada.store.MKommentare'); - kommentare.on('load', - this.updateColumn, - this, - {divId: divId}); - kommentare.load({ - params: { - messungsId: value - } - }); - }, - - updateColumn: function(store, record, success, opts) { - var value; - if (store.getTotalCount() === 0) { - value = 'Keine'; - } - else { - value = store.getTotalCount(); - } - Ext.fly(opts.divId).update(value); - }, - - updateStatusColumn: function(sstore, record, success, opts) { - var value; - if (sstore.getTotalCount() === 0) { - value = 'unbekannt'; - } - else { - value = sstore.last().get('status'); - } - if (Ext.fly(opts.divId)) { - Ext.fly(opts.divId).update(value); - } - } -});