Pman.Dialog.XtupleVendorEdit.bjs
authorEdward <edward@roojs.com>
Wed, 15 Jan 2014 05:34:30 +0000 (13:34 +0800)
committerEdward <edward@roojs.com>
Wed, 15 Jan 2014 05:34:30 +0000 (13:34 +0800)
Pman.Dialog.XtupleVendorEdit.js

Pman.Dialog.XtupleVendorEdit.bjs
Pman.Dialog.XtupleVendorEdit.js

index 5f6414e..4c21564 100644 (file)
                         }
                     ]
                 },
+                {
+                    "listeners": {
+                        "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
+                    },
+                    "background": true,
+                    "fitContainer": true,
+                    "fitToframe": true,
+                    "region": "center",
+                    "tableName": "itemsrc",
+                    "title": "Supplier of",
+                    "xtype": "GridPanel",
+                    "|xns": "Roo",
+                    "items": [
+                        {
+                            "listeners": {
+                                "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
+                                "|rowdblclick": "function (_self, rowIndex, e)\n{\n   \n   Pman.Dialog.XtupleItem.show({ item_id  : this.getDataSource().getAt(rowIndex).data.itemsrc_item_id }, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n"
+                            },
+                            "*prop": "grid",
+                            "autoExpandColumn": "itemsrc_vend_item_descrip",
+                            "loadMask": true,
+                            "xtype": "Grid",
+                            "|xns": "Roo.grid",
+                            "items": [
+                                {
+                                    "listeners": {
+                                        "beforeload": "function (_self, options)\n{\n    options.params.itemsrc_vend_id =   _this.form.findField('vend_id').getValue();\n    var s = _this.searchBox.getValue();\n    if (s.length) {\n        options.params['search[name]'] = s;\n    }\n}"
+                                    },
+                                    "*prop": "dataSource",
+                                    "remoteSort": true,
+                                    "xtype": "Store",
+                                    "|sortInfo": "{ field : 'itemsrc_item_id_item_number', direction: 'ASC' }",
+                                    "|xns": "Roo.data",
+                                    "items": [
+                                        {
+                                            "*prop": "proxy",
+                                            "xtype": "HttpProxy",
+                                            "method": "GET",
+                                            "|url": "baseURL + '/Roo/itemsrc.php'",
+                                            "|xns": "Roo.data"
+                                        },
+                                        {
+                                            "|xns": "Roo.data",
+                                            "xtype": "JsonReader",
+                                            "totalProperty": "total",
+                                            "root": "data",
+                                            "*prop": "reader",
+                                            "id": "id",
+                                            "|fields": "[\n    {\n        'name': 'itemsrc_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_item_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_item_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_vend_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_vend_id',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_vend_item_number',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_vend_item_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_comments',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_vend_uom',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_invvendoruomratio',\n        'type': 'float'\n    },\n    {\n        'name': 'itemsrc_minordqty',\n        'type': 'float'\n    },\n    {\n        'name': 'itemsrc_multordqty',\n        'type': 'float'\n    },\n    {\n        'name': 'itemsrc_leadtime',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_ranking',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_active',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_manuf_name',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_manuf_item_number',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_manuf_item_descrip',\n        'type': 'string'\n    },\n    {\n        'name': 'itemsrc_default',\n        'type': 'int'\n    },\n    {\n        'name': 'itemsrc_upccode',\n        'type': 'string'\n    }\n]"
+                                        }
+                                    ]
+                                },
+                                {
+                                    "*prop": "footer",
+                                    "displayInfo": true,
+                                    "displayMsg": "Displaying itemsrc{0} - {1} of {2}",
+                                    "emptyMsg": "No itemsrc found",
+                                    "pageSize": 100,
+                                    "xtype": "PagingToolbar",
+                                    "|xns": "Roo"
+                                },
+                                {
+                                    "*prop": "toolbar",
+                                    "xtype": "Toolbar",
+                                    "|xns": "Roo",
+                                    "items": [
+                                        {
+                                            "listeners": {
+                                                "render": "function (_self)\n{\n    _this.searchBox = _self;\n}",
+                                                "specialkey": "function (_self, e)\n{\n    _this.grid.footer.onClick('first');\n}"
+                                            },
+                                            "xtype": "TextField",
+                                            "|xns": "Roo.form"
+                                        },
+                                        {
+                                            "listeners": {
+                                                "|click": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
+                                            },
+                                            "cls": "x-btn-icon",
+                                            "xtype": "Button",
+                                            "|icon": "rootURL + '/Pman/templates/images/search.gif'",
+                                            "|xns": "Roo.Toolbar"
+                                        },
+                                        {
+                                            "listeners": {
+                                                "|click": "function (_self, e)\n{\n    _this.searchBox.setValue('');\n    \n    _this.grid.footer.onClick('first');\n}"
+                                            },
+                                            "cls": "x-btn-icon",
+                                            "xtype": "Button",
+                                            "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
+                                            "|xns": "Roo.Toolbar"
+                                        },
+                                        {
+                                            "|xns": "Roo.Toolbar",
+                                            "xtype": "Fill"
+                                        },
+                                        {
+                                            "listeners": {
+                                                "|click": "function()\n{\n   \n    Pman.Dialog.XtupleSalesProductList.show({\n        exclude_itemsrc_vendor : _this.form.findField('vend_id').getValue(),\n        multi_select : true\n    \n    }, function(sels) {\n       Roo.log(sels); \n\n       var ids = [];\n       Roo.each(sels,function(rec) {\n            ids.push(rec.data.item_id);\n        });\n        new Pman.Request({\n            mask: \"Adding\",\n            url : baseURL + '/Roo/Itemsrc',\n            method: 'POST',\n            params : {\n                add_multiple : ids.join(','),\n                itemsrc_vend_id : _this.form.findField('vend_id').getValue()\n            },\n            success : function() { \n                \n            \n                  _this.grid.footer.onClick('first');\n          }\n      });\n              \n    \n    });\n   \n}\n"
+                                            },
+                                            "cls": "x-btn-text-icon",
+                                            "text": "Add",
+                                            "xtype": "Button",
+                                            "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+                                            "|xns": "Roo.Toolbar"
+                                        },
+                                        {
+                                            "listeners": {
+                                                "|click": "function()\n{\n     Pman.genericDelete(_this, 'itemsrc'); \n}\n        "
+                                            },
+                                            "cls": "x-btn-text-icon",
+                                            "text": "Delete",
+                                            "xtype": "Button",
+                                            "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
+                                            "|xns": "Roo.Toolbar"
+                                        }
+                                    ]
+                                },
+                                {
+                                    "*prop": "colModel[]",
+                                    "dataIndex": "itemsrc_item_id_item_number",
+                                    "header": "Item",
+                                    "width": 120,
+                                    "xtype": "ColumnModel",
+                                    "|renderer": "function(v) { return String.format('{0}', v); }",
+                                    "|xns": "Roo.grid"
+                                },
+                                {
+                                    "*prop": "colModel[]",
+                                    "dataIndex": "itemsrc_vend_item_number",
+                                    "header": "Vendor item number",
+                                    "width": 120,
+                                    "xtype": "ColumnModel",
+                                    "|renderer": "function(v) { return String.format('{0}', v); }",
+                                    "|xns": "Roo.grid"
+                                },
+                                {
+                                    "*prop": "colModel[]",
+                                    "dataIndex": "itemsrc_vend_item_descrip",
+                                    "header": "Vendor item description",
+                                    "width": 200,
+                                    "xtype": "ColumnModel",
+                                    "|renderer": "function(v) { return String.format('{0}', v); }",
+                                    "|xns": "Roo.grid"
+                                },
+                                {
+                                    "*prop": "colModel[]",
+                                    "dataIndex": "itemsrc_vend_uom",
+                                    "header": "Uom",
+                                    "width": 50,
+                                    "xtype": "ColumnModel",
+                                    "|renderer": "function(v) { return String.format('{0}', v); }",
+                                    "|xns": "Roo.grid"
+                                },
+                                {
+                                    "*prop": "colModel[]",
+                                    "dataIndex": "itemsrc_minordqty",
+                                    "header": "Min ord qty",
+                                    "width": 50,
+                                    "xtype": "ColumnModel",
+                                    "|renderer": "function(v) { return String.format('{0}', v); }",
+                                    "|xns": "Roo.grid"
+                                },
+                                {
+                                    "*prop": "colModel[]",
+                                    "dataIndex": "itemsrc_leadtime",
+                                    "header": "Lead time",
+                                    "width": 75,
+                                    "xtype": "ColumnModel",
+                                    "|renderer": "function(v) { return String.format('{0}', v); }",
+                                    "|xns": "Roo.grid"
+                                },
+                                {
+                                    "*prop": "colModel[]",
+                                    "dataIndex": "itemsrc_active",
+                                    "header": "Active",
+                                    "width": 75,
+                                    "xtype": "ColumnModel",
+                                    "|renderer": "function(v) { return String.format('{0}', v); }",
+                                    "|xns": "Roo.grid"
+                                }
+                            ]
+                        }
+                    ]
+                },
                 {
                     "listeners": {
                         "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
index 8a7a86a..60d1211 100644 (file)
@@ -807,6 +807,329 @@ Pman.Dialog.XtupleVendorEdit = {
                             }
                         ]
                     }
+                },
+                {
+                    xtype: 'GridPanel',
+                    xns: Roo,
+                    listeners : {
+                        activate : function() {
+                            _this.panel = this;
+                            if (_this.grid) {
+                                _this.grid.footer.onClick('first');
+                            }
+                        }
+                    },
+                    background : true,
+                    fitContainer : true,
+                    fitToframe : true,
+                    region : 'center',
+                    tableName : 'itemsrc',
+                    title : "Supplier of",
+                    grid : {
+                        xtype: 'Grid',
+                        xns: Roo.grid,
+                        listeners : {
+                            render : function() 
+                            {
+                                _this.grid = this; 
+                                //_this.dialog = Pman.Dialog.FILL_IN
+                                if (_this.panel.active) {
+                                   this.footer.onClick('first');
+                                }
+                            },
+                            rowdblclick : function (_self, rowIndex, e)
+                            {
+                               
+                               Pman.Dialog.XtupleItem.show({ item_id  : this.getDataSource().getAt(rowIndex).data.itemsrc_item_id }, function() {
+                                    _this.grid.footer.onClick('first');
+                                }); 
+                            }
+                        },
+                        autoExpandColumn : 'itemsrc_vend_item_descrip',
+                        loadMask : true,
+                        dataSource : {
+                            xtype: 'Store',
+                            xns: Roo.data,
+                            listeners : {
+                                beforeload : function (_self, options)
+                                {
+                                    options.params.itemsrc_vend_id =   _this.form.findField('vend_id').getValue();
+                                    var s = _this.searchBox.getValue();
+                                    if (s.length) {
+                                        options.params['search[name]'] = s;
+                                    }
+                                }
+                            },
+                            remoteSort : true,
+                            sortInfo : { field : 'itemsrc_item_id_item_number', direction: 'ASC' },
+                            proxy : {
+                                xtype: 'HttpProxy',
+                                xns: Roo.data,
+                                method : 'GET',
+                                url : baseURL + '/Roo/itemsrc.php'
+                            },
+                            reader : {
+                                xtype: 'JsonReader',
+                                xns: Roo.data,
+                                totalProperty : 'total',
+                                root : 'data',
+                                id : 'id',
+                                fields : [
+                                    {
+                                        'name': 'itemsrc_id',
+                                        'type': 'int'
+                                    },
+                                    {
+                                        'name': 'itemsrc_item_id',
+                                        'type': 'int'
+                                    },
+                                    {
+                                        'name': 'itemsrc_item_id',
+                                        'type': 'int'
+                                    },
+                                    {
+                                        'name': 'itemsrc_vend_id',
+                                        'type': 'int'
+                                    },
+                                    {
+                                        'name': 'itemsrc_vend_id',
+                                        'type': 'int'
+                                    },
+                                    {
+                                        'name': 'itemsrc_vend_item_number',
+                                        'type': 'string'
+                                    },
+                                    {
+                                        'name': 'itemsrc_vend_item_descrip',
+                                        'type': 'string'
+                                    },
+                                    {
+                                        'name': 'itemsrc_comments',
+                                        'type': 'string'
+                                    },
+                                    {
+                                        'name': 'itemsrc_vend_uom',
+                                        'type': 'string'
+                                    },
+                                    {
+                                        'name': 'itemsrc_invvendoruomratio',
+                                        'type': 'float'
+                                    },
+                                    {
+                                        'name': 'itemsrc_minordqty',
+                                        'type': 'float'
+                                    },
+                                    {
+                                        'name': 'itemsrc_multordqty',
+                                        'type': 'float'
+                                    },
+                                    {
+                                        'name': 'itemsrc_leadtime',
+                                        'type': 'int'
+                                    },
+                                    {
+                                        'name': 'itemsrc_ranking',
+                                        'type': 'int'
+                                    },
+                                    {
+                                        'name': 'itemsrc_active',
+                                        'type': 'int'
+                                    },
+                                    {
+                                        'name': 'itemsrc_manuf_name',
+                                        'type': 'string'
+                                    },
+                                    {
+                                        'name': 'itemsrc_manuf_item_number',
+                                        'type': 'string'
+                                    },
+                                    {
+                                        'name': 'itemsrc_manuf_item_descrip',
+                                        'type': 'string'
+                                    },
+                                    {
+                                        'name': 'itemsrc_default',
+                                        'type': 'int'
+                                    },
+                                    {
+                                        'name': 'itemsrc_upccode',
+                                        'type': 'string'
+                                    }
+                                ]
+                            }
+                        },
+                        footer : {
+                            xtype: 'PagingToolbar',
+                            xns: Roo,
+                            displayInfo : true,
+                            displayMsg : "Displaying itemsrc{0} - {1} of {2}",
+                            emptyMsg : "No itemsrc found",
+                            pageSize : 100
+                        },
+                        toolbar : {
+                            xtype: 'Toolbar',
+                            xns: Roo,
+                            items : [
+                                {
+                                    xtype: 'TextField',
+                                    xns: Roo.form,
+                                    listeners : {
+                                        render : function (_self)
+                                        {
+                                            _this.searchBox = _self;
+                                        },
+                                        specialkey : function (_self, e)
+                                        {
+                                            _this.grid.footer.onClick('first');
+                                        }
+                                    }
+                                },
+                                {
+                                    xtype: 'Button',
+                                    xns: Roo.Toolbar,
+                                    listeners : {
+                                        click : function (_self, e)
+                                        {
+                                        _this.grid.footer.onClick('first');
+                                        }
+                                    },
+                                    cls : 'x-btn-icon',
+                                    icon : rootURL + '/Pman/templates/images/search.gif'
+                                },
+                                {
+                                    xtype: 'Button',
+                                    xns: Roo.Toolbar,
+                                    listeners : {
+                                        click : function (_self, e)
+                                        {
+                                            _this.searchBox.setValue('');
+                                            
+                                            _this.grid.footer.onClick('first');
+                                        }
+                                    },
+                                    cls : 'x-btn-icon',
+                                    icon : rootURL + '/Pman/templates/images/edit-clear.gif'
+                                },
+                                {
+                                    xtype: 'Fill',
+                                    xns: Roo.Toolbar
+                                },
+                                {
+                                    xtype: 'Button',
+                                    xns: Roo.Toolbar,
+                                    listeners : {
+                                        click : function()
+                                        {
+                                           
+                                            Pman.Dialog.XtupleSalesProductList.show({
+                                                exclude_itemsrc_vendor : _this.form.findField('vend_id').getValue(),
+                                                multi_select : true
+                                            
+                                            }, function(sels) {
+                                               Roo.log(sels); 
+                                        
+                                               var ids = [];
+                                               Roo.each(sels,function(rec) {
+                                                    ids.push(rec.data.item_id);
+                                                });
+                                                new Pman.Request({
+                                                    mask: "Adding",
+                                                    url : baseURL + '/Roo/Itemsrc',
+                                                    method: 'POST',
+                                                    params : {
+                                                        add_multiple : ids.join(','),
+                                                        itemsrc_vend_id : _this.form.findField('vend_id').getValue()
+                                                    },
+                                                    success : function() { 
+                                                        
+                                                    
+                                                          _this.grid.footer.onClick('first');
+                                                  }
+                                              });
+                                                      
+                                            
+                                            });
+                                           
+                                        }
+                                    },
+                                    cls : 'x-btn-text-icon',
+                                    text : "Add",
+                                    icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
+                                },
+                                {
+                                    xtype: 'Button',
+                                    xns: Roo.Toolbar,
+                                    listeners : {
+                                        click : function()
+                                        {
+                                             Pman.genericDelete(_this, 'itemsrc'); 
+                                        }
+                                    },
+                                    cls : 'x-btn-text-icon',
+                                    text : "Delete",
+                                    icon : rootURL + '/Pman/templates/images/trash.gif'
+                                }
+                            ]
+                        },
+                        colModel : [
+                            {
+                                xtype: 'ColumnModel',
+                                xns: Roo.grid,
+                                dataIndex : 'itemsrc_item_id_item_number',
+                                header : 'Item',
+                                width : 120,
+                                renderer : function(v) { return String.format('{0}', v); }
+                            },
+                            {
+                                xtype: 'ColumnModel',
+                                xns: Roo.grid,
+                                dataIndex : 'itemsrc_vend_item_number',
+                                header : 'Vendor item number',
+                                width : 120,
+                                renderer : function(v) { return String.format('{0}', v); }
+                            },
+                            {
+                                xtype: 'ColumnModel',
+                                xns: Roo.grid,
+                                dataIndex : 'itemsrc_vend_item_descrip',
+                                header : 'Vendor item description',
+                                width : 200,
+                                renderer : function(v) { return String.format('{0}', v); }
+                            },
+                            {
+                                xtype: 'ColumnModel',
+                                xns: Roo.grid,
+                                dataIndex : 'itemsrc_vend_uom',
+                                header : 'Uom',
+                                width : 50,
+                                renderer : function(v) { return String.format('{0}', v); }
+                            },
+                            {
+                                xtype: 'ColumnModel',
+                                xns: Roo.grid,
+                                dataIndex : 'itemsrc_minordqty',
+                                header : 'Min ord qty',
+                                width : 50,
+                                renderer : function(v) { return String.format('{0}', v); }
+                            },
+                            {
+                                xtype: 'ColumnModel',
+                                xns: Roo.grid,
+                                dataIndex : 'itemsrc_leadtime',
+                                header : 'Lead time',
+                                width : 75,
+                                renderer : function(v) { return String.format('{0}', v); }
+                            },
+                            {
+                                xtype: 'ColumnModel',
+                                xns: Roo.grid,
+                                dataIndex : 'itemsrc_active',
+                                header : 'Active',
+                                width : 75,
+                                renderer : function(v) { return String.format('{0}', v); }
+                            }
+                        ]
+                    }
                 }
             ],
             center : {