Pman.Dialog.AdminEnumImages.bjs
[Pman.Admin] / Pman.Dialog.AdminEnumImages.bjs
1 {
2     "id": "roo-file-266",
3     "name": "Pman.Dialog.AdminEnumImages",
4     "parent": "",
5     "title": "",
6     "path": "/home/chris/gitlive/Pman.Admin/Pman.Dialog.AdminEnumImages.bjs",
7     "items": [
8         {
9             "|xns": "Roo",
10             "xtype": "LayoutDialog",
11             "items": [
12                 {
13                     "|xns": "Roo",
14                     "xtype": "LayoutRegion",
15                     "*prop": "center"
16                 },
17                 {
18                     "listeners": {
19                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
20                     },
21                     "background": true,
22                     "fitContainer": true,
23                     "fitToframe": true,
24                     "region": "center",
25                     "tableName": "Companies",
26                     "title": "Outlets",
27                     "xtype": "GridPanel",
28                     "|xns": "Roo",
29                     "items": [
30                         {
31                             "listeners": {
32                                 "|render": "function() \n{\n    _this.grid = this; \n    _this.dialog = Pman.Dialog.PrettybookedOutlet;\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
33                                 "|rowdblclick": "function (_self, rowIndex, e)\n{\n    //_this.dialog = Pman.Dialog.PrettybookOutlet;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n",
34                                 "cellclick": "function (_self, rowIndex, columnIndex, e)\n{\n    var di = this.colModel.getDataIndex(columnIndex);\n    if (di == 'is_active' || di == 'is_allow_booking') {\n\n        var rec = _this.grid.ds.getAt(rowIndex);\n        if(di == 'is_active'){\n            rec.set('is_active', rec.data.is_active ? 0 : 1);\n        }else{\n            rec.set('is_allow_booking', rec.data.is_allow_booking ? 0 : 1);\n        }\n        rec.commit();\n    }else{\n        return;\n    }\n    \n}",
35                                 "afteredit": "function (e)\n{\n   e.record.commit();     \n}"
36                             },
37                             "*prop": "grid",
38                             "clicksToEdit": 1,
39                             "loadMask": true,
40                             "xtype": "EditorGrid",
41                             "|xns": "Roo.grid",
42                             "items": [
43                                 {
44                                     "listeners": {
45                                         "beforeload": "function (_self, options)\n{\n    options.params = options.params || {};\n    options.params.comptype='Outlet';\n    options.params._search = _this.searchBox.getValue();\n    for(var k in _this.pagetype) {\n        if (!_this.pagetype[k].pressed) {\n            continue;\n        }\n        switch(k) {\n            case 'new':\n                options.params.is_active = 0;\n                break;\n            case 'all':\n                options.params.is_active = 1 ;\n                break;\n        }\n    \n    }\n}",
46                                         "update": "function (_self, record, operation)\n{\n    if (operation != Roo.data.Record.COMMIT) {\n        return;\n    }\n    // got commit..\n    if(record.data.id > 0){\n        new Pman.Request({\n            url : baseURL + '/Roo/Companies.php',\n            method : 'POST',\n            params : {\n                id : record.data.id,\n                is_active : record.data.is_active,\n                owner_id_active_by : record.data.is_active ? 2 : 0,\n                is_allow_booking : record.data.is_allow_booking\n            }, \n            success : function(res) {\n                //Roo.log(data);\n                // update the ID if it's not set..\n                if (record.data.id * 1 < 1) {\n                    record.set('id', res.data.id);\n                }\n                // no need to reload this..\n                //_this.grid.getDataSource().load({});\n            }\n        });\n    }\n    \n}"
47                                     },
48                                     "*prop": "dataSource",
49                                     "remoteSort": true,
50                                     "xtype": "Store",
51                                     "|sortInfo": "{ field : 'created_dt', direction: 'DESC' }",
52                                     "|xns": "Roo.data",
53                                     "items": [
54                                         {
55                                             "*prop": "proxy",
56                                             "method": "GET",
57                                             "xtype": "HttpProxy",
58                                             "|url": "baseURL + '/Roo/Companies.php'",
59                                             "|xns": "Roo.data"
60                                         },
61                                         {
62                                             "*prop": "reader",
63                                             "id": "id",
64                                             "root": "data",
65                                             "totalProperty": "total",
66                                             "xtype": "JsonReader",
67                                             "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'code',\n        'type': 'string'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'address',\n        'type': 'string'\n    },\n    {\n        'name': 'tel',\n        'type': 'string'\n    },\n    {\n        'name': 'fax',\n        'type': 'string'\n    },\n    {\n        'name': 'email',\n        'type': 'string'\n    },\n    {\n        'name': 'isOwner',\n        'type': 'int'\n    },\n    {\n        'name': 'logo_id',\n        'type': 'int'\n    },\n    {\n        'name': 'background_color',\n        'type': 'string'\n    },\n    {\n        'name': 'comptype',\n        'type': 'string'\n    },\n    {\n        'name': 'url',\n        'type': 'string'\n    },\n    {\n        'name': 'main_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'created_by',\n        'type': 'int'\n    },\n    {\n        'name': 'created_dt',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'updated_by',\n        'type': 'int'\n    },\n    {\n        'name': 'updated_dt',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'dispatch_port',\n        'type': 'string'\n    },\n    {\n        'name': 'province',\n        'type': 'string'\n    },\n    {\n        'name': 'country',\n        'type': 'string'\n    },\n    {\n        'name': 'description',\n        'type': 'string'\n    },\n    {\n        'name': 'district_id',\n        'type': 'int'\n    },\n    {\n        'name': 'rating_average',\n        'type': 'float'\n    },\n    {\n        'name': 'rating_count',\n        'type': 'int'\n    },\n    {\n        'name': 'reviews_count',\n        'type': 'int'\n    },\n    {\n        'name': 'tel_other',\n        'type': 'string'\n    },\n    {\n        'name': 'is_active',\n        'type': 'int'\n    },\n    {\n        'name': 'is_allow_booking',\n        'type': 'int'\n    },\n    {\n        'name': 'price_range_min',\n        'type': 'float'\n    },\n    {\n        'name': 'price_range_max',\n        'type': 'float'\n    },\n    {\n        'name': 'favoured_value',\n        'type': 'int'\n    },\n    {\n        'name': 'logo_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'logo_id_filename',\n        'type': 'string'\n    },\n    {\n        'name': 'logo_id_ontable',\n        'type': 'string'\n    },\n    {\n        'name': 'logo_id_onid',\n        'type': 'int'\n    },\n    {\n        'name': 'logo_id_mimetype',\n        'type': 'string'\n    },\n    {\n        'name': 'logo_id_width',\n        'type': 'int'\n    },\n    {\n        'name': 'logo_id_height',\n        'type': 'int'\n    },\n    {\n        'name': 'logo_id_filesize',\n        'type': 'int'\n    },\n    {\n        'name': 'logo_id_displayorder',\n        'type': 'int'\n    },\n    {\n        'name': 'logo_id_language',\n        'type': 'string'\n    },\n    {\n        'name': 'logo_id_parent_image_id',\n        'type': 'int'\n    },\n    {\n        'name': 'logo_id_created',\n        'type': 'date'\n    },\n    {\n        'name': 'logo_id_imgtype',\n        'type': 'string'\n    },\n    {\n        'name': 'logo_id_linkurl',\n        'type': 'string'\n    },\n    {\n        'name': 'logo_id_descript',\n        'type': 'string'\n    },\n    {\n        'name': 'logo_id_title',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_deleted_by',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_deleted_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'main_office_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'main_office_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'main_office_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'main_office_id_address',\n        'type': 'string'\n    },\n    {\n        'name': 'main_office_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'main_office_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'main_office_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'main_office_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'district_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'district_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'district_id_parent_id',\n        'type': 'int'\n    },\n    {\n        'name': 'district_id_priority',\n        'type': 'int'\n    },\n    {\n        'name': 'district_id_created_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'district_id_updated_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'district_id_is_active',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_parent_id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_priority',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_created_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'company_id_updated_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'company_id_is_active',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_top_id',\n        'type': 'int'\n    }\n]",
68                                             "|xns": "Roo.data"
69                                         }
70                                     ]
71                                 },
72                                 {
73                                     "*prop": "footer",
74                                     "xtype": "PagingToolbar",
75                                     "pageSize": 25,
76                                     "displayInfo": true,
77                                     "displayMsg": "Displaying Companies{0} - {1} of {2}",
78                                     "emptyMsg": "No Companies found",
79                                     "|xns": "Roo"
80                                 },
81                                 {
82                                     "*prop": "toolbar",
83                                     "xtype": "Toolbar",
84                                     "|xns": "Roo",
85                                     "items": [
86                                         {
87                                             "listeners": {
88                                                 "render": "function (_self)\n{\n_this.searchBox=  _self;\n}",
89                                                 "specialkey": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
90                                             },
91                                             "xtype": "TextField",
92                                             "|xns": "Roo.form"
93                                         },
94                                         {
95                                             "listeners": {
96                                                 "|click": "function (_self, e)\n{\n_this.grid.footer.onClick('first');\n}"
97                                             },
98                                             "cls": "x-btn-icon",
99                                             "xtype": "Button",
100                                             "|icon": "rootURL + '/Pman/templates/images/search.gif'",
101                                             "|xns": "Roo.Toolbar"
102                                         },
103                                         {
104                                             "listeners": {
105                                                 "|click": "function (_self, e)\n{\n    _this.searchBox.setValue('');\n    \n    _this.grid.footer.onClick('first');\n}"
106                                             },
107                                             "cls": "x-btn-icon",
108                                             "xtype": "Button",
109                                             "|icon": "rootURL + '/Pman/templates/images/edit-clear.gif'",
110                                             "|xns": "Roo.Toolbar"
111                                         },
112                                         {
113                                             "|xns": "Roo.Toolbar",
114                                             "xtype": "Separator"
115                                         },
116                                         {
117                                             "listeners": {
118                                                 "render": "function (_self)\n{\n    _this.pagetype = _this.pagetype || {};\n    _this.pagetype['new'] = _self;\n}",
119                                                 "click": "function (_self, e)\n{\n  _this.grid.footer.onClick('first');\n}"
120                                             },
121                                             "enableToggle": true,
122                                             "pressed": true,
123                                             "text": "New Outlets",
124                                             "toggleGroup": "pagetype",
125                                             "xtype": "Button",
126                                             "|xns": "Roo.Toolbar"
127                                         },
128                                         {
129                                             "listeners": {
130                                                 "render": "function (_self)\n{\n    _this.pagetype = _this.pagetype || {};\n    _this.pagetype['all'] = _self;\n}",
131                                                 "click": "function (_self, e)\n{\n  _this.grid.footer.onClick('first');\n}"
132                                             },
133                                             "enableToggle": true,
134                                             "pressed": false,
135                                             "text": "All Outlets",
136                                             "toggleGroup": "pagetype",
137                                             "xtype": "Button",
138                                             "|xns": "Roo.Toolbar"
139                                         },
140                                         {
141                                             "|xns": "Roo.Toolbar",
142                                             "xtype": "Fill"
143                                         },
144                                         {
145                                             "listeners": {
146                                                 "|click": "function()\n{\n\n    var sel = _this.grid.selModel.getSelectedCell();\n    if (!sel) { \n        Roo.MessageBox.alert(\"Error\", \"Select an outlet\");\n        return;\n    }\n    var rec = _this.grid.ds.getAt(sel[0]);\n    Pman.Dialog.PersonEdit.show( { id : rec.data.owner_id } , function() {\n        _this.grid.footer.onClick('reload');\n    }); \n \n   \n}\n"
147                                             },
148                                             "text": "Edit Owner password",
149                                             "xtype": "Button",
150                                             "|xns": "Roo.Toolbar"
151                                         },
152                                         {
153                                             "listeners": {
154                                                 "|click": "function()\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( { id : 0 } , function() {\n        _this.grid.footer.onClick('first');\n   }); \n}\n"
155                                             },
156                                             "cls": "x-btn-text-icon",
157                                             "text": "Add",
158                                             "xtype": "Button",
159                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
160                                             "|xns": "Roo.Toolbar"
161                                         },
162                                         {
163                                             "listeners": {
164                                                 "|click": "function()\n{\n    //Pman.genericDelete(_this, 'Companies'); \n    \n    var selection = _this.grid.getSelectionModel().getSelectedCell();\n    var sn = _this.grid.ds.getAt(selection[0]);\n    if (!sn || isNaN(sn.id *1)) {\n        Roo.MessageBox.alert(\"Error\", \"Select a row\"); \n        return;\n    }\n    Roo.MessageBox.confirm(\"Confirm\", \"Are sure you want to delete that?\", function (v){\n        if (v != 'yes') {\n            return;\n        }\n        Roo.log(sn);\n        new Pman.Request({\n                    url : baseURL + '/Roo/Companies.php',\n                    method: 'POST',\n                    params : {\n                        _delete : sn.data.id\n                    },\n                    success : function()\n                    {\n                        Roo.log('Got Success!!');\n                        _this.grid.footer.onClick('first');\n                    }\n                });\n        /*new Pman.Request({\n            url : baseURL + '/Roo/Person.php',\n            method: 'POST',\n            params : {\n                _delete : sn.data.owner_id\n            },\n            success : function()\n            {\n                Roo.log('Got Success!!');\n                \n                \n            }\n        });\n        */\n    });\n    \n}"
165                                             },
166                                             "cls": "x-btn-text-icon",
167                                             "text": "Delete",
168                                             "xtype": "Button",
169                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
170                                             "|xns": "Roo.Toolbar"
171                                         }
172                                     ]
173                                 },
174                                 {
175                                     "xtype": "ColumnModel",
176                                     "header": "Id",
177                                     "width": 75,
178                                     "dataIndex": "id",
179                                     "|renderer": "function(v) { return String.format('{0}', v); }",
180                                     "|xns": "Roo.grid",
181                                     "*prop": "colModel[]"
182                                 },
183                                 {
184                                     "xtype": "ColumnModel",
185                                     "header": "Name",
186                                     "width": 200,
187                                     "dataIndex": "name",
188                                     "|renderer": "function(v) { return String.format('{0}', v); }",
189                                     "|xns": "Roo.grid",
190                                     "*prop": "colModel[]"
191                                 },
192                                 {
193                                     "xtype": "ColumnModel",
194                                     "header": "Address",
195                                     "width": 200,
196                                     "dataIndex": "address",
197                                     "|renderer": "function(v) { return String.format('{0}', v); }",
198                                     "|xns": "Roo.grid",
199                                     "*prop": "colModel[]"
200                                 },
201                                 {
202                                     "*prop": "colModel[]",
203                                     "dataIndex": "tel",
204                                     "header": "Tel",
205                                     "width": 100,
206                                     "xtype": "ColumnModel",
207                                     "|renderer": "function(v) { return String.format('{0}', v); }",
208                                     "|xns": "Roo.grid"
209                                 },
210                                 {
211                                     "*prop": "colModel[]",
212                                     "dataIndex": "email",
213                                     "header": "Email",
214                                     "width": 100,
215                                     "xtype": "ColumnModel",
216                                     "|renderer": "function(v) { return String.format('{0}', v); }",
217                                     "|xns": "Roo.grid"
218                                 },
219                                 {
220                                     "*prop": "colModel[]",
221                                     "dataIndex": "created_dt",
222                                     "header": "Created dt",
223                                     "sortable": true,
224                                     "width": 75,
225                                     "xtype": "ColumnModel",
226                                     "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
227                                     "|xns": "Roo.grid"
228                                 },
229                                 {
230                                     "*prop": "colModel[]",
231                                     "dataIndex": "updated_dt",
232                                     "header": "Updated dt",
233                                     "sortable": true,
234                                     "width": 75,
235                                     "xtype": "ColumnModel",
236                                     "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
237                                     "|xns": "Roo.grid"
238                                 },
239                                 {
240                                     "*prop": "colModel[]",
241                                     "dataIndex": "district_id_name",
242                                     "header": "District",
243                                     "width": 75,
244                                     "xtype": "ColumnModel",
245                                     "|renderer": "function(v) { return String.format('{0}', v); }",
246                                     "|xns": "Roo.grid"
247                                 },
248                                 {
249                                     "*prop": "colModel[]",
250                                     "dataIndex": "owner_id_is_pending",
251                                     "header": "Verified",
252                                     "width": 75,
253                                     "xtype": "ColumnModel",
254                                     "|renderer": "function(v) {  \n     if (v) {\n        return '<span style=\"color:red\">PENDING</span>';\n    }\n    return 'VERIFIED';\n }",
255                                     "|xns": "Roo.grid"
256                                 },
257                                 {
258                                     "*prop": "colModel[]",
259                                     "dataIndex": "is_active",
260                                     "header": "Is active",
261                                     "width": 75,
262                                     "xtype": "ColumnModel",
263                                     "|renderer": "function(v) {  \n    var state = v * 1 > 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
264                                     "|xns": "Roo.grid"
265                                 },
266                                 {
267                                     "xtype": "ColumnModel",
268                                     "header": "Price range min",
269                                     "width": 75,
270                                     "dataIndex": "price_range_min",
271                                     "|renderer": "function(v) { return String.format('{0}', v); }",
272                                     "|xns": "Roo.grid",
273                                     "*prop": "colModel[]"
274                                 },
275                                 {
276                                     "xtype": "ColumnModel",
277                                     "header": "Price range max",
278                                     "width": 75,
279                                     "dataIndex": "price_range_max",
280                                     "|renderer": "function(v) { return String.format('{0}', v); }",
281                                     "|xns": "Roo.grid",
282                                     "*prop": "colModel[]"
283                                 },
284                                 {
285                                     "xtype": "ColumnModel",
286                                     "header": "Favoured value",
287                                     "width": 75,
288                                     "dataIndex": "favoured_value",
289                                     "|renderer": "function(v) { return String.format('{0}', v); }",
290                                     "|xns": "Roo.grid",
291                                     "*prop": "colModel[]"
292                                 },
293                                 {
294                                     "*prop": "colModel[]",
295                                     "dataIndex": "owner_id_active_by",
296                                     "header": "Active By",
297                                     "width": 75,
298                                     "xtype": "ColumnModel",
299                                     "|renderer": "function(v)\n{\n    switch(v){\n        case 1:\n            v = 'user';\n            break;\n        case 2:\n            v = 'admin';\n            break;\n        default:\n            v = '';\n            break;\n    }\n    return String.format('{0}', v);\n}",
300                                     "|xns": "Roo.grid"
301                                 },
302                                 {
303                                     "*prop": "colModel[]",
304                                     "dataIndex": "is_allow_booking",
305                                     "header": "Allow Booking?",
306                                     "width": 75,
307                                     "xtype": "ColumnModel",
308                                     "|renderer": "function(v) {  \n    var state = v * 1 > 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
309                                     "|xns": "Roo.grid"
310                                 },
311                                 {
312                                     "*prop": "colModel[]",
313                                     "dataIndex": "total_value",
314                                     "header": "Total $ value",
315                                     "width": 75,
316                                     "xtype": "ColumnModel",
317                                     "|renderer": "function(v) { return String.format('{0}', v); }",
318                                     "|xns": "Roo.grid"
319                                 }
320                             ]
321                         }
322                     ]
323                 }
324             ]
325         }
326     ],
327     "permname": "",
328     "modOrder": "001"
329 }