erp_orders 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/GPL-3-LICENSE +674 -0
- data/README.rdoc +2 -0
- data/Rakefile +30 -0
- data/app/assets/javascripts/erp_orders/application.js +9 -0
- data/app/assets/stylesheets/erp_orders/application.css +7 -0
- data/app/controllers/erp_orders/erp_app/desktop/order_manager/base_controller.rb +147 -0
- data/app/controllers/erp_orders/erp_app/organizer/order_management/base_controller.rb +19 -0
- data/app/helpers/erp_orders/application_helper.rb +4 -0
- data/app/models/charge_line.rb +21 -0
- data/app/models/charge_line_payment_txn.rb +5 -0
- data/app/models/extensions/agreement.rb +6 -0
- data/app/models/extensions/money.rb +3 -0
- data/app/models/extensions/party.rb +3 -0
- data/app/models/extensions/product_instance.rb +3 -0
- data/app/models/extensions/product_type.rb +3 -0
- data/app/models/line_item_role_type.rb +4 -0
- data/app/models/order_line_item.rb +27 -0
- data/app/models/order_line_item_pty_role.rb +35 -0
- data/app/models/order_line_item_type.rb +4 -0
- data/app/models/order_txn.rb +381 -0
- data/app/models/order_txn_type.rb +4 -0
- data/app/views/layouts/erp_orders/application.html.erb +14 -0
- data/config/routes.rb +14 -0
- data/db/data_migrations/20110605231556_create_order_party_roles.rb +23 -0
- data/db/data_migrations/20110728201731_create_desktop_app_order_manager.rb +25 -0
- data/db/data_migrations/20110728201732_create_organizer_app_order_management.rb +14 -0
- data/db/migrate/20080805000060_base_orders.rb +175 -0
- data/db/migrate/20110602194707_update_order_txn_ship_to_bill_to.rb +25 -0
- data/lib/erp_orders/engine.rb +13 -0
- data/lib/erp_orders/extensions/active_record/acts_as_order_txn.rb +111 -0
- data/lib/erp_orders/extensions.rb +1 -0
- data/lib/erp_orders/version.rb +3 -0
- data/lib/erp_orders.rb +5 -0
- data/lib/tasks/erp_orders_tasks.rake +4 -0
- data/public/javascripts/erp_app/desktop/applications/order_manager/line_items_grid_panel.js +100 -0
- data/public/javascripts/erp_app/desktop/applications/order_manager/module.js +85 -0
- data/public/javascripts/erp_app/desktop/applications/order_manager/orders_grid_panel.js +163 -0
- data/public/javascripts/erp_app/desktop/applications/order_manager/payments_grid_panel.js +109 -0
- data/public/javascripts/erp_app/organizer/applications/order_management/base.js +127 -0
- data/public/javascripts/erp_app/organizer/applications/order_management/extensions.js +115 -0
- data/public/javascripts/erp_app/organizer/applications/order_management/line_items_grid_panel.js +99 -0
- data/public/javascripts/erp_app/organizer/applications/order_management/orders_grid_panel.js +205 -0
- data/public/javascripts/erp_app/organizer/applications/order_management/payments_grid_panel.js +93 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config/application.rb +49 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +8 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/spec.rb +27 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/models/charge_line_payment_txn_spec.rb +11 -0
- data/spec/models/charge_line_spec.rb +11 -0
- data/spec/models/line_item_role_type_spec.rb +11 -0
- data/spec/models/order_line_item_pty_role_spec.rb +13 -0
- data/spec/models/order_line_item_spec.rb +12 -0
- data/spec/models/order_line_item_type_spec.rb +14 -0
- data/spec/models/order_txn_spec.rb +11 -0
- data/spec/models/order_txn_type_spec.rb +11 -0
- data/spec/spec_helper.rb +60 -0
- metadata +203 -0
@@ -0,0 +1,111 @@
|
|
1
|
+
module ErpOrders
|
2
|
+
module Extensions
|
3
|
+
module ActiveRecord
|
4
|
+
module ActsAsOrderTxn
|
5
|
+
def self.included(base)
|
6
|
+
base.extend(ClassMethods)
|
7
|
+
end
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
|
11
|
+
def acts_as_order_txn
|
12
|
+
extend ActsAsOrderTxn::SingletonMethods
|
13
|
+
include ActsAsOrderTxn::InstanceMethods
|
14
|
+
|
15
|
+
after_initialize :initialize_order_txn
|
16
|
+
after_create :save_order_txn
|
17
|
+
after_update :save_order_txn
|
18
|
+
after_destroy :destroy_order_txn
|
19
|
+
|
20
|
+
has_one :order_txn, :as => :order_txn_record
|
21
|
+
|
22
|
+
#from OrderTxn
|
23
|
+
[ :bill_to_address_line_1,:bill_to_address_line_1=,
|
24
|
+
:bill_to_city,:bill_to_city=,
|
25
|
+
:bill_to_country,:bill_to_country=,
|
26
|
+
:bill_to_country_name,:bill_to_country_name=,
|
27
|
+
:bill_to_first_name,:bill_to_first_name=,
|
28
|
+
:bill_to_last_name,:bill_to_last_name=,
|
29
|
+
:bill_to_postal_code,:bill_to_postal_code=,
|
30
|
+
:bill_to_state,:bill_to_state=,
|
31
|
+
:Company,:Company=,
|
32
|
+
:credit_card_id,:credit_card_id=,
|
33
|
+
:customer_ip,:customer_ip=,
|
34
|
+
:email,:email=,
|
35
|
+
:error_message,:error_message=,
|
36
|
+
:Fax,:Fax=,
|
37
|
+
:description,:description=,
|
38
|
+
:order_number,:order_number=,
|
39
|
+
:order_txn_type_id,:order_txn_type_id=,
|
40
|
+
:payment_gateway_txn_id,:payment_gateway_txn_id=,
|
41
|
+
:Phone2,:Phone2=,
|
42
|
+
:phone_number,:phone_number=,
|
43
|
+
:Salutation,:Salutation=,
|
44
|
+
:ship_to_address_line_1,:ship_to_address_line_1=,
|
45
|
+
:ship_to_city,:ship_to_city=,
|
46
|
+
:ship_to_country,:ship_to_country=,
|
47
|
+
:ship_to_country_name,:ship_to_country_name=,
|
48
|
+
:ship_to_first_name,:ship_to_first_name=,
|
49
|
+
:ship_to_last_name,:ship_to_last_name=,
|
50
|
+
:ship_to_postal_code,:ship_to_postal_code=,
|
51
|
+
:ship_to_state,:ship_to_state=,
|
52
|
+
:state_machine,:state_machine=,
|
53
|
+
:status,:status=,
|
54
|
+
:add_line_item,
|
55
|
+
:line_items,
|
56
|
+
:order_line_items,
|
57
|
+
:determine_txn_party_roles,
|
58
|
+
:determine_charge_elements,
|
59
|
+
:determine_charge_accounts,
|
60
|
+
:process,
|
61
|
+
:set_shipping_info,
|
62
|
+
:set_billing_info,
|
63
|
+
:authorize_payments,
|
64
|
+
:capture_payments,
|
65
|
+
:rollback_authorizations,
|
66
|
+
:submit
|
67
|
+
].each { |m| delegate m, :to => :order_txn }
|
68
|
+
|
69
|
+
#from OrderTxn And BizTxnEvent
|
70
|
+
[:biz_txn,
|
71
|
+
:biz_txn_event,
|
72
|
+
:root_txn,
|
73
|
+
:find_party_by_role,
|
74
|
+
:txn_type,:txn_type=,
|
75
|
+
:txn_type_iid,:txn_type_iid=,:create_dependent_txns,
|
76
|
+
:account,:account=].each { |m| delegate m, :to => :order_txn }
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
module SingletonMethods
|
84
|
+
end
|
85
|
+
|
86
|
+
module InstanceMethods
|
87
|
+
def order
|
88
|
+
self.order_txn
|
89
|
+
end
|
90
|
+
|
91
|
+
def initialize_order_txn
|
92
|
+
if self.new_record? && self.order_txn == nil
|
93
|
+
self.order_txn = OrderTxn.new
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def save_order_txn
|
98
|
+
self.order_txn.save
|
99
|
+
end
|
100
|
+
|
101
|
+
def destroy_order_txn
|
102
|
+
if self.order && !self.order.frozen?
|
103
|
+
self.order.destroy
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'erp_orders/extensions/active_record/acts_as_order_txn'
|
data/lib/erp_orders.rb
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.OrderManager.OrderLineItemsGridPanel",{
|
2
|
+
extend:"Ext.grid.Panel",
|
3
|
+
alias:'widget.desktopordermanagement_orderlineitemsgridpanel',
|
4
|
+
initComponent : function(){
|
5
|
+
this.bbar = new Ext.PagingToolbar({
|
6
|
+
pageSize: 10,
|
7
|
+
store:this.store,
|
8
|
+
displayInfo: true,
|
9
|
+
displayMsg: '{0} - {1} of {2}',
|
10
|
+
emptyMsg: "Empty"
|
11
|
+
});
|
12
|
+
|
13
|
+
Compass.ErpApp.Desktop.Applications.OrderManager.OrderLineItemsGridPanel.superclass.initComponent.call(this, arguments);
|
14
|
+
},
|
15
|
+
|
16
|
+
constructor : function(config) {
|
17
|
+
var store = Ext.create("Ext.data.Store",{
|
18
|
+
proxy:{
|
19
|
+
type:'ajax',
|
20
|
+
url: '/erp_orders/erp_app/desktop/order_manager/line_items',
|
21
|
+
reader:{
|
22
|
+
type:'json',
|
23
|
+
root: 'lineItems',
|
24
|
+
idProperty:'id'
|
25
|
+
}
|
26
|
+
},
|
27
|
+
totalProperty: 'totalCount',
|
28
|
+
extraParams:{
|
29
|
+
order_id:null
|
30
|
+
},
|
31
|
+
fields:[
|
32
|
+
'product',
|
33
|
+
'quantity',
|
34
|
+
'sku',
|
35
|
+
{
|
36
|
+
name:'price',
|
37
|
+
type:'decimal'
|
38
|
+
},
|
39
|
+
'currency_display',
|
40
|
+
'id'
|
41
|
+
]
|
42
|
+
});
|
43
|
+
|
44
|
+
config = Ext.apply({
|
45
|
+
layout:'fit',
|
46
|
+
columns: [
|
47
|
+
{
|
48
|
+
header:'Product',
|
49
|
+
sortable: true,
|
50
|
+
dataIndex: 'product'
|
51
|
+
},
|
52
|
+
{
|
53
|
+
header:'SKU',
|
54
|
+
sortable: true,
|
55
|
+
dataIndex: 'sku'
|
56
|
+
},
|
57
|
+
{
|
58
|
+
header:'Quantity',
|
59
|
+
sortable: true,
|
60
|
+
dataIndex: 'quantity'
|
61
|
+
},
|
62
|
+
{
|
63
|
+
header:'Price',
|
64
|
+
sortable: true,
|
65
|
+
dataIndex: 'price',
|
66
|
+
renderer:function(v){
|
67
|
+
return v.toFixed(2);
|
68
|
+
}
|
69
|
+
|
70
|
+
},
|
71
|
+
{
|
72
|
+
header: 'Currency',
|
73
|
+
width: 75,
|
74
|
+
sortable: true,
|
75
|
+
dataIndex: 'currency_display'
|
76
|
+
|
77
|
+
}
|
78
|
+
],
|
79
|
+
loadMask: true,
|
80
|
+
autoScroll:true,
|
81
|
+
stripeRows: true,
|
82
|
+
store:store,
|
83
|
+
viewConfig:{
|
84
|
+
forceFit:true
|
85
|
+
},
|
86
|
+
listeners:{
|
87
|
+
activate:function(grid){
|
88
|
+
var layout = grid.findParentByType('organizer_orderslayout');
|
89
|
+
if(!Compass.ErpApp.Utility.isBlank(layout.orderId)){
|
90
|
+
var store = grid.getStore();
|
91
|
+
store.proxy.extraParams.order_id = layout.orderId;
|
92
|
+
store.load();
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}, config);
|
97
|
+
|
98
|
+
Compass.ErpApp.Desktop.Applications.OrderManager.OrderLineItemsGridPanel.superclass.constructor.call(this, config);
|
99
|
+
}
|
100
|
+
});
|
@@ -0,0 +1,85 @@
|
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.OrderManager",{
|
2
|
+
extend:"Ext.ux.desktop.Module",
|
3
|
+
id:'order_manager-win',
|
4
|
+
init : function(){
|
5
|
+
this.launcher = {
|
6
|
+
text: 'Orders',
|
7
|
+
iconCls:'icon-package',
|
8
|
+
handler : this.createWindow,
|
9
|
+
scope: this
|
10
|
+
}
|
11
|
+
},
|
12
|
+
createWindow : function(){
|
13
|
+
var desktop = this.app.getDesktop();
|
14
|
+
var win = desktop.getWindow('order_manager');
|
15
|
+
if(!win){
|
16
|
+
var tabPanel = Ext.create("Ext.tab.Panel",{
|
17
|
+
region:'south',
|
18
|
+
height:250,
|
19
|
+
collapsible:true,
|
20
|
+
border:false,
|
21
|
+
items:[{
|
22
|
+
xtype:'desktopordermanagement_orderlineitemsgridpanel',
|
23
|
+
title:'Line Items',
|
24
|
+
listeners:{
|
25
|
+
activate:function(grid){
|
26
|
+
if(!Compass.ErpApp.Utility.isBlank(Compass.ErpApp.Desktop.Applications.OrderManager.orderId)){
|
27
|
+
var store = grid.getStore();
|
28
|
+
store.proxy.extraParams.order_id = Compass.ErpApp.Desktop.Applications.OrderManager.orderId;
|
29
|
+
store.load();
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
},{
|
34
|
+
xtype:'desktopordermanagement_paymentsgridpanel',
|
35
|
+
title:'Payments',
|
36
|
+
listeners:{
|
37
|
+
activate:function(grid){
|
38
|
+
if(!Compass.ErpApp.Utility.isBlank(Compass.ErpApp.Desktop.Applications.OrderManager.orderId)){
|
39
|
+
var store = grid.getStore();
|
40
|
+
store.proxy.extraParams.order_id = Compass.ErpApp.Desktop.Applications.OrderManager.orderId;
|
41
|
+
store.load();
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}]
|
46
|
+
});
|
47
|
+
|
48
|
+
var layout = Ext.create("Ext.panel.Panel",{
|
49
|
+
id:'orders_layout',
|
50
|
+
layout:'border',
|
51
|
+
frame: false,
|
52
|
+
autoScroll:true,
|
53
|
+
items:[{
|
54
|
+
region:'center',
|
55
|
+
xtype:'ordermanager_ordersgridpanel',
|
56
|
+
listeners:{
|
57
|
+
'itemclick':function(view, record, item, index, e, options){
|
58
|
+
var orderId = record.get("id");
|
59
|
+
Compass.ErpApp.Desktop.Applications.OrderManager.orderId = orderId;
|
60
|
+
tabPanel.query('desktopordermanagement_orderlineitemsgridpanel')[0].getStore().load({params:{order_id:orderId}});
|
61
|
+
tabPanel.setActiveTab(0);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
},
|
65
|
+
tabPanel
|
66
|
+
]
|
67
|
+
});
|
68
|
+
|
69
|
+
win = desktop.createWindow({
|
70
|
+
id: 'order_manager',
|
71
|
+
title:'Orders',
|
72
|
+
width:1050,
|
73
|
+
height:550,
|
74
|
+
iconCls: 'icon-package',
|
75
|
+
shim:false,
|
76
|
+
animCollapse:false,
|
77
|
+
constrainHeader:true,
|
78
|
+
layout: 'fit',
|
79
|
+
items:[layout]
|
80
|
+
});
|
81
|
+
}
|
82
|
+
win.show();
|
83
|
+
}
|
84
|
+
});
|
85
|
+
|
@@ -0,0 +1,163 @@
|
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.OrderManager.OrdersGridPanel",{
|
2
|
+
extend:"Ext.grid.Panel",
|
3
|
+
alias:'widget.ordermanager_ordersgridpanel',
|
4
|
+
deleteOrder : function(rec){
|
5
|
+
var self = this;
|
6
|
+
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this order?', function(btn){
|
7
|
+
if(btn == 'no'){
|
8
|
+
return false;
|
9
|
+
}
|
10
|
+
else
|
11
|
+
{
|
12
|
+
var conn = new Ext.data.Connection();
|
13
|
+
conn.request({
|
14
|
+
url: './order_manager/delete/'+rec.get('id'),
|
15
|
+
success: function(response) {
|
16
|
+
var obj = Ext.decode(response.responseText);
|
17
|
+
if(obj.success){
|
18
|
+
self.getStore().load();
|
19
|
+
}
|
20
|
+
else{
|
21
|
+
Ext.Msg.alert('Error', 'Error deleting order.');
|
22
|
+
}
|
23
|
+
},
|
24
|
+
failure: function(response) {
|
25
|
+
Ext.Msg.alert('Error', 'Error deleting order.');
|
26
|
+
}
|
27
|
+
});
|
28
|
+
}
|
29
|
+
});
|
30
|
+
},
|
31
|
+
|
32
|
+
initComponent : function(){
|
33
|
+
this.bbar = Ext.create("Ext.PagingToolbar",{
|
34
|
+
pageSize: this.initialConfig['pageSize'] || 50,
|
35
|
+
store:this.store,
|
36
|
+
displayInfo: true,
|
37
|
+
displayMsg: '{0} - {1} of {2}',
|
38
|
+
emptyMsg: "Empty"
|
39
|
+
});
|
40
|
+
|
41
|
+
Compass.ErpApp.Desktop.Applications.OrderManager.OrdersGridPanel.superclass.initComponent.call(this, arguments);
|
42
|
+
},
|
43
|
+
|
44
|
+
constructor : function(config) {
|
45
|
+
var store = Ext.create("Ext.data.Store",{
|
46
|
+
autoLoad: true,
|
47
|
+
proxy:{
|
48
|
+
type:'ajax',
|
49
|
+
url: '/erp_orders/erp_app/desktop/order_manager',
|
50
|
+
reader:{
|
51
|
+
type:'json',
|
52
|
+
root: 'orders'
|
53
|
+
}
|
54
|
+
},
|
55
|
+
extraParams:{
|
56
|
+
order_number:null
|
57
|
+
},
|
58
|
+
totalProperty: 'totalCount',
|
59
|
+
fields:['total_price','order_number', 'status', 'first_name', 'last_name', 'email','phone','id','created_at']
|
60
|
+
});
|
61
|
+
|
62
|
+
config = Ext.apply({
|
63
|
+
layout:'fit',
|
64
|
+
columns: [
|
65
|
+
{
|
66
|
+
header:'Order Number',
|
67
|
+
sortable: true,
|
68
|
+
dataIndex: 'order_number'
|
69
|
+
},
|
70
|
+
{
|
71
|
+
header:'Status',
|
72
|
+
sortable: true,
|
73
|
+
dataIndex: 'status'
|
74
|
+
},
|
75
|
+
{
|
76
|
+
header:'Total Price',
|
77
|
+
sortable: true,
|
78
|
+
dataIndex: 'total_price'
|
79
|
+
},
|
80
|
+
{
|
81
|
+
header:'First Name',
|
82
|
+
sortable: true,
|
83
|
+
width:150,
|
84
|
+
dataIndex: 'first_name'
|
85
|
+
},
|
86
|
+
{
|
87
|
+
header:'Last Name',
|
88
|
+
sortable: true,
|
89
|
+
width:150,
|
90
|
+
dataIndex: 'last_name'
|
91
|
+
},
|
92
|
+
{
|
93
|
+
header:'Email',
|
94
|
+
sortable: true,
|
95
|
+
dataIndex: 'email'
|
96
|
+
},
|
97
|
+
{
|
98
|
+
header:'Phone',
|
99
|
+
sortable: true,
|
100
|
+
dataIndex: 'phone'
|
101
|
+
},
|
102
|
+
{
|
103
|
+
header:'Created At',
|
104
|
+
sortable: true,
|
105
|
+
dataIndex: 'created_at',
|
106
|
+
width:150,
|
107
|
+
renderer: Ext.util.Format.dateRenderer('m/d/Y H:i:s')
|
108
|
+
},
|
109
|
+
{
|
110
|
+
menuDisabled:true,
|
111
|
+
resizable:false,
|
112
|
+
xtype:'actioncolumn',
|
113
|
+
header:'Delete',
|
114
|
+
align:'center',
|
115
|
+
width:60,
|
116
|
+
items:[{
|
117
|
+
icon:'/images/icons/delete/delete_16x16.png',
|
118
|
+
tooltip:'Delete',
|
119
|
+
handler :function(grid, rowIndex, colIndex){
|
120
|
+
var rec = grid.getStore().getAt(rowIndex);
|
121
|
+
grid.deleteOrder(rec);
|
122
|
+
}
|
123
|
+
}]
|
124
|
+
}
|
125
|
+
],
|
126
|
+
store:store,
|
127
|
+
loadMask: true,
|
128
|
+
autoScroll:true,
|
129
|
+
stripeRows: true,
|
130
|
+
tbar:{
|
131
|
+
items:[
|
132
|
+
'<span class="x-btn-inner">Order Number:</span>',
|
133
|
+
{
|
134
|
+
xtype:'numberfield',
|
135
|
+
hideLabel:true,
|
136
|
+
id:'orderNumberSearchTextField'
|
137
|
+
},
|
138
|
+
{
|
139
|
+
text:'Search',
|
140
|
+
iconCls:'icon-search',
|
141
|
+
handler:function(btn){
|
142
|
+
var orderNumber = Ext.getCmp('orderNumberSearchTextField').getValue();
|
143
|
+
btn.findParentByType('ordermanager_ordersgridpanel').store.proxy.extraParams.order_number = orderNumber;
|
144
|
+
btn.findParentByType('ordermanager_ordersgridpanel').store.load();
|
145
|
+
}
|
146
|
+
},
|
147
|
+
'|',
|
148
|
+
{
|
149
|
+
text: 'All',
|
150
|
+
xtype:'button',
|
151
|
+
iconCls: 'icon-eye',
|
152
|
+
handler: function(btn) {
|
153
|
+
btn.findParentByType('ordermanager_ordersgridpanel').store.proxy.extraParams.order_number = null;
|
154
|
+
btn.findParentByType('ordermanager_ordersgridpanel').store.load();
|
155
|
+
}
|
156
|
+
},
|
157
|
+
]
|
158
|
+
}
|
159
|
+
}, config);
|
160
|
+
|
161
|
+
Compass.ErpApp.Desktop.Applications.OrderManager.OrdersGridPanel.superclass.constructor.call(this, config);
|
162
|
+
}
|
163
|
+
});
|
@@ -0,0 +1,109 @@
|
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.OrderManager.PaymentsGridPanel",{
|
2
|
+
extend:"Ext.grid.Panel",
|
3
|
+
alias:'widget.desktopordermanagement_paymentsgridpanel',
|
4
|
+
|
5
|
+
initComponent : function(){
|
6
|
+
this.bbar = new Ext.PagingToolbar({
|
7
|
+
pageSize: 10,
|
8
|
+
store:this.store,
|
9
|
+
displayInfo: true,
|
10
|
+
displayMsg: '{0} - {1} of {2}',
|
11
|
+
emptyMsg: "Empty"
|
12
|
+
});
|
13
|
+
|
14
|
+
Compass.ErpApp.Desktop.Applications.OrderManager.PaymentsGridPanel.superclass.initComponent.call(this, arguments);
|
15
|
+
},
|
16
|
+
|
17
|
+
constructor : function(config) {
|
18
|
+
var store = Ext.create("Ext.data.Store",{
|
19
|
+
proxy:{
|
20
|
+
type:'ajax',
|
21
|
+
url: '/erp_orders/erp_app/desktop/order_manager/payments',
|
22
|
+
reader:{
|
23
|
+
type:'json',
|
24
|
+
root: 'payments',
|
25
|
+
idProperty:'id'
|
26
|
+
}
|
27
|
+
},
|
28
|
+
totalProperty: 'totalCount',
|
29
|
+
fields:[
|
30
|
+
'authorization',
|
31
|
+
'status',
|
32
|
+
'created_at',
|
33
|
+
{
|
34
|
+
name:'amount',
|
35
|
+
type:'decimal'
|
36
|
+
},
|
37
|
+
'currency_display',
|
38
|
+
'id',
|
39
|
+
'success'
|
40
|
+
],
|
41
|
+
extraParams:{
|
42
|
+
order_id:null
|
43
|
+
}
|
44
|
+
});
|
45
|
+
|
46
|
+
config = Ext.apply({
|
47
|
+
layout:'fit',
|
48
|
+
columns: [
|
49
|
+
{
|
50
|
+
header:'Authorization #',
|
51
|
+
sortable: true,
|
52
|
+
dataIndex: 'authorization'
|
53
|
+
},
|
54
|
+
{
|
55
|
+
header:'Status',
|
56
|
+
sortable: true,
|
57
|
+
dataIndex: 'status'
|
58
|
+
},
|
59
|
+
{
|
60
|
+
header:'Successful',
|
61
|
+
sortable: true,
|
62
|
+
dataIndex: 'success'
|
63
|
+
},
|
64
|
+
{
|
65
|
+
header:'Amount',
|
66
|
+
sortable: true,
|
67
|
+
dataIndex: 'amount',
|
68
|
+
renderer:function(v){
|
69
|
+
return v.toFixed(2);
|
70
|
+
}
|
71
|
+
|
72
|
+
},
|
73
|
+
{
|
74
|
+
header: 'Currency',
|
75
|
+
width: 75,
|
76
|
+
sortable: true,
|
77
|
+
dataIndex: 'currency_display'
|
78
|
+
|
79
|
+
},
|
80
|
+
{
|
81
|
+
header: 'Created At',
|
82
|
+
sortable: true,
|
83
|
+
width:150,
|
84
|
+
dataIndex: 'created_at',
|
85
|
+
renderer: Ext.util.Format.dateRenderer('m/d/Y H:i:s')
|
86
|
+
}
|
87
|
+
],
|
88
|
+
autoScroll:true,
|
89
|
+
stripeRows: true,
|
90
|
+
store:store,
|
91
|
+
viewConfig:{
|
92
|
+
loadMask:false,
|
93
|
+
forceFit:true
|
94
|
+
},
|
95
|
+
listeners:{
|
96
|
+
activate:function(grid){
|
97
|
+
var layout = grid.findParentByType('organizer_orderslayout');
|
98
|
+
if(!Compass.ErpApp.Utility.isBlank(layout.orderId)){
|
99
|
+
var store = grid.getStore();
|
100
|
+
store.proxy.extraParams.order_id = layout.orderId;
|
101
|
+
store.load();
|
102
|
+
}
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}, config);
|
106
|
+
|
107
|
+
Compass.ErpApp.Desktop.Applications.OrderManager.PaymentsGridPanel.superclass.constructor.call(this, config);
|
108
|
+
}
|
109
|
+
});
|