Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleTerms.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Pman.Dialog');
6
7 Pman.Dialog.XtupleTerms = {
8
9     dialog : false,
10     callback:  false,
11
12     show : function(data, cb)
13     {
14         if (!this.dialog) {
15             this.create();
16         }
17
18         this.callback = cb;
19         this.data = data;
20         this.dialog.show(this.data._el);
21         if (this.form) {
22            this.form.reset();
23            this.form.setValues(data);
24            this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
25         }
26
27     },
28
29     create : function()
30     {
31         var _this = this;
32         this.dialog = Roo.factory({
33             center : {
34                 '|xns' : 'Roo',
35                 xtype : 'LayoutRegion',
36                 xns : Roo
37             },
38             '|xns' : 'Roo',
39             modal : true,
40             collapsible : false,
41             title : "Create / Edit Terms",
42             xtype : 'LayoutDialog',
43             width : 550,
44             xns : Roo,
45             closable : false,
46             resizable : false,
47             height : 300,
48             buttons : [
49                  {
50                         '|xns' : 'Roo',
51                         text : "Cancel",
52                         xtype : 'Button',
53                         xns : Roo,
54                         listeners : {
55                                 click : function (_self, e)
56                                    {
57                                        _this.dialog.hide();
58                                    }
59                         }
60                     },
61 {
62                         '|xns' : 'Roo',
63                         text : "Save",
64                         xtype : 'Button',
65                         xns : Roo,
66                         listeners : {
67                                 click : function (_self, e)
68                                    {
69                                        // do some checks?
70                                         
71                                        
72                                     
73                                        _this.form.doAction("submit");
74                                    
75                                    }
76                         }
77                     }
78             ],
79             items : [
80                 {
81                     '|xns' : 'Roo',
82                     region : 'center',
83                     xtype : 'ContentPanel',
84                     xns : Roo,
85                     items : [
86                         {
87                             '|xns' : 'Roo.form',
88                             url : baseURL + '/Roo/terms.php',
89                             xtype : 'Form',
90                             method : 'POST',
91                             style : 'margin:10px;',
92                             xns : Roo.form,
93                             labelWidth : 150,
94                             listeners : {
95                                 actioncomplete : function(_self,action)
96                                    {
97                                        if (action.type == 'setdata') {
98                                            if (_this.data.id) { 
99                                                this.load({ method: 'GET', params: { _id : _this.data.id}});
100                                                return;
101                                            }
102                                            
103                                            return;
104                                        }
105                                        if (action.type == 'load') {
106                                            return;
107                                        }
108                                        if (action.type =='submit') {
109                                        
110                                            _this.dialog.hide();
111                                        
112                                             if (_this.callback) {
113                                                _this.callback.call(_this, _this.form.getValues());
114                                             }
115                                             
116                                             _this.form.reset();
117                                             return;
118                                        }
119                                    },
120                                 rendered : function (form)
121                                    {
122                                        _this.form= form;
123                                    }
124                             },
125                             items : [
126                                 {
127                                     '|xns' : 'Roo.form',
128                                     fieldLabel : 'Code',
129                                     xtype : 'TextField',
130                                     allowBlank : false,
131                                     width : 300,
132                                     xns : Roo.form,
133                                     name : 'terms_code'
134                                 },
135                                 {
136                                     '|xns' : 'Roo.form',
137                                     fieldLabel : 'Description',
138                                     width : 300,
139                                     xtype : 'TextArea',
140                                     xns : Roo.form,
141                                     name : 'terms_descrip'
142                                 },
143                                 {
144                                     '|xns' : 'Roo.form',
145                                     allowBlank : false,
146                                     fieldLabel : 'Due Days',
147                                     allowDecimals : true,
148                                     xtype : 'NumberField',
149                                     decimalPrecision : 0,
150                                     width : 300,
151                                     xns : Roo.form,
152                                     value : 0,
153                                     name : 'terms_duedays',
154                                     minValue : 0
155                                 },
156                                 {
157                                     '|xns' : 'Roo.form',
158                                     fieldLabel : 'Discount Day',
159                                     allowDecimals : true,
160                                     xtype : 'NumberField',
161                                     decimalPrecision : 0,
162                                     width : 300,
163                                     xns : Roo.form,
164                                     value : 0,
165                                     name : 'terms_discdays',
166                                     minValue : 0
167                                 },
168                                 {
169                                     '|xns' : 'Roo.form',
170                                     fieldLabel : 'Cut Off Day',
171                                     xtype : 'NumberField',
172                                     allowDecimals : true,
173                                     decimalPrecision : 0,
174                                     width : 300,
175                                     xns : Roo.form,
176                                     value : 0,
177                                     name : 'terms_cutoffday',
178                                     minValue : 0
179                                 },
180                                 {
181                                     '|xns' : 'Roo.form',
182                                     checked : true,
183                                     fieldLabel : 'Used in Payables',
184                                     xtype : 'Checkbox',
185                                     valueOff : 0,
186                                     xns : Roo.form,
187                                     inputValue : true,
188                                     name : 'terms_ap'
189                                 },
190                                 {
191                                     '|xns' : 'Roo.form',
192                                     checked : true,
193                                     fieldLabel : 'Used in Receivables',
194                                     xtype : 'Checkbox',
195                                     valueOff : 0,
196                                     xns : Roo.form,
197                                     inputValue : true,
198                                     name : 'terms_ar'
199                                 },
200                                 {
201                                     '|xns' : 'Roo.form',
202                                     xtype : 'Hidden',
203                                     xns : Roo.form,
204                                     name : 'terms_id'
205                                 }
206                             ]
207
208                         }
209                     ]
210
211                 }
212             ]
213
214         });
215     }
216 };