modal : true,
resizable : false,
title : "Edit / Create Vendor",
- width : 550,
+ width : 600,
items : [
{
xtype: 'ContentPanel',
xns: Roo,
listeners : {
activate : function() {
- _this.panel = this;
- if (_this.grid) {
- _this.grid.footer.onClick('first');
+ _this.apanel = this;
+ if (_this.agrid) {
+ _this.agrid.footer.onClick('first');
}
}
},
fitToframe : true,
region : 'center',
tableName : 'vendaddrinfo',
- title : "Supplier of",
+ title : "Addresses",
grid : {
xtype: 'Grid',
xns: Roo.grid,
listeners : {
render : function()
{
- _this.grid = this;
+ _this.agrid = this;
//_this.dialog = Pman.Dialog.FILL_IN
- if (_this.panel.active) {
+ if (_this.apanel.active) {
this.footer.onClick('first');
}
- },
- rowdblclick : function (_self, rowIndex, e)
- {
-
- Pman.Dialog.XtupleItem.show({ item_id : this.getDataSource().getAt(rowIndex).data.itemsrc_item_id }, function() {
- _this.grid.footer.onClick('first');
- });
}
},
- autoExpandColumn : 'itemsrc_vend_item_descrip',
+ autoExpandColumn : 'vendaddr_addr_id_addr_line1',
loadMask : true,
+ sm : {
+ xtype: 'RowSelectionModel',
+ xns: Roo.grid,
+ singleSelect : true
+ },
dataSource : {
xtype: 'Store',
xns: Roo.data,
listeners : {
beforeload : function (_self, options)
{
- options.params.itemsrc_vend_id = _this.form.findField('vend_id').getValue();
- var s = _this.searchBox.getValue();
- if (s.length) {
- options.params['search[name]'] = s;
+ options.params = options.params || {};
+
+ var id = _this.form.findField('vend_id').getValue();
+
+ if(id * 1 < 1){
+ return false;
}
+
+ options.params.vendaddr_vend_id = id;
}
},
remoteSort : true,
- sortInfo : { field : 'itemsrc_item_id_item_number', direction: 'ASC' },
+ sortInfo : { field : 'vendaddr_id', direction: 'ASC' },
proxy : {
xtype: 'HttpProxy',
xns: Roo.data,
method : 'GET',
- url : baseURL + '/Roo/itemsrc.php'
+ url : baseURL + '/Roo/vendaddrinfo.php'
},
reader : {
xtype: 'JsonReader',
xns: Roo.data,
- totalProperty : 'total',
+ id : 'vendaddr_id',
root : 'data',
- id : 'id',
+ totalProperty : 'total',
fields : [
{
- 'name': 'itemsrc_id',
- 'type': 'int'
- },
- {
- 'name': 'itemsrc_item_id',
- 'type': 'int'
- },
- {
- 'name': 'itemsrc_item_id',
- 'type': 'int'
- },
- {
- 'name': 'itemsrc_vend_id',
- 'type': 'int'
- },
- {
- 'name': 'itemsrc_vend_id',
- 'type': 'int'
- },
- {
- 'name': 'itemsrc_vend_item_number',
- 'type': 'string'
- },
- {
- 'name': 'itemsrc_vend_item_descrip',
- 'type': 'string'
- },
- {
- 'name': 'itemsrc_comments',
- 'type': 'string'
- },
- {
- 'name': 'itemsrc_vend_uom',
- 'type': 'string'
- },
- {
- 'name': 'itemsrc_invvendoruomratio',
- 'type': 'float'
- },
- {
- 'name': 'itemsrc_minordqty',
- 'type': 'float'
- },
- {
- 'name': 'itemsrc_multordqty',
- 'type': 'float'
- },
- {
- 'name': 'itemsrc_leadtime',
- 'type': 'int'
- },
- {
- 'name': 'itemsrc_ranking',
- 'type': 'int'
- },
- {
- 'name': 'itemsrc_active',
+ 'name': 'vendaddr_id',
'type': 'int'
},
{
- 'name': 'itemsrc_manuf_name',
- 'type': 'string'
- },
- {
- 'name': 'itemsrc_manuf_item_number',
- 'type': 'string'
- },
- {
- 'name': 'itemsrc_manuf_item_descrip',
- 'type': 'string'
- },
- {
- 'name': 'itemsrc_default',
+ 'name': 'vendaddr_vend_id',
'type': 'int'
},
{
- 'name': 'itemsrc_upccode',
+ 'name': 'vendaddr_code',
'type': 'string'
}
]
xtype: 'PagingToolbar',
xns: Roo,
displayInfo : true,
- displayMsg : "Displaying itemsrc{0} - {1} of {2}",
- emptyMsg : "No itemsrc found",
+ displayMsg : "Displaying address{0} - {1} of {2}",
+ emptyMsg : "Nothing found",
pageSize : 100
},
toolbar : {
xns: Roo,
items : [
{
- xtype: 'TextField',
- xns: Roo.form,
- listeners : {
- render : function (_self)
- {
- _this.searchBox = _self;
- },
- specialkey : function (_self, e)
- {
- _this.grid.footer.onClick('first');
- }
- }
- },
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
- listeners : {
- click : function (_self, e)
- {
- _this.grid.footer.onClick('first');
- }
- },
- cls : 'x-btn-icon',
- icon : rootURL + '/Pman/templates/images/search.gif'
+ xtype: 'Fill',
+ xns: Roo.Toolbar
},
{
xtype: 'Button',
listeners : {
click : function (_self, e)
{
- _this.searchBox.setValue('');
+ var id = _this.form.findField('vend_id').getValue();
- _this.grid.footer.onClick('first');
+ 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');
+ }
+ );
}
},
- cls : 'x-btn-icon',
- icon : rootURL + '/Pman/templates/images/edit-clear.gif'
- },
- {
- xtype: 'Fill',
- xns: Roo.Toolbar
+ text : "Upload"
},
{
xtype: 'Button',
listeners : {
click : function()
{
-
- Pman.Dialog.XtupleSalesProductList.show({
- exclude_itemsrc_vendor : _this.form.findField('vend_id').getValue(),
- multi_select : true
-
- }, function(sels) {
- Roo.log(sels);
-
- var ids = [];
- Roo.each(sels,function(rec) {
- ids.push(rec.data.item_id);
- });
- new Pman.Request({
- mask: "Adding",
- url : baseURL + '/Roo/Itemsrc',
- method: 'POST',
- params : {
- add_multiple : ids.join(','),
- itemsrc_vend_id : _this.form.findField('vend_id').getValue()
- },
- success : function() {
-
-
- _this.grid.footer.onClick('first');
- }
- });
-
-
+ 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 : "Add",
- icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
+ text : "Delete",
+ icon : rootURL + '/Pman/templates/images/trash.gif'
},
{
xtype: 'Button',
listeners : {
click : function()
{
- Pman.genericDelete(_this, 'itemsrc');
+ 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",
+ text : "Delete All",
icon : rootURL + '/Pman/templates/images/trash.gif'
}
]
{
xtype: 'ColumnModel',
xns: Roo.grid,
- dataIndex : 'itemsrc_item_id_item_number',
- header : 'Item',
- width : 120,
+ dataIndex : 'vendaddr_code',
+ header : 'Code',
+ width : 75,
renderer : function(v) { return String.format('{0}', v); }
},
{
xtype: 'ColumnModel',
xns: Roo.grid,
- dataIndex : 'itemsrc_vend_item_number',
- header : 'Vendor item number',
- width : 120,
+ 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_vend_item_descrip',
- header : 'Vendor item description',
+ 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_vend_uom',
- header : 'Uom',
- width : 50,
- renderer : function(v) { return String.format('{0}', v); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'itemsrc_minordqty',
- header : 'Min ord qty',
- width : 50,
- renderer : function(v) { return String.format('{0}', v); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'itemsrc_leadtime',
- header : 'Lead time',
- width : 75,
- 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); }
}
]