changeset 170:738d657d8b6b

Added Status into Messungen listing.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Wed, 03 Jul 2013 16:08:22 +0200
parents 52d105d4e93f
children c5422819d7b9
files app/model/Status.js app/store/Status.js app/view/messungen/List.js
diffstat 3 files changed, 56 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/model/Status.js	Wed Jul 03 16:08:22 2013 +0200
@@ -0,0 +1,33 @@
+Ext.define('Lada.model.Status', {
+    extend: 'Ext.data.Model',
+    fields: [
+        {name: "sId"},
+        {name: "messungsId"},
+        {name: "probeId"},
+        {name: "erzeuger"},
+        {name: "status"},
+        {name: "sdatum", type: 'date', convert: ts2date, defaultValue: new Date()},
+        {name: "stext"}
+    ],
+    idProperty: "sId",
+    proxy: {
+        type: 'rest',
+        appendId: true, //default
+        url: 'server/rest/status',
+        reader: {
+            type: 'json',
+            root: 'data'
+        }
+    },
+    getEidi: function() {
+        var sid =  this.get('sId');
+        var messId = this.get('messungsId');
+        var probeId = this.get('probeId');
+        return "/" + sid + "/" + messId + "/" + probeId;
+    }
+});
+
+function ts2date(v, record){
+    // Converts a timestamp into a date object.
+    return new Date(v);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/store/Status.js	Wed Jul 03 16:08:22 2013 +0200
@@ -0,0 +1,5 @@
+Ext.define('Lada.store.Status', {
+    extend: 'Ext.data.Store',
+    model: 'Lada.model.Status'
+});
+
--- a/app/view/messungen/List.js	Wed Jul 03 16:06:51 2013 +0200
+++ b/app/view/messungen/List.js	Wed Jul 03 16:08:22 2013 +0200
@@ -34,7 +34,24 @@
             {header: 'NPR-Nr.', dataIndex: "nebenprobenNr", width: 50},
             {header: 'MMT', dataIndex: "mmtId", width: 50},
             {header: 'Messzeit', dataIndex: "messdauer"},
-            {header: 'Status'},
+            {
+                header: 'Status',
+                dataIndex: 'id',
+                renderer: function(value) {
+                    var sstore = Ext.getStore('Status');
+                    sstore.load({
+                        params: {
+                            probeId: value.probeId,
+                            messungsId: value.messungsId
+                        }
+                    });
+                    if (sstore.getTotalCount() === 0) {
+                        return "unbekannt";
+                    } else {
+                        return sstore.last().get('status');
+                    }
+                }
+            },
             {header: 'OK-Flag', dataIndex: "fertig"},
             {
                 header: 'Anzahl Nuklide',

http://lada.wald.intevation.org