Start of inventory app page.
[htsworkflow.git] / htsworkflow / frontend / static / js / htsw.js
index 7df0d3a456baf42a63c9833cefcd8e16e5017181..72bead1dde34278b0451c05d6053b28df8a604d4 100644 (file)
@@ -24,11 +24,14 @@ var goto_url = function(www_url)
 $(document).ready(function(){
     //----------------------------------------
     // Django Library Page CSS Fix
-    /*var fix_library_css = function() {
-      Ext.fly('library-index-div').select('*').addClass('djangocss');
+    var fix_library_css = function() {
+      var tofix = Ext.fly('library-index-div');
+      if (tofix != null)
+      {
+       tofix.select('*').addClass('djangocss');
+      }
     }
     fix_library_css();
-    */
     
     
     //----------------------------------------
@@ -87,14 +90,26 @@ $(document).ready(function(){
        items: create_dynamic_panels().concat([panel_bcmagic])
     });
     
+    
+    
+    //-------------------------------
+    // East Region Setup
+    //-------------------------------
     var get_east_panel_content = function(){
       // East panel contentEl id is supplied in html div id of east_region_config.
       var east_id = Ext.fly('east_region_config').dom.textContent;
       
+      // Length of zero is a valid response... also happens to return null in next
+      //   if statement if not handled before hand.
+      if (east_id.length == 0){
+       return east_id;
+      }
+      
       // If no element exists with the supplied content id, report and error.
       if (Ext.fly(east_id) == null){
        return 'east_region_config_error';
       }
+      
       return east_id;
     }
     
@@ -160,14 +175,17 @@ $(document).ready(function(){
                    height: 30
                    //margins: '2 0 0 0'
                }],
-           height: 90
+           height: 90,
+           collapsible: true,
+           collapseMode: 'mini',
+           split: true
        },menuPanel,{
             //title: 'Body',
             region: 'center',
             xtype: 'panel',
            //autoScroll: true,
             layout: 'fit',
-            margins: '2 2 2 0',
+            margins: '2 0 2 0',
             items: [{
                 //title: 'Inner Panel',
                 contentEl: 'body_content',
@@ -205,6 +223,24 @@ $(document).ready(function(){
     
     // Shifts the remaining toolbar options to the right side.
     main_tb.add({ xtype: 'tbfill' });
+    
+    //----------------------------------------
+    // ExtJS Barcode Magic Implementation
+    var bcmagic_ext_keyhandler = function(sObj, e){
+      //Process upon enter key as input.
+      if (e.getKey() == e.ENTER)
+       bcmagic_process();
+    }
+    
+    var bcmagic_input = new Ext.form.TextField({
+      id: 'bcmagic_input_field',
+      emptyText: 'barcode magic'
+    });
+    bcmagic_input.on('specialkey', bcmagic_ext_keyhandler);
+    
+    main_tb.add(bcmagic_input);
+    //--------------------------------------
+    
     var user_info = Ext.fly('login_info');
     var logout_url = user_info.getAttribute('logouturl');
     var login_url = user_info.getAttribute('loginurl');
@@ -240,5 +276,13 @@ $(document).ready(function(){
     add_buttons_from_html(app_tb, 'app_toolbar_east');
     app_tb.doLayout();
     
+    // Focus on barcode magic, because it's awesome and needs attention! ;-)
+    bcmagic_input.focus();
     
+    // FIXME: grid target temp code.
+    var grid_target = Ext.fly('grid_target');
+    if (grid_target != null){
+      var grid = getInventoryDataGrid();
+      grid.render(grid_target);
+    }
 });
\ No newline at end of file