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