Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleSalesOrderCopy.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.XtupleSalesOrderCopy = {
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             listeners : {
34                 show : function (_self)
35                 {
36                     _this.form.findField('scheddate').focus();
37                 }
38             },
39             closable : false,
40             height : 120,
41             modal : true,
42             resizable : false,
43             title : "Copy  Sales Order",
44             width : 500,
45             items : [
46                 {
47                     xtype: 'ContentPanel',
48                     xns: Roo,
49                     region : 'center',
50                     items : [
51                         {
52                             xtype: 'Form',
53                             xns: Roo.form,
54                             listeners : {
55                                 rendered : function (form)
56                                 {
57                                   _this.form = form;
58                                 },
59                                 actioncomplete : function(_self,action)
60                                 {
61                                     if (action.type == 'setdata') {
62                                         this.findField('_copy_cohead_id').setValue(_this.data._copy_cohead_id);
63                                        return;
64                                     }
65                                     if (action.type == 'load') {
66                                         return;
67                                     }
68                                     if (action.type =='submit') {
69                                     
70                                         _this.dialog.hide();
71                                     
72                                          if (_this.callback) {
73                                             // _this.form.setValues(action.result.data);
74                                             _this.callback.call(_this,action.result.data);
75                                          }
76                                          _this.form.reset();
77                                          return;
78                                     }
79                                 }
80                             },
81                             labelAlign : 'right',
82                             labelWidth : 200,
83                             method : 'POST',
84                             url : baseURL + '/Roo/cohead',
85                             items : [
86                                 {
87                                     xtype: 'DateField',
88                                     xns: Roo.form,
89                                     allowBlank : false,
90                                     fieldLabel : 'New Expected Delivery Date',
91                                     format : 'd/m/Y',
92                                     name : 'scheddate',
93                                     useIso : true
94                                 },
95                                 {
96                                     xtype: 'Hidden',
97                                     xns: Roo.form,
98                                     name : '_copy_cohead_id'
99                                 }
100                             ]
101                         }
102                     ]
103                 }
104             ],
105             center : {
106                 xtype: 'LayoutRegion',
107                 xns: Roo
108             },
109             buttons : [
110                 {
111                     xtype: 'Button',
112                     xns: Roo,
113                     listeners : {
114                         click : function (_self, e)
115                         {
116                            _this.dialog.hide();
117                          
118                          }
119                     },
120                     text : "Cancel"
121                 },
122                 {
123                     xtype: 'Button',
124                     xns: Roo,
125                     listeners : {
126                         click : function (_self, e)
127                         {
128                            //_this.findField('cuinfo_
129                            
130                            // check if customer is filled in.
131                            if (!_this.form.isValid()) {
132                                 Roo.MessageBox.alert("Error", "Fill in a date");
133                                 return;
134                            }
135                            _this.form.submit();
136                            
137                         }
138                     },
139                     text : "OK"
140                 }
141             ]
142         });
143     }
144 };