Pman.Dialog.AdminGenericName.js
[Pman.Admin] / Pman.Dialog.AdminGenericName.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.AdminGenericName = {
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 : 80,
36             resizable : false,
37             title : "Edit / Create core_company_type",
38             width : 400,
39             items : [
40                 {
41                     xtype: 'ContentPanel',
42                     xns: Roo,
43                     region : 'center',
44                     items : [
45                         {
46                             xtype: 'Form',
47                             xns: Roo.form,
48                             listeners : {
49                                 actioncomplete : function(_self,action)
50                                 {
51                                     if (action.type == 'setdata') {
52                                        //_this.dialog.el.mask("Loading");
53                                        //this.load({ method: 'GET', params: { '_id' : _this.data.id }});
54                                        return;
55                                     }
56                                     if (action.type == 'load') {
57                                         _this.dialog.el.unmask();
58                                         return;
59                                     }
60                                     if (action.type =='submit') {
61                                     
62                                         _this.dialog.el.unmask();
63                                         _this.dialog.hide();
64                                     
65                                          if (_this.callback) {
66                                             _this.callback.call(_this, _this.form.getValues());
67                                          }
68                                          _this.form.reset();
69                                          return;
70                                     }
71                                 },
72                                 rendered : function (form)
73                                 {
74                                     _this.form= form;
75                                 }
76                             },
77                             method : 'POST',
78                             style : 'margin:10px;',
79                             url : baseURL + '/Roo/core_company_type.php',
80                             items : [
81                                 {
82                                     xtype: 'TextField',
83                                     xns: Roo.form,
84                                     fieldLabel : 'Name',
85                                     name : 'name',
86                                     width : 200
87                                 },
88                                 {
89                                     xtype: 'Hidden',
90                                     xns: Roo.form,
91                                     name : 'id'
92                                 }
93                             ]
94                         }
95                     ]
96                 }
97             ],
98             center : {
99                 xtype: 'LayoutRegion',
100                 xns: Roo
101             },
102             buttons : [
103                 {
104                     xtype: 'Button',
105                     xns: Roo,
106                     listeners : {
107                         click : function (_self, e)
108                         {
109                             _this.dialog.hide();
110                         }
111                     },
112                     text : "Cancel"
113                 },
114                 {
115                     xtype: 'Button',
116                     xns: Roo,
117                     listeners : {
118                         click : function (_self, e)
119                         {
120                             // do some checks?
121                              
122                             
123                             _this.dialog.el.mask("Saving");
124                             _this.form.doAction("submit");
125                         
126                         }
127                     },
128                     text : "Save"
129                 }
130             ]
131         });
132     }
133 };