sync
[Pman.Admin] / Pman.Tab.AdminOffice.bjs
1 {
2  "name" : "Pman.Tab.AdminOffice",
3  "parent" : "Pman.Tab.AdminCompanies",
4  "title" : "Pman.Tab.AdminOffice",
5  "path" : "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminOffice.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "ce8ae9da5b7cd6c3df2929543a9af92d" : "Email",
10   "ec211f7c20af43e742bf2570c3cb84f9" : "Add",
11   "14820f8c54725a56438e99f6bd57dfa3" : "Displaying Office{0} - {1} of {2}",
12   "7dce122004969d56ae2e0245cb754d35" : "Edit",
13   "7407f706267593de473324b2c07ef2fc" : "Offices / Departments / Sub-Companies",
14   "217574e21514de41ec31aaf5ddadb2c3" : "No Office found",
15   "bcc254b55c4a1babdf1dcb82c207506b" : "Phone",
16   "a8fa7984f57a42bb41143f3d7665bd36" : "Name / Department / Sub Comp.",
17   "f2a6c498fb90ee345d997f888fce3b18" : "Delete",
18   "dd7bf230fde8d4836917806aff6a6b27" : "Address",
19   "9810aa2b9f44401be4bf73188ef2b67d" : "Fax"
20  },
21  "items" : [
22   {
23    "listeners" : {
24     "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
25    },
26    "region" : "south",
27    "fitToframe" : true,
28    "background" : true,
29    "title" : "Offices / Departments / Sub-Companies",
30    "xtype" : "GridPanel",
31    "fitContainer" : true,
32    "$ xns" : "Roo",
33    "tableName" : "Office",
34    "items" : [
35     {
36      "listeners" : {
37       "|rowdblclick" : "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) { \n        return; \n    }\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n",
38       "|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}"
39      },
40      "autoExpandColumn" : "name",
41      "xtype" : "Grid",
42      "loadMask" : true,
43      "$ xns" : "Roo.grid",
44      "* prop" : "grid",
45      "items" : [
46       {
47        "listeners" : {
48         "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 }"
49        },
50        "xtype" : "Store",
51        "remoteSort" : true,
52        "$ sortInfo" : "{ field : 'name', direction: 'ASC' }",
53        "$ xns" : "Roo.data",
54        "* prop" : "dataSource",
55        "items" : [
56         {
57          "$ url" : "baseURL + '/Roo/core_office.php'",
58          "method" : "GET",
59          "xtype" : "HttpProxy",
60          "$ xns" : "Roo.data",
61          "* prop" : "proxy"
62         },
63         {
64          "id" : "id",
65          "root" : "data",
66          "xtype" : "JsonReader",
67          "$ xns" : "Roo.data",
68          "$ 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]",
69          "* prop" : "reader",
70          "totalProperty" : "total"
71         }
72        ]
73       },
74       {
75        "pageSize" : 25,
76        "xtype" : "PagingToolbar",
77        "emptyMsg" : "No Office found",
78        "$ xns" : "Roo",
79        "displayInfo" : true,
80        "displayMsg" : "Displaying Office{0} - {1} of {2}",
81        "* prop" : "footer"
82       },
83       {
84        "xtype" : "Toolbar",
85        "$ xns" : "Roo",
86        "* prop" : "toolbar",
87        "items" : [
88         {
89          "listeners" : {
90           "|click" : "function()\n{\n    if (!_this.dialog) {\n     return;\n    }\n    var sd = Pman.Tab.AdminCompanies.grid.getSelectionModel().getSelected();\n    if (!sd) {\n        Roo.MessageBox.alert(\"Error\", \"Select an company to add an office to\");\n        return;\n    }\n    var cdata = sd.data;\n    _this. 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}"
91          },
92          "text" : "Add",
93          "xtype" : "Button",
94          "cls" : "x-btn-text-icon",
95          "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
96          "$ xns" : "Roo.Toolbar"
97         },
98         {
99          "listeners" : {
100           "|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) {\n        return;\n    }\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"
101          },
102          "text" : "Edit",
103          "xtype" : "Button",
104          "cls" : "x-btn-text-icon",
105          "$ icon" : "Roo.rootURL + 'images/default/tree/leaf.gif'",
106          "$ xns" : "Roo.Toolbar"
107         },
108         {
109          "listeners" : {
110           "|click" : "function()\n{\n     Pman.genericDelete(_this, 'Office'); \n}\n        "
111          },
112          "text" : "Delete",
113          "xtype" : "Button",
114          "cls" : "x-btn-text-icon",
115          "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
116          "$ xns" : "Roo.Toolbar"
117         }
118        ]
119       },
120       {
121        "xtype" : "ColumnModel",
122        "sortable" : true,
123        "header" : "Name / Department / Sub Comp.",
124        "width" : 200,
125        "$ renderer" : "function(v) { return String.format('{0}', v); }",
126        "$ xns" : "Roo.grid",
127        "* prop" : "colModel[]",
128        "dataIndex" : "name"
129       },
130       {
131        "xtype" : "ColumnModel",
132        "header" : "Phone",
133        "width" : 100,
134        "$ renderer" : "function(v) { return String.format('{0}', v); }",
135        "$ xns" : "Roo.grid",
136        "* prop" : "colModel[]",
137        "dataIndex" : "phone"
138       },
139       {
140        "xtype" : "ColumnModel",
141        "header" : "Fax",
142        "width" : 100,
143        "$ renderer" : "function(v) { return String.format('{0}', v); }",
144        "$ xns" : "Roo.grid",
145        "* prop" : "colModel[]",
146        "dataIndex" : "fax"
147       },
148       {
149        "xtype" : "ColumnModel",
150        "header" : "Email",
151        "width" : 200,
152        "$ renderer" : "function (v) {\n    return (v.length && v.indexOf('@') > 0 ) ? \n        String.format('<a href=\"mailto:{0}\">{0}</a>',v) : v;\n        \n}",
153        "$ xns" : "Roo.grid",
154        "* prop" : "colModel[]",
155        "dataIndex" : "email"
156       },
157       {
158        "xtype" : "ColumnModel",
159        "header" : "Address",
160        "width" : 300,
161        "$ renderer" : "function(v) { return String.format('{0}', v); }",
162        "$ xns" : "Roo.grid",
163        "* prop" : "colModel[]",
164        "dataIndex" : "address"
165       }
166      ]
167     }
168    ]
169   }
170  ]
171 }