torsten@472: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz torsten@472: * Software engineering by Intevation GmbH torsten@472: * torsten@472: * This file is Free Software under the GNU GPL (v>=3) torsten@472: * and comes with ABSOLUTELY NO WARRANTY! Check out raimund@502: * the documentation coming with IMIS-Labordaten-Application for details. torsten@472: */ torsten@472: torsten@343: /* torsten@343: * Grid to list Messungen torsten@343: */ raimund@502: Ext.define('Lada.view.messungen.List', { torsten@103: extend: 'Ext.grid.Panel', torsten@103: alias: 'widget.messungenlist', raimund@491: torsten@103: store: 'Messungen', torsten@103: viewConfig: { torsten@103: maxHeight: 350, torsten@103: emptyText: 'Keine Messungen gefunden.', torsten@103: // minHeight and deferEmptyText are needed to be able to show the torsten@103: // emptyText message. torsten@103: minHeight: 35, torsten@103: deferEmptyText: false torsten@103: }, raimund@491: torsten@172: probeId: null, raimund@491: torsten@103: initComponent: function() { roland@511: var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { roland@511: clicksToMoveEditor: 1, roland@511: autoCancel: false roland@511: }); roland@511: this.plugins = [rowEditing]; raimund@491: this.dockedItems = [{ raimund@491: xtype: 'toolbar', raimund@513: dock: 'bottom', raimund@513: items: ['->', { raimund@491: text: 'Hinzufügen', raimund@491: icon: 'gfx/list-add.png', raimund@491: action: 'add', raimund@491: probeId: this.probeId raimund@491: }, { raimund@491: text: 'Löschen', raimund@491: icon: 'gfx/list-remove.png', raimund@491: action: 'delete' roland@511: }, { roland@511: text: 'Öffnen', roland@511: icon: 'gfx/document-open.png', roland@511: action: 'open' raimund@491: }] raimund@491: }]; raimund@491: this.columns = [{ raimund@491: header: 'Mess.ID', roland@511: editor: { roland@511: allowBlank: false roland@511: }, raimund@502: dataIndex: 'id', raimund@491: width: 50 raimund@491: }, { raimund@491: header: 'NPR-Nr.', roland@511: editor: { roland@511: allowBlank: false roland@511: }, raimund@502: dataIndex: 'nebenprobenNr', raimund@491: width: 50 raimund@491: }, { raimund@491: header: 'MMT', roland@511: editor: { roland@511: allowBlank: false roland@511: }, raimund@502: dataIndex: 'mmtId', raimund@491: width: 50 raimund@491: }, { raimund@491: header: 'Messzeit', roland@511: editor: { roland@511: xtype: 'datefield', roland@511: allowBlank: false, roland@511: format: 'd.m.Y', roland@511: minValue: '01.01.2001', // TODO: gibt es ein minValue? roland@511: //minText: 'Fehlertext', // TODO: Fehlertext falls minValue roland@511: maxValue: Ext.Date.format(new Date(), 'd.m.Y') roland@511: }, raimund@502: dataIndex: 'messzeitpunkt' raimund@491: }, { raimund@491: header: 'Status', raimund@491: dataIndex: 'id', raimund@502: width: 50, raimund@491: renderer: function(value) { raimund@491: var sstore = Ext.getStore('Status'); raimund@491: sstore.load({ raimund@491: params: { raimund@491: probeId: value.probeId, raimund@491: messungsId: value.id torsten@103: } raimund@491: }); raimund@491: if (sstore.getTotalCount() === 0) { raimund@502: return 'unbekannt'; torsten@164: } raimund@502: return sstore.last().get('status'); roland@511: }, roland@511: editor: { roland@511: xtype: 'numberfield', raimund@513: allowBlank: false torsten@164: } raimund@491: }, { raimund@491: header: 'OK-Flag', raimund@502: dataIndex: 'fertig', raimund@502: width: 50, raimund@491: renderer: function(value) { raimund@491: if (value) { raimund@502: return 'Ja'; raimund@491: } raimund@502: return 'Nein'; roland@511: }, roland@511: editor: { roland@511: xtype: 'checkboxfield', raimund@513: allowBlank: false raimund@491: } raimund@491: }, { raimund@491: header: 'Anzahl Nuklide', raimund@491: dataIndex: 'id', raimund@491: renderer: function(value) { raimund@491: var mstore = Ext.getStore('Messwerte'); raimund@491: mstore.load({ raimund@491: params: { raimund@491: probeId: value.probeId, raimund@491: messungsId: value.id raimund@491: } raimund@491: }); raimund@491: return mstore.getTotalCount(); raimund@491: } raimund@491: }, { raimund@491: header: 'Anzahl Kommentare', raimund@491: flex: 1, raimund@491: dataIndex: 'id', raimund@491: renderer: function(value) { raimund@491: var kstore = Ext.getStore('KommentareM'); raimund@491: kstore.load({ raimund@491: params: { raimund@491: probeId: value.probeId, raimund@491: messungsId: value.id raimund@491: } raimund@491: }); raimund@491: return kstore.getTotalCount(); raimund@491: } raimund@491: }]; torsten@103: this.callParent(arguments); torsten@103: } torsten@103: });