1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Pman.Dialog.XtupleAddress = {
10 show : function(data, cb)
18 this.dialog.show(this.data._el);
21 this.form.setValues(data);
22 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
30 this.dialog = Roo.factory({
31 xtype: 'LayoutDialog',
38 title : "Edit Address",
42 xtype: 'ContentPanel',
50 actioncomplete : function(_self,action)
52 if (action.type == 'setdata') {
53 if (_this.data.addr_id) {
54 this.load({ method: 'GET', params: { '_id' : _this.data.addr_id }});
58 if (action.type == 'load') {
61 if (action.type =='submit') {
66 _this.form.setValues(action.result.data);
67 _this.callback.call(_this, _this.form.getValues());
73 rendered : function (form)
79 style : 'margin:10px;',
80 url : baseURL + '/Roo/addr.php',
86 keyup : function (_self, e)
88 _this.form.findField('addr_number').sync();
92 fieldLabel : 'Line 1',
99 fieldLabel : 'Line 2',
106 fieldLabel : 'Line 3',
121 displayField : 'addr_state',
124 fieldLabel : 'State',
126 loadingText : "Searching...",
129 qtip : "Select State",
130 queryParam : 'query[addr_state]',
131 selectOnFocus : true,
132 tpl : '<div class="x-grid-cell-text x-btn button"><b>{addr_state}</b></div>',
133 triggerAction : 'all',
135 valueField : 'addr_state',
141 beforeload : function (_self, o){
142 o.params = o.params || {};
144 // o.params.state_country_id_country_name = _this.form.findField('addr_country').getValue();
145 //if (!o.params.state_country_id_country_name.length) {
146 // Roo.MessageBox.alert("Select Country First");
150 o.params._distinct = 'addr_state';
151 o.params._columns = 'addr_state';
152 o.params.limit = 999;
157 sortInfo : { direction : 'ASC', field: 'addr_state' },
162 url : baseURL + '/Roo/addr.php'
169 totalProperty : 'total',
170 fields : [ 'addr_state' ]
178 displayField : 'country_name',
180 emptyText : "Country",
181 fieldLabel : 'Country',
183 loadingText : "Searching...",
185 name : 'addr_country',
186 qtip : "Select Country",
187 queryParam : 'query[country_name]',
188 selectOnFocus : true,
189 tpl : '<div class="x-grid-cell-text x-btn button"><b>{country_name}</b> </div>',
190 triggerAction : 'all',
192 valueField : 'country_name',
198 beforeload : function (_self, o){
199 o.params = o.params || {};
201 o.params.limit = 999;
205 sortInfo : { direction : 'ASC', field: 'country_name' },
210 url : baseURL + '/Roo/country.php'
217 totalProperty : 'total',
218 fields : [{'name':'country_id','type':'int'},'county_name']
225 fieldLabel : 'postalcode',
226 name : 'addr_postalcode',
232 fieldLabel : 'Unique#',
233 name : 'addr_number',
236 if (_this.form.findField('addr_id') * 1 > 0 ) {
239 this.setValue('C' + _this.form.findField('customer_id').getValue() + '-' +
240 _this.form.findField('addr_line1').getValue()
248 fieldLabel : 'notes',
255 name : 'customer_id',
281 var id = _this.form.findField('addr_id').getValue() *1;
283 Roo.MessageBox.alert("Error", "You can not delete this, you have not created it yet");
288 Roo.MessageBox.confirm("Confirm", "You will only be able to delete this if it is not referenced anywhere<BR>"+
289 ", are you sure you want to try that?",
297 url: baseURL+ '/Roo/addr',
301 success : function() {
302 _this.callback({ addr_id : 0, addr_line1 : '' });
312 cls : 'x-btn-text-icon',
314 icon : rootURL + '/Pman/templates/images/trash.gif'
321 xtype: 'LayoutRegion',
329 click : function (_self, e)
340 click : function (_self, e)
346 _this.form.doAction('submit');