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   "1243daf593fa297e07ab03bf06d925af" : "Searching...",
13   "bcc254b55c4a1babdf1dcb82c207506b" : "Phone",
14   "66bc3ece76861852889e623217049d32" : "Edit Company Details",
15   "ea4788705e6873b424c65e91c2846b19" : "Cancel",
16   "a1fa27779242b4902f7ae3bdd5c6d508" : "Type",
17   "dd7bf230fde8d4836917806aff6a6b27" : "Address",
18   "c9cc8cce247e49bae79f15173ce97354" : "Save",
19   "e6b391a8d2c4d45902a23a8b6585703d" : "URL"
20  },
21  "items" : [
22   {
23    "listeners" : {
24     "render" : "function (_self)\n{\n    _this.modal = _self;\n}"
25    },
26    "String cls" : "padding-bottom-trim badmin-dialog-company enable-modal-body-overflow ",
27    "xtype" : "Modal",
28    "int maxWidth" : 650,
29    "$ xns" : "Roo.bootstrap",
30    "String title" : "Edit Company Details",
31    "items" : [
32     {
33      "xtype" : "Container",
34      "$ xns" : "Roo.bootstrap",
35      "String style" : "width: 100%;",
36      "items" : [
37       {
38        "listeners" : {
39         "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}",
40         "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}",
41         "render" : "function (_self)\n{\n    _this.form = _self; \n}"
42        },
43        "$ url" : "baseURL + '/Roo/Core_company.php'",
44        "xtype" : "Form",
45        "$ xns" : "Roo.bootstrap",
46        "items" : [
47         {
48          "xtype" : "Row",
49          "$ xns" : "Roo.bootstrap",
50          "items" : [
51           {
52            "Number md" : 12,
53            "xtype" : "Column",
54            "$ xns" : "Roo.bootstrap",
55            "items" : [
56             {
57              "listeners" : {
58               "render" : "function (_self)\n{\n    _this.type = _self;\n    _self.store.load({});\n}"
59              },
60              "String loadingText" : "Searching...",
61              "Boolean selectOnFocus" : true,
62              "Boolean allowBlank" : false,
63              "String name" : "comptype_display_name",
64              "Number minChars" : 2,
65              "String valueField" : "name",
66              "String queryParam" : "query[name]",
67              "Boolean typeAhead" : false,
68              "xtype" : "ComboBox",
69              "Boolean editable" : false,
70              "String triggerAction" : "all",
71              "string fieldLabel" : "Type",
72              "Boolean alwaysQuery" : true,
73              "$ xns" : "Roo.bootstrap",
74              "String hiddenName" : "comptype",
75              "String displayField" : "display_name",
76              "String indicatorpos" : "left",
77              "items" : [
78               {
79                "listeners" : {
80                 "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}"
81                },
82                "Object sortInfo" : "{ direction : 'ASC', field: 'id' }",
83                "xtype" : "Store",
84                "boolean remoteSort" : true,
85                "$ xns" : "Roo.data",
86                "* prop" : "store",
87                "items" : [
88                 {
89                  "$ url" : "baseURL + '/Roo/core_enum.php'",
90                  "xtype" : "HttpProxy",
91                  "$ xns" : "Roo.data",
92                  "String method" : "GET",
93                  "* prop" : "proxy"
94                 },
95                 {
96                  "xtype" : "JsonReader",
97                  "String root" : "data",
98                  "$ xns" : "Roo.data",
99                  "String id" : "id",
100                  "* prop" : "reader",
101                  "String totalProperty" : "total"
102                 }
103                ]
104               }
105              ]
106             }
107            ]
108           }
109          ]
110         },
111         {
112          "xtype" : "Row",
113          "$ xns" : "Roo.bootstrap",
114          "items" : [
115           {
116            "Number md" : 12,
117            "xtype" : "Column",
118            "$ xns" : "Roo.bootstrap",
119            "items" : [
120             {
121              "listeners" : {
122               "render" : "function (_self)\n{\n    _this.company = _self;\n}"
123              },
124              "String name" : "name",
125              "xtype" : "Input",
126              "string fieldLabel" : "Company",
127              "$ xns" : "Roo.bootstrap",
128              "String indicatorpos" : "left"
129             }
130            ]
131           }
132          ]
133         },
134         {
135          "xtype" : "Row",
136          "$ xns" : "Roo.bootstrap",
137          "items" : [
138           {
139            "Number md" : 12,
140            "xtype" : "Column",
141            "$ xns" : "Roo.bootstrap",
142            "items" : [
143             {
144              "listeners" : {
145               "render" : "function (_self)\n{\n    _this.address = _self;\n}"
146              },
147              "String name" : "address",
148              "xtype" : "Input",
149              "string fieldLabel" : "Address",
150              "$ xns" : "Roo.bootstrap",
151              "String indicatorpos" : "left"
152             }
153            ]
154           }
155          ]
156         },
157         {
158          "xtype" : "Row",
159          "$ xns" : "Roo.bootstrap",
160          "items" : [
161           {
162            "Number md" : 12,
163            "xtype" : "Column",
164            "$ xns" : "Roo.bootstrap",
165            "items" : [
166             {
167              "listeners" : {
168               "render" : "function (_self)\n{\n    _this.tel = _self;\n}"
169              },
170              "String name" : "tel",
171              "xtype" : "Input",
172              "string fieldLabel" : "Phone",
173              "$ xns" : "Roo.bootstrap",
174              "String indicatorpos" : "left"
175             }
176            ]
177           }
178          ]
179         },
180         {
181          "xtype" : "Row",
182          "$ xns" : "Roo.bootstrap",
183          "items" : [
184           {
185            "Number md" : 12,
186            "xtype" : "Column",
187            "$ xns" : "Roo.bootstrap",
188            "items" : [
189             {
190              "listeners" : {
191               "render" : "function (_self)\n{\n    _this.fax = _self;\n}"
192              },
193              "String name" : "email",
194              "xtype" : "Input",
195              "string fieldLabel" : "Email",
196              "$ xns" : "Roo.bootstrap",
197              "String indicatorpos" : "left"
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.url = _self;\n}"
215              },
216              "String name" : "url",
217              "xtype" : "Input",
218              "string fieldLabel" : "URL",
219              "$ xns" : "Roo.bootstrap",
220              "String indicatorpos" : "left"
221             }
222            ]
223           }
224          ]
225         },
226         {
227          "String cls" : "badmin-company-edit-remark",
228          "xtype" : "Row",
229          "$ xns" : "Roo.bootstrap",
230          "items" : [
231           {
232            "Number md" : 12,
233            "xtype" : "Column",
234            "$ xns" : "Roo.bootstrap",
235            "items" : [
236             {
237              "listeners" : {
238               "render" : "function (_self)\n{\n    _this.remarks = _self;\n}"
239              },
240              "String name" : "remarks",
241              "xtype" : "TextArea",
242              "string fieldLabel" : "Remarks",
243              "$ xns" : "Roo.bootstrap",
244              "String indicatorpos" : "left"
245             }
246            ]
247           }
248          ]
249         },
250         {
251          "listeners" : {
252           "render" : "function (_self)\n{\n    _this.companyID = _self;\n}"
253          },
254          "String name" : "id",
255          "xtype" : "Input",
256          "String inputType" : "hidden",
257          "$ xns" : "Roo.bootstrap"
258         }
259        ]
260       }
261      ]
262     },
263     {
264      "listeners" : {
265       "click" : "function (_self, e)\n{\n    _this.dialog.hide();\n}"
266      },
267      "String weight" : "default",
268      "xtype" : "Button",
269      "$ xns" : "Roo.bootstrap",
270      "String html" : "Cancel",
271      "* prop" : "buttons[]"
272     },
273     {
274      "listeners" : {
275       "render" : "function (_self)\n{\n    _this.btn_ok=this;\n}",
276       "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}"
277      },
278      "String weight" : "primary",
279      "xtype" : "Button",
280      "$ xns" : "Roo.bootstrap",
281      "String html" : "Save",
282      "* prop" : "buttons[]"
283     }
284    ]
285   }
286  ]
287 }