Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtuplePurchaseOrderEdit.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.XtuplePurchaseOrderEdit = {
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 () {
35                        this.layout.getRegion('center').showPanel(0);
36                 }
37             },
38             closable : false,
39             collapsible : false,
40             height : 200,
41             modal : true,
42             resizable : false,
43             title : "Change Location",
44             width : 400,
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                                 actioncomplete : function(_self,action)
56                                 {
57                                     if (action.type == 'setdata') {
58                                         if(_this.data.pohead_id){
59                                            _this.dialog.el.mask("Loading");
60                                            this.load({ method: 'GET', params: { '_id' : _this.data.pohead_id }});
61                                            return;
62                                        }
63                                     }
64                                     if (action.type == 'load') {
65                                         _this.dialog.el.unmask();
66                                         return;
67                                     }
68                                     if (action.type =='submit') {
69                                     
70                                         _this.dialog.el.unmask();
71                                         _this.dialog.hide();
72                                     
73                                          if (_this.callback) {
74                                             _this.callback.call(_this, _this.form.getValues());
75                                          }
76                                          _this.form.reset();
77                                          return;
78                                     }
79                                 },
80                                 rendered : function (form)
81                                 {
82                                     _this.form= form;
83                                 }
84                             },
85                             method : 'POST',
86                             style : 'margin:10px;',
87                             url : baseURL + '/Roo/pohead.php',
88                             items : [
89                                 {
90                                     xtype: 'TextField',
91                                     xns: Roo.form,
92                                     fieldLabel : 'PO#',
93                                     name : 'pohead_number',
94                                     readOnly : true,
95                                     width : 200
96                                 },
97                                 {
98                                     xtype: 'ComboBox',
99                                     xns: Roo.form,
100                                     allowBlank : false,
101                                     displayField : 'fname',
102                                     editable : false,
103                                     fieldLabel : 'Change Type',
104                                     hiddenName : 'change_type',
105                                     listWidth : 400,
106                                     mode : 'local',
107                                     name : 'change_type_name',
108                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{fname}</b> </div>',
109                                     triggerAction : 'all',
110                                     value : "A",
111                                     valueField : 'ftype',
112                                     width : 200,
113                                     store : {
114                                         xtype: 'SimpleStore',
115                                         xns: Roo.data,
116                                         data : [ 
117                                             [ 'A', "Change All Location"],
118                                             [ 'E', "Change The Location Of PO And un-signed Item"]
119                                             
120                                         ],
121                                         fields : [  'ftype', 'fname']
122                                     }
123                                 },
124                                 {
125                                     xtype: 'ComboBox',
126                                     xns: Roo.form,
127                                     allowBlank : false,
128                                     displayField : 'location_name',
129                                     editable : true,
130                                     emptyText : "Select a location",
131                                     fieldLabel : 'Location',
132                                     forceSelection : true,
133                                     hiddenName : 'pohead_location_id',
134                                     listWidth : 400,
135                                     loadingText : "Searching...",
136                                     minChars : 2,
137                                     name : 'pohead_location_id_location_name',
138                                     pageSize : 200,
139                                     qtip : "Select terms",
140                                     queryParam : 'query[location_name]',
141                                     selectOnFocus : true,
142                                     tpl : '<div class="x-grid-cell-text x-btn button"><b>{location_name}</b> </div>',
143                                     triggerAction : 'all',
144                                     typeAhead : false,
145                                     valueField : 'location_id',
146                                     width : 200,
147                                     store : {
148                                         xtype: 'Store',
149                                         xns: Roo.data,
150                                         listeners : {
151                                             beforeload : function (_self, o){
152                                                 o.params = o.params || {};
153                                                 // set more here
154                                                  o.params.location_netable = 1;
155                                             }
156                                         },
157                                         remoteSort : true,
158                                         sortInfo : { direction : 'ASC', field: 'location_name' },
159                                         proxy : {
160                                             xtype: 'HttpProxy',
161                                             xns: Roo.data,
162                                             method : 'GET',
163                                             url : baseURL + '/Roo/location.php'
164                                         },
165                                         reader : {
166                                             xtype: 'JsonReader',
167                                             xns: Roo.data,
168                                             id : 'location_id',
169                                             root : 'data',
170                                             totalProperty : 'total',
171                                             fields : [{"name":"location_id","type":"int"},"location_name"]
172                                         }
173                                     }
174                                 },
175                                 {
176                                     xtype: 'Hidden',
177                                     xns: Roo.form,
178                                     name : 'pohead_id'
179                                 }
180                             ]
181                         }
182                     ]
183                 }
184             ],
185             center : {
186                 xtype: 'LayoutRegion',
187                 xns: Roo
188             },
189             buttons : [
190                 {
191                     xtype: 'Button',
192                     xns: Roo,
193                     listeners : {
194                         click : function (_self, e)
195                         {
196                             _this.dialog.hide();
197                         }
198                     },
199                     text : "Cancel"
200                 },
201                 {
202                     xtype: 'Button',
203                     xns: Roo,
204                     listeners : {
205                         click : function (_self, e)
206                         {
207                             // do some checks?
208                              
209                             
210                            // _this.dialog.el.mask("Saving");
211                             _this.form.doAction("submit");
212                         
213                         }
214                     },
215                     text : "Save"
216                 }
217             ]
218         });
219     }
220 };