modal : true,
resizable : false,
title : "Edit / Create Vendor",
- width : 550,
+ width : 600,
items : [
{
xtype: 'ContentPanel',
listeners : {
render : function()
{
- _this.sgrid = this;
+ _this.agrid = this;
//_this.dialog = Pman.Dialog.FILL_IN
- if (_this.spanel.active) {
+ if (_this.apanel.active) {
this.footer.onClick('first');
}
}
},
- autoExpandColumn : 'vendaddr_code',
+ autoExpandColumn : 'vendaddr_addr_id_addr_line1',
loadMask : true,
+ sm : {
+ xtype: 'RowSelectionModel',
+ xns: Roo.grid,
+ singleSelect : true
+ },
dataSource : {
xtype: 'Store',
xns: Roo.data,
{
xtype: 'Fill',
xns: Roo.Toolbar
+ },
+ {
+ xtype: 'Button',
+ xns: Roo.Toolbar,
+ listeners : {
+ click : function (_self, e)
+ {
+ var id = _this.form.findField('vend_id').getValue();
+
+ if(id * 1 < 1){
+ Roo.MessageBox.alert('Error', 'Please save the vendor first');
+ return;
+ }
+
+ Pman.Dialog.Image.show(
+ {
+ _url : baseURL+'/Xtuple/Import/VendAddrInfo?' + Roo.urlEncode({'vend_id' : id})
+
+ },
+ function (data) {
+ _this.agrid.footer.onClick('first');
+ }
+ );
+ }
+ },
+ text : "Upload"
+ },
+ {
+ xtype: 'Button',
+ xns: Roo.Toolbar,
+ listeners : {
+ click : function()
+ {
+ var s = _this.agrid.getSelectionModel().getSelected();
+
+ if(!s || s.data.vendaddr_id * 1 < 1){
+ Roo.MessageBox.alert('Error', 'Please select a row');
+ return;
+ }
+
+ Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete that?",
+ function(v) {
+ if (v != 'yes') {
+ return;
+ }
+ new Pman.Request({
+ method: 'POST',
+ url: baseURL+ '/Roo/vendaddrinfo',
+ params : {
+ _delete : s.data.vendaddr_id
+ },
+ success : function() {
+ _this.agrid.footer.onClick('refresh');
+ }
+ });
+ });
+ }
+ },
+ cls : 'x-btn-text-icon',
+ text : "Delete",
+ icon : rootURL + '/Pman/templates/images/trash.gif'
+ },
+ {
+ xtype: 'Button',
+ xns: Roo.Toolbar,
+ listeners : {
+ click : function()
+ {
+ var s = _this.form.findField('vend_id').getValue() * 1;
+
+ if(!s || s * 1 < 1){
+ Roo.MessageBox.alert('Error', 'Save first!');
+ return;
+ }
+
+ Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete all the address?",
+ function(v) {
+ if (v != 'yes') {
+ return;
+ }
+ new Pman.Request({
+ method: 'POST',
+ url: baseURL+ '/Roo/vendinfo',
+ params : {
+ vend_id : s,
+ _remove_addr : 1
+ },
+ success : function() {
+ _this.agrid.footer.onClick('refresh');
+ }
+ });
+ });
+ }
+ },
+ cls : 'x-btn-text-icon',
+ text : "Delete All",
+ icon : rootURL + '/Pman/templates/images/trash.gif'
}
]
},
xns: Roo.grid,
dataIndex : 'vendaddr_code',
header : 'Code',
- width : 100,
+ width : 75,
renderer : function(v) { return String.format('{0}', v); }
},
{
xtype: 'ColumnModel',
xns: Roo.grid,
- dataIndex : 'vendaddr_name',
- header : 'Name',
+ dataIndex : 'vendaddr_addr_id_addr_city',
+ header : 'District',
width : 100,
renderer : function(v) { return String.format('{0}', v); }
},
{
xtype: 'ColumnModel',
xns: Roo.grid,
- dataIndex : 'itemsrc_leadtime',
- header : 'Lead time',
- width : 75,
+ dataIndex : 'vendaddr_addr_id_addr_line1',
+ header : 'Address Line 1',
+ width : 200,
renderer : function(v) { return String.format('{0}', v); }
},
{
xtype: 'ColumnModel',
xns: Roo.grid,
- dataIndex : 'itemsrc_active',
- header : 'Active',
- width : 75,
+ dataIndex : 'vendaddr_addr_id_addr_line2',
+ header : 'Address Line 2',
+ width : 200,
renderer : function(v) { return String.format('{0}', v); }
}
]