Pman.Dialog.XtupleBankAccnt.bjs
[Pman.Xtuple] / Pman.Dialog.XtupleBankAccnt.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Dialog.XtupleBankAccnt = {
6
7     dialog : false,
8     callback:  false,
9
10     show : function(data, cb)
11     {
12         if (!this.dialog) {
13             this.create();
14         }
15
16         this.callback = cb;
17         this.data = data;
18         this.dialog.show(this.data._el);
19         if (this.form) {
20            this.form.reset();
21            this.form.setValues(data);
22            this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
23         }
24
25     },
26
27     create : function()
28     {
29         var _this = this;
30         this.dialog = Roo.factory({
31             xtype: 'LayoutDialog',
32             xns: Roo,
33             closable : false,
34             collapsible : false,
35             height : 500,
36             modal : true,
37             resizable : false,
38             title : "Edit / Create Groups",
39             width : 400,
40             items : [
41                 {
42                     xtype: 'ContentPanel',
43                     xns: Roo,
44                     region : 'center',
45                     items : [
46                         {
47                             xtype: 'Form',
48                             xns: Roo.form,
49                             listeners : {
50                                 actioncomplete : function(_self,action)
51                                 {
52                                     if (action.type == 'setdata') {
53                                        //_this.dialog.el.mask("Loading");
54                                        //this.load({ method: 'GET', params: { '_id' : _this.data.id }});
55                                        return;
56                                     }
57                                     if (action.type == 'load') {
58                                         _this.dialog.el.unmask();
59                                         return;
60                                     }
61                                     if (action.type =='submit') {
62                                     
63                                         _this.dialog.el.unmask();
64                                         _this.dialog.hide();
65                                     
66                                          if (_this.callback) {
67                                             _this.callback.call(_this, _this.form.getValues());
68                                          }
69                                          _this.form.reset();
70                                          return;
71                                     }
72                                 },
73                                 rendered : function (form)
74                                 {
75                                     _this.form= form;
76                                 }
77                             },
78                             method : 'POST',
79                             style : 'margin:10px;',
80                             url : baseURL + '/Roo/Groups.php',
81                             items : [
82                                 {
83                                     xtype: 'TextField',
84                                     xns: Roo.form,
85                                     fieldLabel : 'Name',
86                                     name : 'name',
87                                     width : 200
88                                 },
89                                 {
90                                     xtype: 'TextField',
91                                     xns: Roo.form,
92                                     fieldLabel : 'Type',
93                                     name : 'type',
94                                     width : 75
95                                 },
96                                 {
97                                     xtype: 'ComboBox',
98                                     xns: Roo.form,
99                                     allowBlank : false,
100                                     editable : false,
101                                     emptyText : "Select Person",
102                                     forceSelection : true,
103                                     listWidth : 400,
104                                     loadingText : "Searching...",
105                                     minChars : 2,
106                                     pageSize : 20,
107                                     qtip : "Select Person",
108                                     selectOnFocus : true,
109                                     triggerAction : 'all',
110                                     typeAhead : true,
111                                     width : 300,
112                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
113                                     queryParam : 'query[name]',
114                                     fieldLabel : 'Leader',
115                                     valueField : 'id',
116                                     displayField : 'name',
117                                     hiddenName : 'leader',
118                                     name : 'leader_name',
119                                     store : {
120                                         xtype: 'Store',
121                                         xns: Roo.data,
122                                         remoteSort : true,
123                                         sortInfo : { direction : 'ASC', field: 'id' },
124                                         listeners : {
125                                             beforeload : function (_self, o){
126                                                 o.params = o.params || {};
127                                                 // set more here
128                                             }
129                                         },
130                                         proxy : {
131                                             xtype: 'HttpProxy',
132                                             xns: Roo.data,
133                                             method : 'GET',
134                                             url : baseURL + '/Roo/Person.php'
135                                         },
136                                         reader : {
137                                             xtype: 'JsonReader',
138                                             xns: Roo.data,
139                                             id : 'id',
140                                             root : 'data',
141                                             totalProperty : 'total',
142                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
143                                         }
144                                     }
145                                 },
146                                 {
147                                     xtype: 'Hidden',
148                                     xns: Roo.form,
149                                     name : 'id'
150                                 }
151                             ]
152                         }
153                     ]
154                 }
155             ],
156             center : {
157                 xtype: 'LayoutRegion',
158                 xns: Roo
159             },
160             buttons : [
161                 {
162                     xtype: 'Button',
163                     xns: Roo,
164                     listeners : {
165                         click : function (_self, e)
166                         {
167                             _this.dialog.hide();
168                         }
169                     },
170                     text : "Cancel"
171                 },
172                 {
173                     xtype: 'Button',
174                     xns: Roo,
175                     listeners : {
176                         click : function (_self, e)
177                         {
178                             // do some checks?
179                              
180                             
181                             _this.dialog.el.mask("Saving");
182                             _this.form.doAction("submit");
183                         
184                         }
185                     },
186                     text : "Save"
187                 }
188             ]
189         });
190     }
191 };