Pman.Dialog.BAdminCompany.bjs
[Pman.BAdmin] / Pman.Dialog.BAdminCompany.bjs
1 {
2  "name" : "Pman.Dialog.BAdminCompany",
3  "parent" : "Pman.Tab.BAdmin",
4  "title" : "",
5  "path" : "/home/edward/gitlive/Pman.BAdmin/Pman.Dialog.BAdminCompany.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "b999e07cf80ea5eca8e589cd8540a81e" : "Select Logo",
10   "1c76cbfe21c6f44c1d1e59d54f3e4420" : "Company",
11   "ce8ae9da5b7cd6c3df2929543a9af92d" : "Email",
12   "231bc72756b5e6de492aaaa1577f61b1" : "Remarks",
13   "1243daf593fa297e07ab03bf06d925af" : "Searching...",
14   "bcc254b55c4a1babdf1dcb82c207506b" : "Phone",
15   "ea4788705e6873b424c65e91c2846b19" : "Cancel",
16   "30a47f1901469a01975f8d24bbb9f701" : "Modify Company",
17   "a1fa27779242b4902f7ae3bdd5c6d508" : "Type",
18   "dd7bf230fde8d4836917806aff6a6b27" : "Address",
19   "c9cc8cce247e49bae79f15173ce97354" : "Save",
20   "9810aa2b9f44401be4bf73188ef2b67d" : "Fax",
21   "e6b391a8d2c4d45902a23a8b6585703d" : "URL"
22  },
23  "items" : [
24   {
25    "listeners" : {
26     "render" : "function (_self)\n{\n    _this.modal = _self;\n}"
27    },
28    "String size" : "lg",
29    "xtype" : "Modal",
30    "$ xns" : "Roo.bootstrap",
31    "String title" : "Modify Company",
32    "items" : [
33     {
34      "xtype" : "Container",
35      "$ xns" : "Roo.bootstrap",
36      "String style" : "width: 100%;",
37      "items" : [
38       {
39        "xtype" : "Row",
40        "$ xns" : "Roo.bootstrap",
41        "items" : [
42         {
43          "Number md" : 12,
44          "xtype" : "Column",
45          "$ xns" : "Roo.bootstrap",
46          "items" : [
47           {
48            "listeners" : {
49             "render" : "function (_self)\n{\n    _this.logo = _self;\n}"
50            },
51            "Boolean imgResponsive" : true,
52            "xtype" : "Img",
53            "$ xns" : "Roo.bootstrap",
54            "String style" : "text-align: center; margin-left: auto; margin-right: auto; "
55           }
56          ]
57         },
58         {
59          "Number md" : 12,
60          "xtype" : "Column",
61          "$ xns" : "Roo.bootstrap",
62          "items" : [
63           {
64            "listeners" : {
65             "actionfailed" : "function (_self, action)\n{\n\n}",
66             "actioncomplete" : "function (_self, action)\n{\n    if(action.type == 'setdata'){\n        _self.reset(); \n        if(_this.data.id * 1 > 0) {\n            _this.onid.setValue(_this.data.id);\n            _this.ontable.setValue('coba_company');\n        }        \n        return;\n    }\n    \n   if (action.type == 'submit') { // only submitted here if we are \n       //_this.dialog.hide();\n       // replace the logo on the display dialog\n        if(action.result.data.id * 1 > 0) {\n            _this.logo.el.dom.src = String.format('{0}/Images/Thumb/300/{1}/', baseURL, action.result.data.id ); \n                \n             new Pman.Request({\n                 url : baseURL + '/Roo/Core_company.php',\n                 method : 'POST',\n                 params : {\n                     id : _this.img_upload_form.findField('onid').getValue() * 1,\n                     logo_id: action.result.data.id\n                 }, \n                 success : function(res) {\n                    \n                 },\n                 failure : function(res) {\n                    \n                 }\n            });\n        }\n        _this.dialog.hide();\n        if (_this.callback) {\n            _this.callback.call(this, action.result.data);\n            \n            console.log(action.result.data);\n        }\n        return;\n    }\n}",
67             "render" : "function (_self)\n{\n    _this.img_upload_form = _self;\n}"
68            },
69            "$ url" : "baseURL + '/Roo/Images.php'",
70            "xtype" : "Form",
71            "Boolean fileUpload" : true,
72            "$ xns" : "Roo.bootstrap",
73            "String style" : "margin:15px;",
74            "String method" : "POST",
75            "items" : [
76             {
77              "Boolean allowBlank" : false,
78              "String name" : "imageUpload",
79              "xtype" : "Input",
80              "string fieldLabel" : "Select Logo",
81              "String inputType" : "file",
82              "$ xns" : "Roo.bootstrap",
83              "Boolean forceFeedback" : true
84             },
85             {
86              "listeners" : {
87               "render" : "function (_self)\n{\n    _this.onid = _self;\n}"
88              },
89              "String name" : "onid",
90              "xtype" : "Input",
91              "String inputType" : "hidden",
92              "$ xns" : "Roo.bootstrap"
93             },
94             {
95              "listeners" : {
96               "render" : "function (_self)\n{\n    _this.ontable = _self;\n}"
97              },
98              "String name" : "ontable",
99              "xtype" : "Input",
100              "String inputType" : "hidden",
101              "$ xns" : "Roo.bootstrap"
102             },
103             {
104              "listeners" : {
105               "render" : "function (_self)\n{\n    _this.imgtype = _self;\n}"
106              },
107              "String name" : "imgtype",
108              "xtype" : "Input",
109              "String inputType" : "hidden",
110              "$ xns" : "Roo.bootstrap"
111             }
112            ]
113           }
114          ]
115         }
116        ]
117       },
118       {
119        "xtype" : "Row",
120        "$ xns" : "Roo.bootstrap",
121        "items" : [
122         {
123          "xtype" : "Column",
124          "Number xs" : 6,
125          "$ xns" : "Roo.bootstrap",
126          "items" : [
127           {
128            "listeners" : {
129             "actionfailed" : "function (_self, action)\n{\n    //Pman.standardActionFailed(_self,action);\n    \n    if (!this.isValid) {\n        return;\n    }\n    \n    Roo.bootstrap.MessageBox.alert(action.result.errorMsg);\n\n}",
130             "actioncomplete" : "function (_self, action)\n{\n    if(action.type == 'setdata'){\n        _self.reset(); \n        _this.img_upload_form.reset();\n        if(_this.data.id * 1 > 0) {\n            this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});\n            _this.modal.setTitle('Modify Company');\n            _this.onid.setValue(_this.data.id);\n            \n            if(_this.data.logo_id * 1 > 0) {\n                _this.logo.el.dom.src = String.format('{0}/Images/Thumb/300/{1}/', baseURL, _this.data.logo_id); \n            }\n        } else {\n           _this.modal.setTitle('Add Company');\n           _this.onid.setValue(''); \n           _this.logo.el.dom.src = ''; \n        }\n        //_this.type.store.load({}); \n\n        _this.ontable.setValue('core_company');\n\n        _this.imgtype.setValue('LOGO');\n        return;\n    }\n   \n   \n    if (action.type == 'load') {\n        _this.data = action.result.data;\n        var meth = _this.data.comptype == 'OWNER' ? 'disable' : 'enable';\n     \n            \n        if (_this.form.findField('comptype')) {\n            _this.form.findField('comptype')[meth]();\n        }\n          \n       // _this.loaded();\n        return;\n    }\n    \n    \n    if (action.type == 'submit') { // only submitted here if we are \n        //_this.dialog.hide();\n        if (!_this.img_upload_form.findField('imageUpload')) {\n           return;\n        }\n        if (_this.img_upload_form.findField('imageUpload').getValue() !='') {\n            if(action.result.data.id *1 <= 0) {\n                return;\n            }\n            _this.onid.setValue(action.result.data.id);\n            _this.img_upload_form.doAction(\"submit\");\n                        \n        } else {\n            _this.dialog.hide();\n             if (_this.callback) {\n                _this.callback.call(this, action.result.data);\n            }\n        }\n        return; \n    }\n}",
131             "render" : "function (_self)\n{\n    _this.form = _self; \n}"
132            },
133            "$ url" : "baseURL + '/Roo/Core_company.php'",
134            "xtype" : "Form",
135            "$ xns" : "Roo.bootstrap",
136            "items" : [
137             {
138              "listeners" : {
139               "render" : "function (_self)\n{\n    _this.type = _self;\n    _self.store.load({});\n}"
140              },
141              "Boolean allowBlank" : false,
142              "String loadingText" : "Searching...",
143              "Boolean selectOnFocus" : true,
144              "String name" : "comptype_display_name",
145              "Number minChars" : 2,
146              "String valueField" : "name",
147              "String queryParam" : "query[name]",
148              "Boolean typeAhead" : false,
149              "xtype" : "ComboBox",
150              "Boolean editable" : false,
151              "String triggerAction" : "all",
152              "string fieldLabel" : "Type",
153              "String labelAlign" : "left",
154              "Boolean alwaysQuery" : true,
155              "Number listWidth" : 250,
156              "$ xns" : "Roo.bootstrap",
157              "String hiddenName" : "comptype",
158              "String displayField" : "display_name",
159              "items" : [
160               {
161                "listeners" : {
162                 "beforeload" : "function (_self, options)\n{\n    options.params = options.params || {};\n    // set more here\n    //o.params['query[empty_etype]'] = 1;\n    options.params.etype = 'COMPTYPE';\n}"
163                },
164                "Object sortInfo" : "{ direction : 'ASC', field: 'id' }",
165                "xtype" : "Store",
166                "boolean remoteSort" : true,
167                "$ xns" : "Roo.data",
168                "* prop" : "store",
169                "items" : [
170                 {
171                  "$ url" : "baseURL + '/Roo/core_enum.php'",
172                  "xtype" : "HttpProxy",
173                  "$ xns" : "Roo.data",
174                  "String method" : "GET",
175                  "* prop" : "proxy"
176                 },
177                 {
178                  "xtype" : "JsonReader",
179                  "String root" : "data",
180                  "$ xns" : "Roo.data",
181                  "String id" : "id",
182                  "* prop" : "reader",
183                  "String totalProperty" : "total"
184                 }
185                ]
186               }
187              ]
188             },
189             {
190              "listeners" : {
191               "render" : "function (_self)\n{\n    _this.company = _self;\n}"
192              },
193              "String name" : "name",
194              "xtype" : "Input",
195              "string fieldLabel" : "Company",
196              "String labelAlign" : "left",
197              "$ xns" : "Roo.bootstrap"
198             },
199             {
200              "listeners" : {
201               "render" : "function (_self)\n{\n    _this.tel = _self;\n}"
202              },
203              "String name" : "tel",
204              "xtype" : "Input",
205              "string fieldLabel" : "Phone",
206              "String labelAlign" : "left",
207              "$ xns" : "Roo.bootstrap"
208             },
209             {
210              "listeners" : {
211               "render" : "function (_self)\n{\n    _this.fax = _self;\n}"
212              },
213              "String name" : "fax",
214              "xtype" : "Input",
215              "string fieldLabel" : "Fax",
216              "String labelAlign" : "left",
217              "$ xns" : "Roo.bootstrap"
218             },
219             {
220              "listeners" : {
221               "render" : "function (_self)\n{\n    _this.fax = _self;\n}"
222              },
223              "String name" : "email",
224              "xtype" : "Input",
225              "string fieldLabel" : "Email",
226              "String labelAlign" : "left",
227              "$ xns" : "Roo.bootstrap"
228             },
229             {
230              "listeners" : {
231               "render" : "function (_self)\n{\n    _this.url = _self;\n}"
232              },
233              "String name" : "url",
234              "xtype" : "Input",
235              "string fieldLabel" : "URL",
236              "String labelAlign" : "left",
237              "$ xns" : "Roo.bootstrap"
238             },
239             {
240              "listeners" : {
241               "render" : "function (_self)\n{\n    _this.address = _self;\n}"
242              },
243              "String name" : "address",
244              "xtype" : "Input",
245              "string fieldLabel" : "Address",
246              "String labelAlign" : "left",
247              "$ xns" : "Roo.bootstrap"
248             },
249             {
250              "listeners" : {
251               "render" : "function (_self)\n{\n    _this.remarks = _self;\n}"
252              },
253              "String name" : "remarks",
254              "xtype" : "TextArea",
255              "string fieldLabel" : "Remarks",
256              "String labelAlign" : "left",
257              "$ xns" : "Roo.bootstrap"
258             },
259             {
260              "listeners" : {
261               "render" : "function (_self)\n{\n    _this.companyID = _self;\n}"
262              },
263              "String name" : "id",
264              "xtype" : "Input",
265              "String inputType" : "hidden",
266              "$ xns" : "Roo.bootstrap"
267             },
268             {
269              "xtype" : "Row",
270              "$ xns" : "Roo.bootstrap",
271              "items" : [
272               {
273                "Number md" : 12,
274                "xtype" : "Column",
275                "$ xns" : "Roo.bootstrap",
276                "items" : [
277                 {
278                  "listeners" : {
279                   "render" : "function (_self)\n{\n    _this.type = _self;\n    _self.store.load({});\n}"
280                  },
281                  "Boolean selectOnFocus" : true,
282                  "Boolean allowBlank" : false,
283                  "String loadingText" : "Searching...",
284                  "String name" : "comptype_display_name",
285                  "Number minChars" : 2,
286                  "String valueField" : "name",
287                  "String queryParam" : "query[name]",
288                  "Boolean typeAhead" : false,
289                  "xtype" : "ComboBox",
290                  "Boolean editable" : false,
291                  "String triggerAction" : "all",
292                  "string fieldLabel" : "Type",
293                  "String labelAlign" : "left",
294                  "Boolean alwaysQuery" : true,
295                  "$ xns" : "Roo.bootstrap",
296                  "String hiddenName" : "comptype",
297                  "String displayField" : "display_name",
298                  "items" : [
299                   {
300                    "listeners" : {
301                     "beforeload" : "function (_self, options)\n{\n    options.params = options.params || {};\n    // set more here\n    //o.params['query[empty_etype]'] = 1;\n    options.params.etype = 'COMPTYPE';\n}"
302                    },
303                    "Object sortInfo" : "{ direction : 'ASC', field: 'id' }",
304                    "xtype" : "Store",
305                    "boolean remoteSort" : true,
306                    "$ xns" : "Roo.data",
307                    "* prop" : "store",
308                    "items" : [
309                     {
310                      "$ url" : "baseURL + '/Roo/core_enum.php'",
311                      "xtype" : "HttpProxy",
312                      "$ xns" : "Roo.data",
313                      "String method" : "GET",
314                      "* prop" : "proxy"
315                     },
316                     {
317                      "xtype" : "JsonReader",
318                      "String root" : "data",
319                      "$ xns" : "Roo.data",
320                      "String id" : "id",
321                      "* prop" : "reader",
322                      "String totalProperty" : "total"
323                     }
324                    ]
325                   }
326                  ]
327                 }
328                ]
329               }
330              ]
331             }
332            ]
333           }
334          ]
335         }
336        ]
337       }
338      ]
339     },
340     {
341      "listeners" : {
342       "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
343      },
344      "String weight" : "default",
345      "xtype" : "Button",
346      "$ xns" : "Roo.bootstrap",
347      "String html" : "Cancel",
348      "* prop" : "buttons[]"
349     },
350     {
351      "listeners" : {
352       "render" : "function (_self)\n{\n    _this.btn_ok=this;\n}",
353       "click" : "function (_self, e)\n{\n    if(!_this.form.isValid()){\n        Roo.bootstrap.MessageBox.alert('Error', 'Please Correct all the errors in red');\n        return;\n    }\n    \n    var myID = _this.form.findField('id').getValue();\n    var myName = _this.form.findField('name').getValue();\n    \n    console.log(myID + ' ' + myName);\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Core_company.php',\n        method : 'POST',\n        params : {\n          id : _this.form.findField('id').getValue() * 1,\n          name : _this.form.findField('name').getValue(),\n          _check_name : 1\n        }, \n        success : function(res) {\n           \n            // Adding new record\n            _this.form.doAction(\"submit\");\n        },\n        failure : function(res) {\n           _this.form.doAction(\"submit\");\n        }\n    });\n     \n    return;\n    \n}"
354      },
355      "String weight" : "primary",
356      "xtype" : "Button",
357      "$ xns" : "Roo.bootstrap",
358      "String html" : "Save",
359      "* prop" : "buttons[]"
360     }
361    ]
362   }
363  ]
364 }