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