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    "String cls" : "enable-overflow",
30    "xtype" : "Modal",
31    "$ xns" : "Roo.bootstrap",
32    "String title" : "Modify Company",
33    "items" : [
34     {
35      "xtype" : "Container",
36      "$ xns" : "Roo.bootstrap",
37      "String style" : "width: 100%;",
38      "items" : [
39       {
40        "xtype" : "Row",
41        "$ xns" : "Roo.bootstrap",
42        "items" : [
43         {
44          "Number md" : 12,
45          "xtype" : "Column",
46          "$ xns" : "Roo.bootstrap",
47          "items" : [
48           {
49            "listeners" : {
50             "render" : "function (_self)\n{\n    _this.logo = _self;\n}"
51            },
52            "Boolean imgResponsive" : true,
53            "xtype" : "Img",
54            "$ xns" : "Roo.bootstrap",
55            "String style" : "text-align: center; margin-left: auto; margin-right: auto; "
56           }
57          ]
58         },
59         {
60          "Number md" : 12,
61          "xtype" : "Column",
62          "$ xns" : "Roo.bootstrap",
63          "items" : [
64           {
65            "listeners" : {
66             "actionfailed" : "function (_self, action)\n{\n\n}",
67             "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}",
68             "render" : "function (_self)\n{\n    _this.img_upload_form = _self;\n}"
69            },
70            "$ url" : "baseURL + '/Roo/Images.php'",
71            "xtype" : "Form",
72            "Boolean fileUpload" : true,
73            "$ xns" : "Roo.bootstrap",
74            "String style" : "margin:15px;",
75            "String method" : "POST",
76            "items" : [
77             {
78              "Boolean allowBlank" : false,
79              "String name" : "imageUpload",
80              "xtype" : "Input",
81              "string fieldLabel" : "Select Logo",
82              "String inputType" : "file",
83              "$ xns" : "Roo.bootstrap",
84              "Boolean forceFeedback" : true
85             },
86             {
87              "listeners" : {
88               "render" : "function (_self)\n{\n    _this.onid = _self;\n}"
89              },
90              "String name" : "onid",
91              "xtype" : "Input",
92              "String inputType" : "hidden",
93              "$ xns" : "Roo.bootstrap"
94             },
95             {
96              "listeners" : {
97               "render" : "function (_self)\n{\n    _this.ontable = _self;\n}"
98              },
99              "String name" : "ontable",
100              "xtype" : "Input",
101              "String inputType" : "hidden",
102              "$ xns" : "Roo.bootstrap"
103             },
104             {
105              "listeners" : {
106               "render" : "function (_self)\n{\n    _this.imgtype = _self;\n}"
107              },
108              "String name" : "imgtype",
109              "xtype" : "Input",
110              "String inputType" : "hidden",
111              "$ xns" : "Roo.bootstrap"
112             }
113            ]
114           }
115          ]
116         }
117        ]
118       },
119       {
120        "xtype" : "Row",
121        "$ xns" : "Roo.bootstrap",
122        "items" : [
123         {
124          "xtype" : "Column",
125          "Number xs" : 12,
126          "$ xns" : "Roo.bootstrap",
127          "items" : [
128           {
129            "listeners" : {
130             "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}",
131             "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}",
132             "render" : "function (_self)\n{\n    _this.form = _self; \n}"
133            },
134            "$ url" : "baseURL + '/Roo/Core_company.php'",
135            "xtype" : "Form",
136            "$ xns" : "Roo.bootstrap",
137            "items" : [
138             {
139              "xtype" : "Row",
140              "$ xns" : "Roo.bootstrap",
141              "items" : [
142               {
143                "Number md" : 12,
144                "xtype" : "Column",
145                "$ xns" : "Roo.bootstrap",
146                "items" : [
147                 {
148                  "listeners" : {
149                   "render" : "function (_self)\n{\n    _this.type = _self;\n    _self.store.load({});\n}"
150                  },
151                  "Boolean selectOnFocus" : true,
152                  "Boolean allowBlank" : false,
153                  "String loadingText" : "Searching...",
154                  "String name" : "comptype_display_name",
155                  "Number minChars" : 2,
156                  "String valueField" : "name",
157                  "String queryParam" : "query[name]",
158                  "Boolean typeAhead" : false,
159                  "xtype" : "ComboBox",
160                  "Boolean editable" : false,
161                  "String triggerAction" : "all",
162                  "string fieldLabel" : "Type",
163                  "String labelAlign" : "left",
164                  "Boolean alwaysQuery" : true,
165                  "$ xns" : "Roo.bootstrap",
166                  "String hiddenName" : "comptype",
167                  "Number labelWidth" : 3,
168                  "String displayField" : "display_name",
169                  "items" : [
170                   {
171                    "listeners" : {
172                     "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}"
173                    },
174                    "Object sortInfo" : "{ direction : 'ASC', field: 'id' }",
175                    "xtype" : "Store",
176                    "boolean remoteSort" : true,
177                    "$ xns" : "Roo.data",
178                    "* prop" : "store",
179                    "items" : [
180                     {
181                      "$ url" : "baseURL + '/Roo/core_enum.php'",
182                      "xtype" : "HttpProxy",
183                      "$ xns" : "Roo.data",
184                      "String method" : "GET",
185                      "* prop" : "proxy"
186                     },
187                     {
188                      "xtype" : "JsonReader",
189                      "String root" : "data",
190                      "$ xns" : "Roo.data",
191                      "String id" : "id",
192                      "* prop" : "reader",
193                      "String totalProperty" : "total"
194                     }
195                    ]
196                   }
197                  ]
198                 }
199                ]
200               }
201              ]
202             },
203             {
204              "xtype" : "Row",
205              "$ xns" : "Roo.bootstrap",
206              "items" : [
207               {
208                "Number md" : 12,
209                "xtype" : "Column",
210                "$ xns" : "Roo.bootstrap",
211                "items" : [
212                 {
213                  "listeners" : {
214                   "render" : "function (_self)\n{\n    _this.company = _self;\n}"
215                  },
216                  "String name" : "name",
217                  "xtype" : "Input",
218                  "string fieldLabel" : "Company",
219                  "$ xns" : "Roo.bootstrap",
220                  "Number labelWidth" : 3
221                 }
222                ]
223               }
224              ]
225             },
226             {
227              "xtype" : "Row",
228              "$ xns" : "Roo.bootstrap",
229              "items" : [
230               {
231                "Number md" : 12,
232                "xtype" : "Column",
233                "$ xns" : "Roo.bootstrap",
234                "items" : [
235                 {
236                  "listeners" : {
237                   "render" : "function (_self)\n{\n    _this.tel = _self;\n}"
238                  },
239                  "String name" : "tel",
240                  "xtype" : "Input",
241                  "string fieldLabel" : "Phone",
242                  "String labelAlign" : "left",
243                  "$ xns" : "Roo.bootstrap",
244                  "Number labelWidth" : 3
245                 }
246                ]
247               }
248              ]
249             },
250             {
251              "xtype" : "Row",
252              "$ xns" : "Roo.bootstrap",
253              "items" : [
254               {
255                "Number md" : 12,
256                "xtype" : "Column",
257                "$ xns" : "Roo.bootstrap",
258                "items" : [
259                 {
260                  "listeners" : {
261                   "render" : "function (_self)\n{\n    _this.fax = _self;\n}"
262                  },
263                  "String name" : "fax",
264                  "xtype" : "Input",
265                  "string fieldLabel" : "Fax",
266                  "String labelAlign" : "left",
267                  "$ xns" : "Roo.bootstrap",
268                  "Number labelWidth" : 3
269                 }
270                ]
271               }
272              ]
273             },
274             {
275              "xtype" : "Row",
276              "$ xns" : "Roo.bootstrap",
277              "items" : [
278               {
279                "Number md" : 12,
280                "xtype" : "Column",
281                "$ xns" : "Roo.bootstrap",
282                "items" : [
283                 {
284                  "listeners" : {
285                   "render" : "function (_self)\n{\n    _this.fax = _self;\n}"
286                  },
287                  "String name" : "email",
288                  "xtype" : "Input",
289                  "string fieldLabel" : "Email",
290                  "String labelAlign" : "left",
291                  "$ xns" : "Roo.bootstrap"
292                 }
293                ]
294               }
295              ]
296             },
297             {
298              "xtype" : "Row",
299              "$ xns" : "Roo.bootstrap",
300              "items" : [
301               {
302                "Number md" : 12,
303                "xtype" : "Column",
304                "$ xns" : "Roo.bootstrap",
305                "items" : [
306                 {
307                  "listeners" : {
308                   "render" : "function (_self)\n{\n    _this.url = _self;\n}"
309                  },
310                  "String name" : "url",
311                  "xtype" : "Input",
312                  "string fieldLabel" : "URL",
313                  "String labelAlign" : "left",
314                  "$ xns" : "Roo.bootstrap"
315                 }
316                ]
317               }
318              ]
319             },
320             {
321              "xtype" : "Row",
322              "$ xns" : "Roo.bootstrap",
323              "items" : [
324               {
325                "Number md" : 12,
326                "xtype" : "Column",
327                "$ xns" : "Roo.bootstrap",
328                "items" : [
329                 {
330                  "listeners" : {
331                   "render" : "function (_self)\n{\n    _this.address = _self;\n}"
332                  },
333                  "String name" : "address",
334                  "xtype" : "Input",
335                  "string fieldLabel" : "Address",
336                  "String labelAlign" : "left",
337                  "$ xns" : "Roo.bootstrap"
338                 }
339                ]
340               }
341              ]
342             },
343             {
344              "xtype" : "Row",
345              "$ xns" : "Roo.bootstrap",
346              "items" : [
347               {
348                "Number md" : 12,
349                "xtype" : "Column",
350                "$ xns" : "Roo.bootstrap",
351                "items" : [
352                 {
353                  "listeners" : {
354                   "render" : "function (_self)\n{\n    _this.remarks = _self;\n}"
355                  },
356                  "String name" : "remarks",
357                  "xtype" : "TextArea",
358                  "string fieldLabel" : "Remarks",
359                  "String labelAlign" : "left",
360                  "$ xns" : "Roo.bootstrap"
361                 }
362                ]
363               }
364              ]
365             },
366             {
367              "listeners" : {
368               "render" : "function (_self)\n{\n    _this.companyID = _self;\n}"
369              },
370              "String name" : "id",
371              "xtype" : "Input",
372              "String inputType" : "hidden",
373              "$ xns" : "Roo.bootstrap"
374             }
375            ]
376           }
377          ]
378         }
379        ]
380       }
381      ]
382     },
383     {
384      "listeners" : {
385       "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
386      },
387      "String weight" : "default",
388      "xtype" : "Button",
389      "$ xns" : "Roo.bootstrap",
390      "String html" : "Cancel",
391      "* prop" : "buttons[]"
392     },
393     {
394      "listeners" : {
395       "render" : "function (_self)\n{\n    _this.btn_ok=this;\n}",
396       "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}"
397      },
398      "String weight" : "primary",
399      "xtype" : "Button",
400      "$ xns" : "Roo.bootstrap",
401      "String html" : "Save",
402      "* prop" : "buttons[]"
403     }
404    ]
405   }
406  ]
407 }