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 : 200,
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/Curr_symbol.php',
84                             items : [
85                                 {
86                                     xtype: 'TextField',
87                                     xns: Roo.form,
88                                     fieldLabel : 'Name',
89                                     name : 'curr_name',
90                                     width : 200
91                                 },
92                                 {
93                                     xtype: 'TextField',
94                                     xns: Roo.form,
95                                     fieldLabel : 'Symbol',
96                                     name : 'curr_symbol',
97                                     width : 200
98                                 },
99                                 {
100                                     xtype: 'TextField',
101                                     xns: Roo.form,
102                                     fieldLabel : 'Abbr.',
103                                     name : 'curr_abbr',
104                                     width : 200
105                                 },
106                                 {
107                                     xtype: 'Checkbox',
108                                     xns: Roo.form,
109                                     boxLabel : 'Yes / No',
110                                     fieldLabel : 'Base',
111                                     inputValue : 1,
112                                     name : 'visible',
113                                     value : 0,
114                                     valueOff : 0
115                                 },
116                                 {
117                                     xtype: 'Hidden',
118                                     xns: Roo.form,
119                                     name : 'curr_id'
120                                 }
121                             ]
122                         }
123                     ]
124                 }
125             ],
126             center : {
127                 xtype: 'LayoutRegion',
128                 xns: Roo
129             },
130             buttons : [
131                 {
132                     xtype: 'Button',
133                     xns: Roo,
134                     listeners : {
135                         click : function (_self, e)
136                         {
137                             _this.dialog.hide();
138                         }
139                     },
140                     text : "Cancel"
141                 },
142                 {
143                     xtype: 'Button',
144                     xns: Roo,
145                     listeners : {
146                         click : function (_self, e)
147                         {
148                             _this.form.doAction("submit");
149                         
150                         }
151                     },
152                     text : "Save"
153                 }
154             ]
155         });
156     }
157 };