Pman.Dialog.XtupleCurrency.bjs
[Pman.Xtuple] / Pman.Dialog.XtupleCurrency.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.XtupleCurrency = {
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 : 400,
36             modal : true,
37             resizable : false,
38             title : "Edit / Create Currency",
39             width : 500,
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                                         if(_this.data.curr_id){
54                                             _this.dialog.el.mask("Loading");
55                                             this.load({ method: 'GET', params: { '_id' : _this.data.curr_id }});
56                                             return;
57                                         }
58                                         return;
59                                     }
60                                     if (action.type == 'load') {
61                                         _this.dialog.el.unmask();
62                                         return;
63                                     }
64                                     if (action.type =='submit') {
65                                     
66                                         _this.dialog.el.unmask();
67                                         _this.dialog.hide();
68                                     
69                                          if (_this.callback) {
70                                             _this.callback.call(_this, _this.form.getValues());
71                                          }
72                                          _this.form.reset();
73                                          return;
74                                     }
75                                 },
76                                 rendered : function (form)
77                                 {
78                                     _this.form= form;
79                                 }
80                             },
81                             method : 'POST',
82                             style : 'margin:10px;',
83                             url : baseURL + '/Roo/Groups.php',
84                             items : [
85                                 {
86                                     xtype: 'TextField',
87                                     xns: Roo.form,
88                                     fieldLabel : 'Name',
89                                     name : 'name',
90                                     width : 200
91                                 },
92                                 {
93                                     xtype: 'TextField',
94                                     xns: Roo.form,
95                                     fieldLabel : 'Type',
96                                     name : 'type',
97                                     width : 75
98                                 },
99                                 {
100                                     xtype: 'ComboBox',
101                                     xns: Roo.form,
102                                     allowBlank : false,
103                                     editable : false,
104                                     emptyText : "Select Person",
105                                     forceSelection : true,
106                                     listWidth : 400,
107                                     loadingText : "Searching...",
108                                     minChars : 2,
109                                     pageSize : 20,
110                                     qtip : "Select Person",
111                                     selectOnFocus : true,
112                                     triggerAction : 'all',
113                                     typeAhead : true,
114                                     width : 300,
115                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
116                                     queryParam : 'query[name]',
117                                     fieldLabel : 'Leader',
118                                     valueField : 'id',
119                                     displayField : 'name',
120                                     hiddenName : 'leader',
121                                     name : 'leader_name',
122                                     store : {
123                                         xtype: 'Store',
124                                         xns: Roo.data,
125                                         remoteSort : true,
126                                         sortInfo : { direction : 'ASC', field: 'id' },
127                                         listeners : {
128                                             beforeload : function (_self, o){
129                                                 o.params = o.params || {};
130                                                 // set more here
131                                             }
132                                         },
133                                         proxy : {
134                                             xtype: 'HttpProxy',
135                                             xns: Roo.data,
136                                             method : 'GET',
137                                             url : baseURL + '/Roo/Person.php'
138                                         },
139                                         reader : {
140                                             xtype: 'JsonReader',
141                                             xns: Roo.data,
142                                             id : 'id',
143                                             root : 'data',
144                                             totalProperty : 'total',
145                                             fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}]
146                                         }
147                                     }
148                                 },
149                                 {
150                                     xtype: 'Hidden',
151                                     xns: Roo.form,
152                                     name : 'id'
153                                 }
154                             ]
155                         }
156                     ]
157                 }
158             ],
159             center : {
160                 xtype: 'LayoutRegion',
161                 xns: Roo
162             },
163             buttons : [
164                 {
165                     xtype: 'Button',
166                     xns: Roo,
167                     listeners : {
168                         click : function (_self, e)
169                         {
170                             _this.dialog.hide();
171                         }
172                     },
173                     text : "Cancel"
174                 },
175                 {
176                     xtype: 'Button',
177                     xns: Roo,
178                     listeners : {
179                         click : function (_self, e)
180                         {
181                             // do some checks?
182                              
183                             
184                             _this.dialog.el.mask("Saving");
185                             _this.form.doAction("submit");
186                         
187                         }
188                     },
189                     text : "Save"
190                 }
191             ]
192         });
193     }
194 };