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