Pman.Tab.AdminOffice.bjs
[Pman.Admin] / Pman.Tab.AdminOffice.bjs
1 {
2     "id": "roo-file-8",
3     "name": "Pman.Tab.AdminOffice",
4     "parent": "Pman.Tab.AdminCompanies",
5     "title": "Pman.Tab.AdminOffice",
6     "path": "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminOffice.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
11             },
12             "background": true,
13             "fitContainer": true,
14             "fitToframe": true,
15             "region": "south",
16             "tableName": "Office",
17             "title": "Offices / Departments / Sub-Companies",
18             "xtype": "GridPanel",
19             "|xns": "Roo",
20             "items": [
21                 {
22                     "listeners": {
23                         "|render": "function() \n{\n    _this.grid = this; \n    _this.dialog =Pman.Dialog.Office;\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
24                         "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n"
25                     },
26                     "*prop": "grid",
27                     "autoExpandColumn": "name",
28                     "loadMask": true,
29                     "xtype": "Grid",
30                     "|xns": "Roo.grid",
31                     "items": [
32                         {
33                             "listeners": {
34                                 "beforeload": "function (_self, o)\n{\n    try {\n        var sm = Pman.Tab.AdminCompanies.grid.getSelectionModel();\n        sm = sm.getSelected();\n        if (!sm || !sm.data.id) {\n            // mask??\n            return false;\n        }\n               \n        o.params.company_id = sm.data.id ;\n    } catch (e) {\n        return false;\n    }\n    \n    \n }"
35                             },
36                             "*prop": "dataSource",
37                             "remoteSort": true,
38                             "xtype": "Store",
39                             "|sortInfo": "{ field : 'name', direction: 'ASC' }",
40                             "|xns": "Roo.data",
41                             "items": [
42                                 {
43                                     "*prop": "proxy",
44                                     "xtype": "HttpProxy",
45                                     "method": "GET",
46                                     "|url": "baseURL + '/Roo/Office.php'",
47                                     "|xns": "Roo.data"
48                                 },
49                                 {
50                                     "|xns": "Roo.data",
51                                     "xtype": "JsonReader",
52                                     "totalProperty": "total",
53                                     "root": "data",
54                                     "*prop": "reader",
55                                     "id": "id",
56                                     "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'address',\n        'type': 'string'\n    },\n    {\n        'name': 'phone',\n        'type': 'string'\n    },\n    {\n        'name': 'fax',\n        'type': 'string'\n    },\n    {\n        'name': 'email',\n        'type': 'string'\n    },\n    {\n        'name': 'role',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_code',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_address',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_tel',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_isOwner',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_logo_id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_background_color',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_comptype',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_url',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_main_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_created_by',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_created_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'company_id_updated_by',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_updated_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'company_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_dispatch_port',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_province',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_country',\n        'type': 'string'\n    }\n]"
57                                 }
58                             ]
59                         },
60                         {
61                             "*prop": "footer",
62                             "xtype": "PagingToolbar",
63                             "pageSize": 25,
64                             "displayInfo": true,
65                             "displayMsg": "Displaying Office{0} - {1} of {2}",
66                             "emptyMsg": "No Office found",
67                             "|xns": "Roo"
68                         },
69                         {
70                             "*prop": "toolbar",
71                             "xtype": "Toolbar",
72                             "|xns": "Roo",
73                             "items": [
74                                 {
75                                     "listeners": {
76                                         "|click": "function()\n{\n    if (!_this.dialog) return;\n    \n    var cdata = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data;\n    _dialog.show( { \n        id : 0 ,\n        company_name : cdata.name,\n        company_id : cdata.id,\n        address : cdata.address,\n        phone : cdata.tel,\n        fax : cdata.fax,\n        email  : cdata.email\n    } , function() {\n        _this.grid.footer.onClick('first');\n   });\n}\n"
77                                     },
78                                     "cls": "x-btn-text-icon",
79                                     "text": "Add",
80                                     "xtype": "Button",
81                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
82                                     "|xns": "Roo.Toolbar"
83                                 },
84                                 {
85                                     "listeners": {
86                                         "|click": "function()\n{\n    var s = _this.grid.getSelectionModel().getSelections();\n    if (!s.length || (s.length > 1))  {\n        Roo.MessageBox.alert(\"Error\", s.length ? \"Select only one Row\" : \"Select a Row\");\n        return;\n    }\n    if (!_this.dialog) return;\n    s[0].data.company_name = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected().data.name;\n    _this.dialog.show(s[0].data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n    \n}\n"
87                                     },
88                                     "cls": "x-btn-text-icon",
89                                     "text": "Edit",
90                                     "xtype": "Button",
91                                     "|icon": "Roo.rootURL + 'images/default/tree/leaf.gif'",
92                                     "|xns": "Roo.Toolbar"
93                                 },
94                                 {
95                                     "text": "Delete",
96                                     "cls": "x-btn-text-icon",
97                                     "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
98                                     "xtype": "Button",
99                                     "listeners": {
100                                         "|click": "function()\n{\n     Pman.genericDelete(_this, 'Office'); \n}\n        "
101                                     },
102                                     "|xns": "Roo.Toolbar"
103                                 }
104                             ]
105                         },
106                         {
107                             "*prop": "colModel[]",
108                             "dataIndex": "name",
109                             "header": "Name / Department / Sub Comp.",
110                             "sortable": true,
111                             "width": 200,
112                             "xtype": "ColumnModel",
113                             "|renderer": "function(v) { return String.format('{0}', v); }",
114                             "|xns": "Roo.grid"
115                         },
116                         {
117                             "*prop": "colModel[]",
118                             "dataIndex": "phone",
119                             "header": "Phone",
120                             "width": 100,
121                             "xtype": "ColumnModel",
122                             "|renderer": "function(v) { return String.format('{0}', v); }",
123                             "|xns": "Roo.grid"
124                         },
125                         {
126                             "*prop": "colModel[]",
127                             "dataIndex": "fax",
128                             "header": "Fax",
129                             "width": 100,
130                             "xtype": "ColumnModel",
131                             "|renderer": "function(v) { return String.format('{0}', v); }",
132                             "|xns": "Roo.grid"
133                         },
134                         {
135                             "*prop": "colModel[]",
136                             "dataIndex": "email",
137                             "header": "Email",
138                             "width": 200,
139                             "xtype": "ColumnModel",
140                             "|renderer": "function (v) {\n    return (v.length && v.indexOf('@') > 0 ) ? \n        String.format('<a href=\"mailto:{0}\">{0}</a>',v) : v;\n        \n}",
141                             "|xns": "Roo.grid"
142                         },
143                         {
144                             "*prop": "colModel[]",
145                             "dataIndex": "address",
146                             "header": "Address",
147                             "width": 300,
148                             "xtype": "ColumnModel",
149                             "|renderer": "function(v) { return String.format('{0}', v); }",
150                             "|xns": "Roo.grid"
151                         }
152                     ]
153                 }
154             ]
155         }
156     ],
157     "permname": "",
158     "modOrder": "001"
159 }