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/john/gitlive/web.coba/Pman/BAdmin/Pman.Dialog.BAdminCompany.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "1c76cbfe21c6f44c1d1e59d54f3e4420" : "Company",
10   "ce8ae9da5b7cd6c3df2929543a9af92d" : "Email",
11   "231bc72756b5e6de492aaaa1577f61b1" : "Remarks",
12   "1243daf593fa297e07ab03bf06d925af" : "Searching...",
13   "bcc254b55c4a1babdf1dcb82c207506b" : "Phone",
14   "66bc3ece76861852889e623217049d32" : "Edit Company Details",
15   "ea4788705e6873b424c65e91c2846b19" : "Cancel",
16   "ca0dbad92a874b2f69b549293387925e" : "Code",
17   "a1fa27779242b4902f7ae3bdd5c6d508" : "Type",
18   "dd7bf230fde8d4836917806aff6a6b27" : "Address",
19   "c9cc8cce247e49bae79f15173ce97354" : "Save",
20   "e6b391a8d2c4d45902a23a8b6585703d" : "URL"
21  },
22  "items" : [
23   {
24    "listeners" : {
25     "show" : "function (_self)\n{\n    _this.form.findField('code').hide();\n\n    if(appDisabled.indexOf('Coba.SuperAdmin') * 1 == -1) {\n        _this.form.findField('code').show();\n    }\n}",
26     "render" : "function (_self)\n{\n    _this.modal = _self;\n}"
27    },
28    "String cls" : "padding-bottom-trim badmin-dialog-company enable-modal-body-overflow ",
29    "xtype" : "Modal",
30    "int max_width" : 650,
31    "$ xns" : "Roo.bootstrap",
32    "String title" : "Edit Company Details",
33    "items" : [
34     {
35      "xtype" : "Container",
36      "$ xns" : "Roo.bootstrap",
37      "String style" : "width: 100%;",
38      "items" : [
39       {
40        "listeners" : {
41         "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}",
42         "actioncomplete" : "function (_self, action)\n{\n    if(action.type == 'setdata'){\n        _self.reset(); \n\n        if(_this.data.id * 1 > 0) {\n            this.doAction('load',{ method: 'GET', params: { '_id' : _this.data.id }});\n            _this.modal.setTitle('Edit Company Details');\n            \n        } else {\n           _this.modal.setTitle('Create Company');\n        }\n        return;\n    }\n   \n   \n    if (action.type == 'load') {\n        _this.data = action.result.data;\n        \n        if(_this.data.comptype == 'OWNER'){\n            _this.form.findField('comptype').hide();\n        }\n        \n        return;\n    }\n    \n    \n    if (action.type == 'submit') { // only submitted here if we are \n        //_this.dialog.hide();\n        \n        _this.dialog.hide();\n        \n         if (_this.callback) {\n            _this.callback.call(this, action.result.data);\n         }\n        return; \n    }\n}",
43         "render" : "function (_self)\n{\n    _this.form = _self; \n}"
44        },
45        "$ url" : "baseURL + '/Roo/Core_company.php'",
46        "xtype" : "Form",
47        "$ xns" : "Roo.bootstrap",
48        "items" : [
49         {
50          "xtype" : "Row",
51          "$ xns" : "Roo.bootstrap",
52          "items" : [
53           {
54            "Number md" : 12,
55            "xtype" : "Column",
56            "$ xns" : "Roo.bootstrap",
57            "items" : [
58             {
59              "listeners" : {
60               "render" : "function (_self)\n{\n    _this.company = _self;\n}"
61              },
62              "String name" : "code",
63              "xtype" : "Input",
64              "string fieldLabel" : "Code",
65              "$ xns" : "Roo.bootstrap",
66              "String indicatorpos" : "left"
67             }
68            ]
69           }
70          ]
71         },
72         {
73          "xtype" : "Row",
74          "$ xns" : "Roo.bootstrap",
75          "items" : [
76           {
77            "Number md" : 12,
78            "xtype" : "Column",
79            "$ xns" : "Roo.bootstrap",
80            "items" : [
81             {
82              "listeners" : {
83               "render" : "function (_self)\n{\n    _this.type = _self;\n    _self.store.load({});\n}"
84              },
85              "Boolean selectOnFocus" : true,
86              "Boolean allowBlank" : false,
87              "String loadingText" : "Searching...",
88              "String name" : "comptype_display_name",
89              "Number minChars" : 2,
90              "String valueField" : "name",
91              "String queryParam" : "query[name]",
92              "Boolean typeAhead" : false,
93              "xtype" : "ComboBox",
94              "Boolean editable" : false,
95              "String triggerAction" : "all",
96              "string fieldLabel" : "Type",
97              "Boolean alwaysQuery" : true,
98              "$ xns" : "Roo.bootstrap",
99              "String hiddenName" : "comptype",
100              "String displayField" : "display_name",
101              "String indicatorpos" : "left",
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           }
134          ]
135         },
136         {
137          "xtype" : "Row",
138          "$ xns" : "Roo.bootstrap",
139          "items" : [
140           {
141            "Number md" : 12,
142            "xtype" : "Column",
143            "$ xns" : "Roo.bootstrap",
144            "items" : [
145             {
146              "listeners" : {
147               "render" : "function (_self)\n{\n    _this.company = _self;\n}"
148              },
149              "String name" : "name",
150              "xtype" : "Input",
151              "string fieldLabel" : "Company",
152              "$ xns" : "Roo.bootstrap",
153              "String indicatorpos" : "left"
154             }
155            ]
156           }
157          ]
158         },
159         {
160          "xtype" : "Row",
161          "$ xns" : "Roo.bootstrap",
162          "items" : [
163           {
164            "Number md" : 12,
165            "xtype" : "Column",
166            "$ xns" : "Roo.bootstrap",
167            "items" : [
168             {
169              "listeners" : {
170               "render" : "function (_self)\n{\n    _this.address = _self;\n}"
171              },
172              "String name" : "address",
173              "xtype" : "Input",
174              "string fieldLabel" : "Address",
175              "$ xns" : "Roo.bootstrap",
176              "String indicatorpos" : "left"
177             }
178            ]
179           }
180          ]
181         },
182         {
183          "xtype" : "Row",
184          "$ xns" : "Roo.bootstrap",
185          "items" : [
186           {
187            "Number md" : 12,
188            "xtype" : "Column",
189            "$ xns" : "Roo.bootstrap",
190            "items" : [
191             {
192              "listeners" : {
193               "render" : "function (_self)\n{\n    _this.tel = _self;\n}"
194              },
195              "String name" : "tel",
196              "xtype" : "Input",
197              "string fieldLabel" : "Phone",
198              "$ xns" : "Roo.bootstrap",
199              "String indicatorpos" : "left"
200             }
201            ]
202           }
203          ]
204         },
205         {
206          "xtype" : "Row",
207          "$ xns" : "Roo.bootstrap",
208          "items" : [
209           {
210            "Number md" : 12,
211            "xtype" : "Column",
212            "$ xns" : "Roo.bootstrap",
213            "items" : [
214             {
215              "listeners" : {
216               "render" : "function (_self)\n{\n    _this.fax = _self;\n}"
217              },
218              "String name" : "email",
219              "xtype" : "Input",
220              "string fieldLabel" : "Email",
221              "$ xns" : "Roo.bootstrap",
222              "String indicatorpos" : "left"
223             }
224            ]
225           }
226          ]
227         },
228         {
229          "xtype" : "Row",
230          "$ xns" : "Roo.bootstrap",
231          "items" : [
232           {
233            "Number md" : 12,
234            "xtype" : "Column",
235            "$ xns" : "Roo.bootstrap",
236            "items" : [
237             {
238              "listeners" : {
239               "render" : "function (_self)\n{\n    _this.url = _self;\n}"
240              },
241              "String name" : "url",
242              "xtype" : "Input",
243              "string fieldLabel" : "URL",
244              "$ xns" : "Roo.bootstrap",
245              "String indicatorpos" : "left"
246             }
247            ]
248           }
249          ]
250         },
251         {
252          "String cls" : "badmin-company-edit-remark",
253          "xtype" : "Row",
254          "$ xns" : "Roo.bootstrap",
255          "items" : [
256           {
257            "Number md" : 12,
258            "xtype" : "Column",
259            "$ xns" : "Roo.bootstrap",
260            "items" : [
261             {
262              "listeners" : {
263               "render" : "function (_self)\n{\n    _this.remarks = _self;\n}"
264              },
265              "String name" : "remarks",
266              "xtype" : "TextArea",
267              "string fieldLabel" : "Remarks",
268              "$ xns" : "Roo.bootstrap",
269              "String indicatorpos" : "left"
270             }
271            ]
272           }
273          ]
274         },
275         {
276          "listeners" : {
277           "render" : "function (_self)\n{\n    _this.companyID = _self;\n}"
278          },
279          "String name" : "id",
280          "xtype" : "Input",
281          "String inputType" : "hidden",
282          "$ xns" : "Roo.bootstrap"
283         }
284        ]
285       }
286      ]
287     },
288     {
289      "listeners" : {
290       "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
291      },
292      "String weight" : "default",
293      "xtype" : "Button",
294      "$ xns" : "Roo.bootstrap",
295      "String html" : "Cancel",
296      "* prop" : "buttons[]"
297     },
298     {
299      "listeners" : {
300       "render" : "function (_self)\n{\n    _this.btn_ok=this;\n}",
301       "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}"
302      },
303      "String weight" : "primary",
304      "xtype" : "Button",
305      "$ xns" : "Roo.bootstrap",
306      "String html" : "Save",
307      "* prop" : "buttons[]"
308     }
309    ]
310   }
311  ]
312 }