changeset 965:a2c2039bb5d9

Disabled StatusGrid Edit when StatusEdit ist false, Load StatuswerteStore differently, removed a bunch of trailing commas
author Dustin Demuth <dustin@intevation.de>
date Thu, 12 Nov 2015 14:25:07 +0100
parents 5b86baa038bc
children 6e67eb947258
files app.js app/controller/grid/Status.js app/model/Messung.js app/model/Status.js app/store/StatusStufe.js app/store/StatusWerte.js app/view/form/Messung.js app/view/grid/Status.js app/view/window/MessungEdit.js
diffstat 9 files changed, 49 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/app.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app.js	Thu Nov 12 14:25:07 2015 +0100
@@ -157,10 +157,12 @@
             storeId: 'verwaltungseinheiten'
         });
         Ext.create('Lada.store.StatusWerte', {
-            storeId: 'statuswerte'
+            storeId: 'statuswerte',
+            autoLoad: true
         });
         Ext.create('Lada.store.StatusStufe', {
-            storeId: 'statusstufe'
+            storeId: 'statusstufe',
+            autoLoad: 'true'
         });
     },
 
--- a/app/controller/grid/Status.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app/controller/grid/Status.js	Thu Nov 12 14:25:07 2015 +0100
@@ -94,6 +94,7 @@
 
         //retrieve the readOnly parameters
         var readonlyWin = context.view.up('window').record.get('readonly');
+        //var statusEdit = context.view.up('window').record.get('statusEdit');
 
         var readonlyRec = record.get('readonly');
         var grid = context.view.up('grid');
--- a/app/model/Messung.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app/model/Messung.js	Thu Nov 12 14:25:07 2015 +0100
@@ -22,6 +22,10 @@
         type: 'boolean',
         persist: false
     }, {
+        name: 'statusEdit',
+        type: 'boolean',
+        persist: false
+    }, {
         name: 'probeId'
     }, {
         name: 'mmtId'
@@ -39,7 +43,7 @@
         },
         defaultValue: new Date()
     }, {
-        name: 'status',
+        name: 'status'
     }, {
         name: 'fertig',
         type: 'boolean'
--- a/app/model/Status.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app/model/Status.js	Thu Nov 12 14:25:07 2015 +0100
@@ -20,7 +20,7 @@
         persist: false
     }, {
         name: 'owner',
-        type: 'boolean',
+        type: 'boolean'
     }, {
         name: 'messungsId'
     }, {
--- a/app/store/StatusStufe.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app/store/StatusStufe.js	Thu Nov 12 14:25:07 2015 +0100
@@ -12,6 +12,6 @@
 Ext.define('Lada.store.StatusStufe', {
     extend: 'Ext.data.Store',
     model: 'Lada.model.StatusStufe',
-    autoLoad: true,
+    autoLoad: false
 });
 
--- a/app/store/StatusWerte.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app/store/StatusWerte.js	Thu Nov 12 14:25:07 2015 +0100
@@ -12,5 +12,5 @@
 Ext.define('Lada.store.StatusWerte', {
     extend: 'Ext.data.Store',
     model: 'Lada.model.StatusWerte',
-    autoLoad: true,
+    autoLoad: false
 });
--- a/app/view/form/Messung.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app/view/form/Messung.js	Thu Nov 12 14:25:07 2015 +0100
@@ -128,7 +128,7 @@
                     preventMark: true, //Do not display error msg.
                     validateValue: function() {
                         return true; //this field is always valid
-                    },
+                    }
                 }, {
                     xtype: 'textfield',
                     name: 'stufe',
@@ -144,7 +144,7 @@
                     preventMark: true, //Do not display error msg.
                     validateValue: function() {
                         return true; //this field is always valid
-                    },
+                    }
                 }]
             }]
         }];
@@ -209,6 +209,7 @@
         if (!swStore) {
             //Set the textfield asynchronously
             swStore = Ext.create('Lada.store.StatusWerte');
+            console.log('loading sw store messungform');
             swStore.load({
                 scope: this,
                 callback: function(records, operation, success) {
@@ -221,7 +222,7 @@
                     if (textfield) {
                         textfield.setRawValue(msg);
                     }
-                },
+                }
             });
         }
         else {
@@ -260,7 +261,7 @@
                     if (textfield) {
                         textfield.setRawValue(msg);
                     }
-                },
+                }
             });
         }
         else {
--- a/app/view/grid/Status.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app/view/grid/Status.js	Thu Nov 12 14:25:07 2015 +0100
@@ -72,7 +72,7 @@
             xtype: 'datecolumn',
             format: 'd.m.Y H:i',
             width: 110,
-            sortable: false,
+            sortable: false
         }, {
             header: 'Erzeuger',
             dataIndex: 'erzeuger',
@@ -96,7 +96,7 @@
                 allowBlank: false,
                 editable: false
             },
-            sortable: false,
+            sortable: false
         }, {
             header: 'Stufe',
             dataIndex: 'statusStufe',
@@ -112,7 +112,7 @@
                 }
                 return r;
             },
-            sortable: false,
+            sortable: false
         }, {
             header: 'Status',
             dataIndex: 'statusWert',
@@ -137,7 +137,7 @@
                 allowBlank: false,
                 editable: false
             },
-            sortable: false,
+            sortable: false
         }, {
             header: 'Text',
             dataIndex: 'text',
@@ -147,7 +147,7 @@
                 maxLength: 1000,
                 enforceMaxLength: true
             },
-            sortable: false,
+            sortable: false
         }];
         this.initData();
         this.callParent(arguments);
--- a/app/view/window/MessungEdit.js	Thu Nov 12 12:19:02 2015 +0100
+++ b/app/view/window/MessungEdit.js	Thu Nov 12 14:25:07 2015 +0100
@@ -171,6 +171,13 @@
                 else {
                     this.enableForm();
                 }
+                //Check if it is allowed to edit Status
+                if (this.record.get('statusEdit') === true) {
+                    this.enableStatusEdit();
+                }
+                else {
+                    this.disableStatusEdit();
+                }
             },
             scope: this
         });
@@ -200,10 +207,9 @@
     disableChildren: function() {
             this.down('fset[name=messwerte]').down('messwertgrid').setReadOnly(true);
             this.down('fset[name=messwerte]').down('messwertgrid').readOnly = true;
-            this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(true);
-            this.down('fset[name=messungstatus]').down('statusgrid').readOnly = true;
             this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(true);
             this.down('fset[name=messungskommentare]').down('mkommentargrid').readOnly = true;
+            this.disableStatusEdit();
     },
 
     /**
@@ -212,11 +218,26 @@
     enableChildren: function() {
             this.down('fset[name=messwerte]').down('messwertgrid').setReadOnly(false);
             this.down('fset[name=messwerte]').down('messwertgrid').readOnly = false;
+            this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(false);
+            this.down('fset[name=messungskommentare]').down('mkommentargrid').readOnly = false;
+            this.enableStatusEdit();
+    },
+
+    /**
+     * Enable to edit the statusgrid
+     */
+     enableStatusEdit: function () {
             this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(false);
             this.down('fset[name=messungstatus]').down('statusgrid').readOnly = false;
-            this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(false);
-            this.down('fset[name=messungskommentare]').down('mkommentargrid').readOnly = false;
-    },
+     },
+
+    /**
+     * Disable to edit the statusgrid
+     */
+     disableStatusEdit: function () {
+            this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(true);
+            this.down('fset[name=messungstatus]').down('statusgrid').readOnly = true;
+     },
 
     /**
      * Instructs the fields / forms listed in this method to set a message.

http://lada.wald.intevation.org