Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleVendTypeEdit.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.XtupleVendTypeEdit = {
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 : 140,
36             modal : true,
37             resizable : false,
38             title : "Edit / Create Vendor Type",
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                                         if(_this.data.vendtype_id){
54                                             _this.dialog.el.mask("Loading");
55                                             this.load({ method: 'GET', params: { '_id' : _this.data.vendtype_id }});
56                                         }
57                                        return;
58                                     }
59                                     if (action.type == 'load') {
60                                         _this.data = action.result.data;
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, action.result.data);
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/Vendtype.php',
84                             items : [
85                                 {
86                                     xtype: 'TextField',
87                                     xns: Roo.form,
88                                     fieldLabel : 'Code',
89                                     name : 'vendtype_code',
90                                     width : 200
91                                 },
92                                 {
93                                     xtype: 'TextField',
94                                     xns: Roo.form,
95                                     fieldLabel : 'Description',
96                                     name : 'vendtype_descrip',
97                                     width : 200
98                                 },
99                                 {
100                                     xtype: 'Hidden',
101                                     xns: Roo.form,
102                                     name : 'vendtype_id'
103                                 }
104                             ]
105                         }
106                     ]
107                 }
108             ],
109             center : {
110                 xtype: 'LayoutRegion',
111                 xns: Roo
112             },
113             buttons : [
114                 {
115                     xtype: 'Button',
116                     xns: Roo,
117                     listeners : {
118                         click : function (_self, e)
119                         {
120                             _this.dialog.hide();
121                         }
122                     },
123                     text : "Cancel"
124                 },
125                 {
126                     xtype: 'Button',
127                     xns: Roo,
128                     listeners : {
129                         click : function (_self, e)
130                         {
131                             _this.form.doAction("submit");
132                         
133                         }
134                     },
135                     text : "Save"
136                 }
137             ]
138         });
139     }
140 };