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