erp_app 3.0.3 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,13 +20,12 @@ module ErpApp
20
20
  else
21
21
  audit_logs = AuditLog.arel_table
22
22
 
23
- audit_log_entries = AuditLog.where(audit_logs[:created_at].gteq(start_date)
24
- .and(audit_logs[:created_at].lteq(end_date))
25
- .and(audit_logs[:audit_log_type_id].eq(audit_log_type_id)))
26
- .order("#{sort} #{dir}").offset(start).limit(limit).all
27
- total_count = AuditLog.where(audit_logs[:created_at].gteq(start_date)
28
- .and(audit_logs[:created_at].lteq(end_date))
29
- .and(audit_logs[:audit_log_type_id].eq(audit_log_type_id))).count
23
+ arel_query = AuditLog.where(:created_at => start_date..(end_date + 1.day))
24
+ arel_query = arel_query.where(audit_logs[:audit_log_type_id].eq(audit_log_type_id)) if audit_log_type_id
25
+
26
+ audit_log_entries = arel_query.order("#{sort} #{dir}").offset(start).limit(limit).all
27
+
28
+ total_count = arel_query.count
30
29
  end
31
30
 
32
31
  render :json => {:total_count => total_count,
@@ -37,28 +36,11 @@ module ErpApp
37
36
  end
38
37
 
39
38
  def items
40
- id=params[:id]
41
-
42
- page= (params[:page].to_i)
43
- if (page==0)
44
- page=1
45
- end
46
- row_count= params[:limit].to_i
47
- if (row_count==0)
48
- row_count=10
49
- end
50
- sort=params[:sort]
51
- if (sort!=nil)
52
- sort_hash = ActiveSupport::JSON.decode(sort)
53
- logger.debug("\n\nsort_hash :#{sort_hash[0].class}-#{sort_hash[0]}")
54
- property=sort_hash[0]['property']
55
- direction=sort_hash[0]['direction']
56
- logger.debug("\n\nsort :#{property} -#{direction}")
57
- end
58
-
59
- rec_count=AuditLogItem.count(:conditions => ["audit_log_id = ?", id])
60
- paged_results=AuditLogItem.paginate(:page => page, :per_page => row_count, :conditions => ["audit_log_id = ?", id])
61
- render :json => {:total_count => rec_count, :audit_items => paged_results}
39
+ render :json => {:total_count => AuditLog.find(params[:audit_log_id]).items.count,
40
+ :audit_log_entries => AuditLog.find(params[:audit_log_id]).items.collect{
41
+ |audit_log_item| audit_log_item.to_hash(:only => [:id, :description, :created_at, :audit_log_id],
42
+ :additional_values => {:value => audit_log.audit_log_item_value,
43
+ :audit_log_item_type => audit_log_item.type.description})}}
62
44
  end
63
45
 
64
46
 
@@ -2,7 +2,7 @@ module ErpApp
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
8
8
  end
@@ -1,6 +1,24 @@
1
- function short_date_renderer(value) {
2
- return Ext.Date.format(value, 'm-d-Y');
3
- }
1
+ Ext.define('Compass.ErpApp.Desktop.Applications.AuditLogViewer.AuditLogType', {
2
+ extend:'Ext.data.Model',
3
+ fields:[
4
+ {name:'id', type:'int'},
5
+ {name:'description', type:'string'},
6
+ {name:'internal_identifier', type:'string'}
7
+ ]
8
+ });
9
+
10
+ Ext.create('Ext.data.Store', {
11
+ storeId:'audit-log-view-audit-log-type-store',
12
+ model:'Compass.ErpApp.Desktop.Applications.AuditLogViewer.AuditLogType',
13
+ proxy:{
14
+ type:'ajax',
15
+ url:'/erp_app/desktop/audit_log_viewer/audit_log_types.json',
16
+ reader:{
17
+ type:'json',
18
+ root:'audit_log_types'
19
+ }
20
+ }
21
+ });
4
22
 
5
23
  Ext.define('Compass.ErpApp.Desktop.Applications.AuditLogViewer.AuditLogEntry', {
6
24
  extend:'Ext.data.Model',
@@ -57,6 +75,60 @@ Ext.define('Compass.ErpApp.Desktop.Applications.AuditLogViewer.AuditLogGrid', {
57
75
  extend:'Ext.grid.Panel',
58
76
  title:'Audit Log Records',
59
77
  store:Ext.getStore('audit-log-view-audit-log-entry-store'),
78
+ dockedItems:[
79
+ {
80
+ xtype:'toolbar',
81
+ dock:'top',
82
+ items:[
83
+ 'Start Date:',
84
+ {
85
+ xtype:'datefield',
86
+ itemId:'startDate',
87
+ value:new Date()
88
+
89
+ },
90
+ 'End Date:',
91
+ {
92
+ xtype:'datefield',
93
+ itemId:'endDate',
94
+ value:new Date()
95
+ },
96
+ 'Audit Log Type',
97
+ {
98
+ xtype:'combo',
99
+ itemId:'auditLogTypeId',
100
+ store:Ext.getStore('audit-log-view-audit-log-type-store'),
101
+ queryMode:'remote',
102
+ displayField:'description',
103
+ valueField:'id'
104
+ },
105
+ {
106
+ xtype:'button',
107
+ text:'Search',
108
+ iconCls:'icon-search',
109
+ handler:function (btn) {
110
+ var startDate = btn.up('toolbar').down('#startDate').getValue();
111
+ var endDate = btn.up('toolbar').down('#endDate').getValue();
112
+ var auditLogTypeId = btn.up('toolbar').down('#auditLogTypeId').getValue();
113
+
114
+ var store = btn.up('toolbar').up('audit_log_viewer-audit_log_grid').getStore();
115
+ store.currentPage = 1;
116
+ store.load({params:{start:0, start_date:startDate, end_date:endDate, audit_log_type_id:auditLogTypeId}});
117
+ }
118
+ },
119
+ {
120
+ xtype:'button',
121
+ text:'All',
122
+ iconCls:'icon-eye',
123
+ handler:function (btn) {
124
+ var store = btn.up('toolbar').up('audit_log_viewer-audit_log_grid').getStore();
125
+ store.currentPage = 1;
126
+ store.load({params:{start:0, start_date:null, end_date:null, audit_log_type_id:null}});
127
+ }
128
+ }
129
+ ]
130
+ }
131
+ ],
60
132
  columns:[
61
133
  {
62
134
  header:'Log Id',
@@ -78,7 +150,7 @@ Ext.define('Compass.ErpApp.Desktop.Applications.AuditLogViewer.AuditLogGrid', {
78
150
  {
79
151
  header:'Created At',
80
152
  dataIndex:'created_at',
81
- renderer:short_date_renderer,
153
+ renderer:function(value){return Ext.Date.format(value, 'm-d-Y');},
82
154
  width:100
83
155
  },
84
156
  {
@@ -90,5 +162,10 @@ Ext.define('Compass.ErpApp.Desktop.Applications.AuditLogViewer.AuditLogGrid', {
90
162
  ],
91
163
  viewConfig:{
92
164
  stripeRows:true
165
+ },
166
+ listeners:{
167
+ 'itemdblclick':function(view, record, item, index, e, eOpts){
168
+ view.up('audit_log_viewer-tabpanel').fireEvent('auditLogEntrySelected', record);
169
+ }
93
170
  }
94
171
  });
@@ -0,0 +1,98 @@
1
+ Ext.define('Compass.ErpApp.Desktop.Applications.AuditLogViewer.AuditLogItem', {
2
+ extend:'Ext.data.Model',
3
+ fields:[
4
+ {
5
+ name:'id',
6
+ type:'int'
7
+ },
8
+ {
9
+ name:'audit_log_id',
10
+ type:'int'
11
+ },
12
+ {
13
+ name:'value',
14
+ type:'string'
15
+ },
16
+ {
17
+ name:'description',
18
+ type:'string'
19
+ },
20
+ {
21
+ name:'created_at',
22
+ type:'date'
23
+ },
24
+ {
25
+ name:'audit_log_item_type',
26
+ type:'string'
27
+ }
28
+
29
+ ]
30
+ });
31
+
32
+ Ext.create('Ext.data.Store', {
33
+ storeId:'audit-log-view-audit-log-item-store',
34
+ model:'Compass.ErpApp.Desktop.Applications.AuditLogViewer.AuditLogItem',
35
+ pageSize:15,
36
+ start:0,
37
+ remoteSort:true,
38
+ proxy:{
39
+ type:'ajax',
40
+ url:'/erp_app/desktop/audit_log_viewer/items.json',
41
+ extraParams:{
42
+ audit_log_id:null
43
+ },
44
+ reader:{
45
+ type:'json',
46
+ root:'audit_log_items',
47
+ totalProperty:'total_count'
48
+
49
+ }
50
+ }
51
+ });
52
+
53
+ Ext.define('Compass.ErpApp.Desktop.Applications.AuditLogViewer.AuditLogItemGrid', {
54
+ alias:'widget.audit_log_viewer-audit_log_item_grid',
55
+ extend:'Ext.grid.Panel',
56
+ title:'Audit Log Items',
57
+ store:Ext.getStore('audit-log-view-audit-log-item-store'),
58
+ columns:[
59
+ {
60
+ header:'Audit Log Id',
61
+ dataIndex:'audit_log_id',
62
+ sortable:false,
63
+ width:75
64
+ },
65
+ {
66
+ header:'Log Item Id',
67
+ dataIndex:'id',
68
+ width:75
69
+ },
70
+ {
71
+ header:'Description',
72
+ dataIndex:'description',
73
+ sortable:false,
74
+ width:300
75
+ },
76
+ {
77
+ header:'Value',
78
+ dataIndex:'value',
79
+ sortable:false,
80
+ width:300
81
+ },
82
+ {
83
+ header:'Created At',
84
+ dataIndex:'created_at',
85
+ renderer:function(value){return Ext.Date.format(value, 'm-d-Y');},
86
+ width:100
87
+ },
88
+ {
89
+ header:'Audit Log Item Type',
90
+ dataIndex:'audit_log_item_type',
91
+ width:200
92
+ }
93
+
94
+ ],
95
+ viewConfig:{
96
+ stripeRows:true
97
+ }
98
+ });
@@ -1,22 +1,35 @@
1
- Ext.define('Compass.ErpApp.Desktop.Applications.AuditLogViewer.AuditLogType', {
2
- extend:'Ext.data.Model',
3
- fields:[
4
- {name:'id', type:'int'},
5
- {name:'description', type:'string'},
6
- {name:'internal_identifier', type:'string'}
7
- ]
8
- });
9
-
10
- Ext.create('Ext.data.Store', {
11
- storeId:'audit-log-view-audit-log-type-store',
12
- model:'Compass.ErpApp.Desktop.Applications.AuditLogViewer.AuditLogType',
13
- proxy:{
14
- type:'ajax',
15
- url:'/erp_app/desktop/audit_log_viewer/audit_log_types.json',
16
- reader:{
17
- type:'json',
18
- root:'audit_log_types'
1
+ Ext.define("Compass.ErpApp.Desktop.Applications.AuditLogViewer.TabPanel", {
2
+ alias:'widget.audit_log_viewer-tabpanel',
3
+ extend:"Ext.tab.Panel",
4
+ plugins:Ext.create('Ext.ux.TabCloseMenu', {
5
+ extraItemsTail:[
6
+ '-',
7
+ {
8
+ text:'Closable',
9
+ checked:true,
10
+ hideOnClick:true,
11
+ handler:function (item) {
12
+ currentItem.tab.setClosable(item.checked);
13
+ }
14
+ }
15
+ ],
16
+ listeners:{
17
+ aftermenu:function () {
18
+ currentItem = null;
19
+ },
20
+ beforemenu:function (menu, item) {
21
+ var menuitem = menu.child('*[text="Closable"]');
22
+ currentItem = item;
23
+ menuitem.setChecked(item.closable);
24
+ }
19
25
  }
26
+ }),
27
+ constructor:function (config) {
28
+ this.addEvents({
29
+ 'auditLogEntrySelected':true
30
+ });
31
+
32
+ this.callParent([config]);
20
33
  }
21
34
  });
22
35
 
@@ -37,65 +50,26 @@ Ext.define("Compass.ErpApp.Desktop.Applications.AuditLogViewer", {
37
50
  var win = desktop.getWindow('audit_log_viewer');
38
51
  if (!win) {
39
52
 
40
- var container = Ext.create('Ext.panel.Panel', {
41
- layout:'fit',
42
- dockedItems:[
43
- {
44
- xtype:'toolbar',
45
- dock:'top',
46
- items:[
47
- 'Start Date:',
48
- {
49
- xtype:'datefield',
50
- itemId:'startDate',
51
- value:new Date()
52
-
53
- },
54
- 'End Date:',
55
- {
56
- xtype:'datefield',
57
- itemId:'endDate',
58
- value:new Date()
59
- },
60
- 'Audit Log Type',
61
- {
62
- xtype:'combo',
63
- itemId:'auditLogTypeId',
64
- store:Ext.getStore('audit-log-view-audit-log-type-store'),
65
- queryMode:'remote',
66
- displayField:'description',
67
- valueField:'id'
68
- },
69
- {
70
- xtype:'button',
71
- text:'Search',
72
- iconCls:'icon-search',
73
- handler:function (btn) {
74
- var startDate = btn.up('toolbar').down('#startDate').getValue();
75
- var endDate = btn.up('toolbar').down('#endDate').getValue();
76
- var auditLogTypeId = btn.up('toolbar').down('#auditLogTypeId').getValue();
77
-
78
- var store = btn.up('toolbar').up('panel').down('audit_log_viewer-audit_log_grid').getStore();
79
- store.currentPage = 1;
80
- store.load({params:{start:0, start_date:startDate, end_date:endDate, audit_log_type_id:auditLogTypeId}});
81
- }
82
- },
53
+ var container = Ext.create('Compass.ErpApp.Desktop.Applications.AuditLogViewer.TabPanel', {
54
+ items:[
55
+ {xtype:'audit_log_viewer-audit_log_grid'}
56
+ ],
57
+ listeners:{
58
+ auditLogEntrySelected:function (auditLogEntry) {
59
+ var audit_log_item_grid = Ext.create('Compass.ErpApp.Desktop.Applications.AuditLogViewer.AuditLogItemGrid',
83
60
  {
84
- xtype:'button',
85
- text:'All',
86
- iconCls:'icon-eye',
87
- handler:function (btn) {
88
- var store = btn.up('toolbar').up('panel').down('audit_log_viewer-audit_log_grid').getStore();
89
- store.currentPage = 1;
90
- store.load({params:{start:0, start_date:null, end_date:null, audit_log_type_id:null}});
61
+ closable:true,
62
+ listeners:{
63
+ 'render':function(comp){
64
+ comp.getStore().load({params:{audit_log_id:auditLogEntry.get('id')}});
65
+ }
91
66
  }
92
67
  }
93
- ]
68
+ );
69
+ this.add(audit_log_item_grid);
70
+ this.setActiveTab(audit_log_item_grid);
94
71
  }
95
- ],
96
- items:[
97
- {xtype:'audit_log_viewer-audit_log_grid'}
98
- ]
72
+ }
99
73
  });
100
74
 
101
75
  win = desktop.createWindow({
@@ -111,7 +85,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.AuditLogViewer", {
111
85
  items:[container]
112
86
  });
113
87
 
114
- //had to add the docked this docked item after it was created. Was throwing style error????
88
+ //had to add the docked item after it was created. Was throwing style error????
115
89
  container.down('audit_log_viewer-audit_log_grid').addDocked({
116
90
  xtype:'pagingtoolbar',
117
91
  store:Ext.getStore('audit-log-view-audit-log-entry-store'),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erp_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-26 00:00:00.000000000 Z
12
+ date: 2012-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: will_paginate
16
- requirement: &70242529816100 !ruby/object:Gem::Requirement
16
+ requirement: &70353213158540 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - =
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70242529816100
24
+ version_requirements: *70353213158540
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: uglifier
27
- requirement: &70242529814900 !ruby/object:Gem::Requirement
27
+ requirement: &70353213157940 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.3
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70242529814900
35
+ version_requirements: *70353213157940
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: erp_tech_svcs
38
- requirement: &70242529813840 !ruby/object:Gem::Requirement
38
+ requirement: &70353213157320 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '3.0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70242529813840
46
+ version_requirements: *70353213157320
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: erp_dev_svcs
49
- requirement: &70242529813080 !ruby/object:Gem::Requirement
49
+ requirement: &70353213156460 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '3.0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70242529813080
57
+ version_requirements: *70353213156460
58
58
  description: Provides an application infrastructure based on the Sencha/extjs UI framework,
59
59
  as well as several utilities and example applications. It houses the core application
60
60
  container framework and component model infrastructure that play a key role in the
@@ -1275,6 +1275,7 @@ files:
1275
1275
  - public/javascripts/erp_app/codemirror/theme/neat.css
1276
1276
  - public/javascripts/erp_app/codemirror/theme/night.css
1277
1277
  - public/javascripts/erp_app/desktop/applications/audit_log_viewer/audit_log_grid_panel.js
1278
+ - public/javascripts/erp_app/desktop/applications/audit_log_viewer/audit_log_item_grid_panel.js
1278
1279
  - public/javascripts/erp_app/desktop/applications/audit_log_viewer/module.js
1279
1280
  - public/javascripts/erp_app/desktop/applications/configuration_management/configuration_options_panel.js
1280
1281
  - public/javascripts/erp_app/desktop/applications/configuration_management/configuration_tree_panel.js