erp_app 3.1.10 → 3.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/app/controllers/erp_app/desktop/scaffold/base_controller.rb +1 -0
  2. data/app/controllers/erp_app/desktop/user_management/base_controller.rb +8 -10
  3. data/app/controllers/erp_app/organizer/crm/base_controller.rb +104 -88
  4. data/app/mailers/crm_mailer.rb +9 -0
  5. data/app/views/crm_mailer/send_message.html.erb +9 -0
  6. data/app/views/erp_app/desktop/base/index.erb +221 -213
  7. data/app/views/erp_app/mobile/base/index.erb +1 -0
  8. data/app/views/erp_app/organizer/base/index.erb +51 -43
  9. data/lib/erp_app/version.rb +1 -1
  10. data/lib/generators/organizer_application/templates/controllers/controller_template.erb +1 -1
  11. data/lib/generators/organizer_application/templates/public/base.js.erb +2 -2
  12. data/public/javascripts/erp_app/desktop/applications/scaffold/models_tree_panel.js +19 -0
  13. data/public/javascripts/erp_app/desktop/applications/user_management/module.js +432 -418
  14. data/public/javascripts/erp_app/desktop/applications/user_management/user_application_mgt_panel.js +1 -1
  15. data/public/javascripts/erp_app/login/window.js +2 -1
  16. data/public/javascripts/erp_app/organizer/applications/crm/contact_mechanism_grid.js +511 -389
  17. data/public/javascripts/erp_app/organizer/applications/crm/party_grid.js +1 -1
  18. data/public/javascripts/erp_app/shared/configuration/configuration_form.js +238 -262
  19. data/public/javascripts/erp_app/shared/configuration/configuration_panel.js +103 -104
  20. data/public/stylesheets/erp_app/mobile/mobile.css +6 -6
  21. metadata +5 -89
  22. data/spec/dummy/db/data_migrations/20130422163128_add_usd_currency.erp_base_erp_svcs.rb +0 -12
  23. data/spec/dummy/db/data_migrations/20130422163129_add_iso_codes.erp_base_erp_svcs.rb +0 -19
  24. data/spec/dummy/db/data_migrations/20130422163130_setup_compass_ae_instance.erp_base_erp_svcs.rb +0 -21
  25. data/spec/dummy/db/data_migrations/20130422163131_upgrade_compass_ae_instances_data.erp_base_erp_svcs.rb +0 -19
  26. data/spec/dummy/db/data_migrations/20130422163132_add_guid_to_instances.erp_base_erp_svcs.rb +0 -10
  27. data/spec/dummy/db/data_migrations/20130422163133_create_capability_scope_types.erp_tech_svcs.rb +0 -15
  28. data/spec/dummy/db/data_migrations/20130422163134_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +0 -16
  29. data/spec/dummy/db/data_migrations/20130422163135_setup_audit_log_types.erp_tech_svcs.rb +0 -22
  30. data/spec/dummy/db/data_migrations/20130422163136_create_group_relationship_and_role_types.erp_tech_svcs.rb +0 -20
  31. data/spec/dummy/db/data_migrations/20130422163137_note_capabilities.erp_tech_svcs.rb +0 -24
  32. data/spec/dummy/db/data_migrations/20130422163138_erp_app_setup.erp_app.rb +0 -252
  33. data/spec/dummy/db/data_migrations/20130422163139_update_preferences.erp_app.rb +0 -53
  34. data/spec/dummy/db/data_migrations/20130422163140_create_desktop_app_audit_log_viewer.erp_app.rb +0 -24
  35. data/spec/dummy/db/data_migrations/20130422163141_add_file_manager_application.erp_app.rb +0 -32
  36. data/spec/dummy/db/data_migrations/20130422163142_add_default_capabilities.erp_app.rb +0 -23
  37. data/spec/dummy/db/data_migrations/20130422163143_add_new_contact_widgets.erp_app.rb +0 -42
  38. data/spec/dummy/db/data_migrations/20130422163144_add_userinfo_widget.erp_app.rb +0 -29
  39. data/spec/dummy/db/data_migrations/20130422163145_create_party_and_role_type_for_communication_events.erp_app.rb +0 -11
  40. data/spec/dummy/db/data_migrations/20130422163146_create_user_management_mobile_application.erp_app.rb +0 -17
  41. data/spec/dummy/db/data_migrations/20130422163147_create_configuration_management_desktop_application.erp_app.rb +0 -27
  42. data/spec/dummy/db/data_migrations/20130422163148_create_job_tracker_desktop_application.erp_app.rb +0 -23
  43. data/spec/dummy/db/data_migrations/20130422163149_created_tracked_jobs.erp_app.rb +0 -15
  44. data/spec/dummy/db/data_migrations/20130422163150_upgrade_remove_system_mgmt_app.erp_app.rb +0 -16
  45. data/spec/dummy/db/data_migrations/20130422163151_create_security_management_desktop_application.erp_app.rb +0 -29
  46. data/spec/dummy/db/data_migrations/20130422163152_add_job_tracker_mobile_app.erp_app.rb +0 -17
  47. data/spec/dummy/db/migrate/20130422163121_base_erp_services.erp_base_erp_svcs.rb +0 -486
  48. data/spec/dummy/db/migrate/20130422163122_add_txn_status.erp_base_erp_svcs.rb +0 -37
  49. data/spec/dummy/db/migrate/20130422163123_upgrade_compass_ae_instances.erp_base_erp_svcs.rb +0 -34
  50. data/spec/dummy/db/migrate/20130422163124_add_uuid_compass_ae_instance.erp_base_erp_svcs.rb +0 -17
  51. data/spec/dummy/db/migrate/20130422163125_add_long_lat_to_address.erp_base_erp_svcs.rb +0 -16
  52. data/spec/dummy/db/migrate/20130422163126_base_tech_services.erp_tech_svcs.rb +0 -271
  53. data/spec/dummy/db/migrate/20130422163127_create_has_attribute_tables.erp_tech_svcs.rb +0 -39
  54. data/spec/dummy/db/migrate/20130422163128_create_groups.erp_tech_svcs.rb +0 -19
  55. data/spec/dummy/db/migrate/20130422163129_upgrade_security.erp_tech_svcs.rb +0 -54
  56. data/spec/dummy/db/migrate/20130422163130_upgrade_security2.erp_tech_svcs.rb +0 -275
  57. data/spec/dummy/db/migrate/20130422163131_add_queue_to_delayed_jobs.erp_tech_svcs.rb +0 -14
  58. data/spec/dummy/db/migrate/20130422163132_base_app_framework.erp_app.rb +0 -276
  59. data/spec/dummy/db/migrate/20130422163133_add_job_tracker.erp_app.rb +0 -20
  60. data/spec/dummy/db/migrate/20130422163134_update_mobile_application.erp_app.rb +0 -28
  61. data/spec/dummy/db/schema.rb +0 -883
  62. data/spec/dummy/db/spec.sqlite3 +0 -0
  63. data/spec/dummy/log/adam.log +0 -1
  64. data/spec/dummy/log/spec.log +0 -113709
@@ -9,6 +9,7 @@
9
9
  <%= add_authenticity_token_to_extjs %>
10
10
 
11
11
  <!--stylesheets-->
12
+ <%= load_shared_application_resources(:stylesheets) %>
12
13
  <%= static_stylesheet_link_tag('erp_app/mobile/mobile.css') %>
13
14
  <!--end stylesheets-->
14
15
 
@@ -1,53 +1,61 @@
1
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
2
  <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
5
- <title>Organizer</title>
6
- <!-- include google maps -->
7
- <script src="https://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
8
- <!-- include google maps -->
9
- <!--javascript-->
10
- <%= include_extjs(:theme => @organizer.get_preference(:extjs_theme), :debug => (Rails.env != 'production')) %>
11
- <%= static_javascript_include_tag("extjs/overrides.js")%>
12
- <%= static_javascript_include_tag("erp_app/utility.js")%>
13
- <!-- shared application resources -->
14
- <%= load_shared_application_resources(:javascripts) %>
15
- <!-- end shared application resources -->
16
- <%= static_javascript_include_tag("erp_app/organizer/preference_window.js","erp_app/organizer/layout.js","erp_app/organizer/default_menu_tree_panel.js") %>
17
- <%=setup_js_authentication(@user, @organizer)%>
18
- <!-- application resources -->
19
- <%=static_javascript_include_tag(@organizer.applications.collect{|app| app.locate_resources('javascripts')}.flatten)%>
20
- <!-- end application resources -->
21
- <%=set_max_file_upload%>
22
- <!-- shared application resources -->
23
- <%= load_shared_application_resources(:stylesheets) %>
24
- <!-- end application resources -->
25
- <!-- application resources -->
26
- <%= static_stylesheet_link_tag(@organizer.applications.collect{|app| app.locate_resources('stylesheets')}.flatten)%>
27
- <!-- end application resources -->
28
- </head>
29
- <body scroll="no">
30
- <script type="text/javascript">
31
- Ext.onReady(function() {
32
- var organizerLayout = Ext.create("Compass.ErpApp.Organizer.Layout",{logout_url:'/session/sign_out'});
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
5
+ <title>Organizer</title>
6
+ <!-- include google maps -->
7
+ <script src="https://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
8
+ <!-- include google maps -->
9
+ <!--javascript-->
10
+ <%= include_extjs(:theme => @organizer.get_preference(:extjs_theme), :debug => (Rails.env != 'production')) %>
11
+ <%= static_javascript_include_tag("extjs/overrides.js") %>
12
+ <%= static_javascript_include_tag("erp_app/utility.js") %>
13
+ <!-- shared application resources -->
14
+ <%= load_shared_application_resources(:javascripts) %>
15
+ <!-- end shared application resources -->
16
+ <%= static_javascript_include_tag("erp_app/organizer/preference_window.js", "erp_app/organizer/layout.js", "erp_app/organizer/default_menu_tree_panel.js") %>
17
+ <%= setup_js_authentication(@user, @organizer) %>
18
+ <!-- application resources -->
19
+ <%= static_javascript_include_tag(@organizer.applications.collect { |app| app.locate_resources('javascripts') }.flatten) %>
20
+ <!-- end application resources -->
21
+ <%= set_max_file_upload %>
22
+ <!-- shared application resources -->
23
+ <%= load_shared_application_resources(:stylesheets) %>
24
+ <!-- end application resources -->
25
+ <!-- application resources -->
26
+ <%= static_stylesheet_link_tag(@organizer.applications.collect { |app| app.locate_resources('stylesheets') }.flatten) %>
27
+ <!-- end application resources -->
28
+ </head>
29
+ <body scroll="no">
30
+ <script type="text/javascript">
31
+ Ext.onReady(function () {
32
+ var organizerLayout = Ext.create("Compass.ErpApp.Organizer.Layout", {logout_url: '/session/sign_out'});
33
33
 
34
34
  <%@organizer.applications.each do |application|%>
35
35
 
36
- var <%=application.internal_identifier.camelize%> = Ext.create("Compass.ErpApp.Organizer.Applications.<%=application.internal_identifier.camelize%>.Base",{organizerLayout:organizerLayout});
37
- <%=application.internal_identifier.camelize%>.setup();
36
+ var <%=application.internal_identifier.camelize%> =
37
+ Ext.create("Compass.ErpApp.Organizer.Applications.<%=application.internal_identifier.camelize%>.Base", {organizerLayout: organizerLayout});
38
+ <%=application.internal_identifier.camelize%>.
39
+ setup();
38
40
 
39
41
  <%end%>
40
- organizerLayout.setupLogoutButton();
41
- organizerLayout.setup();
42
- });
42
+ organizerLayout.setupLogoutButton();
43
+ organizerLayout.setup();
43
44
 
44
- window.onbeforeunload = function(){
45
- return ' If you navigate away from this page without' +
46
- ' first saving your data, the changes will be' +
47
- ' lost.';
48
- }
49
- </script>
50
- <%= setSessionTimeout %>
51
- </body>
45
+ //Used to stop backspace from redirecting the page
46
+ Ext.EventManager.on(Ext.isIE ? document : window, 'keydown', function (e, t) {
47
+ if (e.getKey() == e.BACKSPACE && ((!/^input$/i.test(t.tagName) && !/^textarea$/i.test(t.tagName)) || t.disabled || t.readOnly)) {
48
+ e.stopEvent();
49
+ }
50
+ });
51
+
52
+ // Push some history into this windows history to help prevent back button
53
+ for (var i = 0; i < 10; i++) {
54
+ window.history.pushState("history", 'CompassAE Organizer', "#"+i*new Date().getMilliseconds());
55
+ }
56
+ });
57
+ </script>
58
+ <%= setSessionTimeout %>
59
+ </body>
52
60
  </html>
53
61
 
@@ -2,7 +2,7 @@ module ErpApp
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 1
5
- TINY = 10
5
+ TINY = 11
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
8
8
  end
@@ -4,7 +4,7 @@ module ErpApp
4
4
  class BaseController < ::ErpApp::Organizer::BaseController
5
5
 
6
6
  def menu
7
- render :inline => [{:text => 'Menu Item', :leaf => true, :iconCls => '<%=icon %>', :applicationCardId => "<%= file_name %>_example_panel"}].to_json
7
+ render :json => [{:text => 'Menu Item', :leaf => true, :iconCls => '<%=icon %>', :applicationCardId => "<%= file_name %>_example_panel"}]
8
8
  end
9
9
 
10
10
  end #BaseController
@@ -6,7 +6,7 @@ Ext.ns("Compass.ErpApp.Organizer.Applications.<%= class_name %>");
6
6
  Compass.ErpApp.Organizer.Applications.<%= class_name %>.Base = function(config){
7
7
 
8
8
  var treeMenuStore = Ext.create('Compass.ErpApp.Organizer.DefaultMenuTreeStore', {
9
- url:'/erp_app/organizer/<%= file_name %>',
9
+ url:'/erp_app/organizer/<%= file_name %>/menu',
10
10
  rootText:'Menu',
11
11
  rootIconCls:'icon-content'
12
12
  });
@@ -22,7 +22,7 @@ Compass.ErpApp.Organizer.Applications.<%= class_name %>.Base = function(config){
22
22
  }
23
23
  };
24
24
 
25
- var examplePanel = new Ext.Panel({id:'<%= file_name %>_example_panel', html:'Put your content here', layout:'fit'})
25
+ var examplePanel = new Ext.Panel({id:'<%= file_name %>_example_panel', html:'Put your content here', layout:'fit'});
26
26
 
27
27
  this.setup = function(){
28
28
  config['organizerLayout'].addApplication(menuTreePanel, [examplePanel]);
@@ -34,6 +34,25 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Scaffold.ModelsTree",{
34
34
  });
35
35
 
36
36
  config = Ext.apply({
37
+ dockedItems: [
38
+ {
39
+ xtype: 'toolbar',
40
+ docked: 'top',
41
+ items: [
42
+ {
43
+ xtype: 'textfield',
44
+ flex: 1,
45
+ emptyText: 'Model Name',
46
+ listeners:{
47
+ change:function(comp, newValue, oldValue){
48
+ var store = comp.up('treepanel').getStore();
49
+ store.load({params:{name:newValue}});
50
+ }
51
+ }
52
+ }
53
+ ]
54
+ }
55
+ ],
37
56
  store:store,
38
57
  animate:false,
39
58
  region:'west',
@@ -1,445 +1,459 @@
1
- Ext.define("Compass.ErpApp.Desktop.Applications.UserManagement",{
2
- extend:"Ext.ux.desktop.Module",
3
- id:'user-management-win',
4
- init : function(){
5
- this.launcher = {
6
- text: 'User Management',
7
- iconCls:'icon-user',
8
- handler : this.createWindow,
9
- scope: this
10
- };
11
- },
12
- createWindow : function(){
13
- var desktop = this.app.getDesktop();
14
- var win = desktop.getWindow('user_management');
15
- if(!win){
16
- var tabPanel = new Ext.TabPanel({
17
- region:'center'
18
- });
19
- win = desktop.createWindow({
20
- id: 'user_management',
21
- title:'User Management',
22
- width:1100,
23
- height:550,
24
- iconCls: 'icon-user',
25
- shim:false,
26
- animCollapse:false,
27
- constrainHeader:true,
28
- layout: 'border',
29
- items:[{
30
- xtype:'usermanagement_usersgrid',
31
- tabPanel:tabPanel
32
- },tabPanel]
33
- });
1
+ Ext.define("Compass.ErpApp.Desktop.Applications.UserManagement", {
2
+ extend: "Ext.ux.desktop.Module",
3
+ id: 'user-management-win',
4
+ init: function () {
5
+ this.launcher = {
6
+ text: 'User Management',
7
+ iconCls: 'icon-user',
8
+ handler: this.createWindow,
9
+ scope: this
10
+ };
11
+ },
12
+ createWindow: function () {
13
+ var desktop = this.app.getDesktop();
14
+ var win = desktop.getWindow('user_management');
15
+ if (!win) {
16
+ var tabPanel = new Ext.TabPanel({
17
+ region: 'center'
18
+ });
19
+ win = desktop.createWindow({
20
+ id: 'user_management',
21
+ title: 'User Management',
22
+ width: 1100,
23
+ height: 550,
24
+ iconCls: 'icon-user',
25
+ shim: false,
26
+ animCollapse: false,
27
+ constrainHeader: true,
28
+ layout: 'border',
29
+ items: [
30
+ {
31
+ xtype: 'usermanagement_usersgrid',
32
+ tabPanel: tabPanel
33
+ },
34
+ tabPanel
35
+ ]
36
+ });
37
+ }
38
+ win.show();
34
39
  }
35
- win.show();
36
- }
37
40
  });
38
41
 
39
- Ext.define("Compass.ErpApp.Desktop.Applications.UserManagement.UsersGrid",{
40
- extend:"Ext.grid.Panel",
41
- alias:'widget.usermanagement_usersgrid',
42
- setWindowStatus : function(status){
43
- this.findParentByType('statuswindow').setStatus(status);
44
- },
45
-
46
- clearWindowStatus : function(){
47
- this.findParentByType('statuswindow').clearStatus();
48
- },
49
-
50
- deleteUser : function(rec){
51
- var self = this;
52
- self.setWindowStatus('Deleting user...');
53
- Ext.Ajax.request({
54
- url: '/erp_app/desktop/user_management/users/delete/' + rec.get("id"),
55
- method: 'POST',
56
- success: function(response) {
57
- var obj = Ext.decode(response.responseText);
58
- if(obj.success){
59
- self.clearWindowStatus();
60
- self.getStore().load();
61
- }
62
- else{
63
- self.clearWindowStatus();
64
- Ext.Msg.alert('Error', obj.message);
65
- }
66
- },
67
- failure: function(response) {
68
- self.clearWindowStatus();
69
- Ext.Msg.alert('Error', 'Error deleting user.');
70
- }
71
- });
72
- },
73
-
74
- resetPassword : function(rec){
75
- var self = this;
76
- self.setWindowStatus('Resetting password...');
77
- Ext.Ajax.request({
78
- url: '/users/reset_password/',
79
- params:{
80
- login:rec.get('email')
81
- },
82
- method: 'POST',
83
- success: function(response) {
84
- var obj = Ext.decode(response.responseText);
85
- if(obj.success){
86
- self.clearWindowStatus();
87
- Ext.Msg.alert('Notice', obj.message);
88
- }
89
- else{
90
- self.clearWindowStatus();
91
- Ext.Msg.alert('Error', obj.message);
92
- }
93
- },
94
- failure: function(response) {
95
- self.clearWindowStatus();
96
- Ext.Msg.alert('Error', 'Error resetting password.');
97
- }
98
- });
99
- },
100
-
101
- viewUser : function(rec){
102
- this.setWindowStatus('Loading User...');
103
- var userId = rec.get('id');
104
- var self = this;
105
- Ext.Ajax.request({
106
- url: '/erp_app/desktop/user_management/users/get_details/' + userId,
107
- params:{},
108
- success: function(responseObject) {
109
- var response = Ext.decode(responseObject.responseText);
110
- self.tabPanel.removeAll();
42
+ Ext.define("Compass.ErpApp.Desktop.Applications.UserManagement.UsersGrid", {
43
+ extend: "Ext.grid.Panel",
44
+ alias: 'widget.usermanagement_usersgrid',
45
+ setWindowStatus: function (status) {
46
+ this.findParentByType('statuswindow').setStatus(status);
47
+ },
111
48
 
112
- self.initialConfig.tabPanel.add(
113
- {
114
- xtype:'usermanagement_personalinfopanel',
115
- businessParty:response.businessParty,
116
- userInfo:response.userInfo,
117
- entityType:response.entityType
118
- });
49
+ clearWindowStatus: function () {
50
+ this.findParentByType('statuswindow').clearStatus();
51
+ },
119
52
 
120
- self.initialConfig.tabPanel.add(
121
- {
122
- xtype:'controlpanel_userapplicationmgtpanel',
123
- userId:userId,
124
- title:'Desktop Applications',
125
- appContainerType:'Desktop'
126
- });
127
- self.initialConfig.tabPanel.add(
128
- {
129
- xtype:'controlpanel_userapplicationmgtpanel',
130
- userId:userId,
131
- appContainerType:'Organizer',
132
- title:'Organizer Applications'
133
- });
134
- self.initialConfig.tabPanel.add(
135
- {
136
- xtype:'controlpanel_userapplicationmgtpanel',
137
- userId:userId,
138
- appContainerType:'Mobile',
139
- title:'Mobile Applications'
53
+ deleteUser: function (rec) {
54
+ var self = this;
55
+ self.setWindowStatus('Deleting user...');
56
+ Ext.Ajax.request({
57
+ url: '/erp_app/desktop/user_management/users/delete/' + rec.get("id"),
58
+ method: 'POST',
59
+ success: function (response) {
60
+ var obj = Ext.decode(response.responseText);
61
+ if (obj.success) {
62
+ self.clearWindowStatus();
63
+ self.getStore().load();
64
+ }
65
+ else {
66
+ self.clearWindowStatus();
67
+ Ext.Msg.alert('Error', obj.message);
68
+ }
69
+ },
70
+ failure: function (response) {
71
+ self.clearWindowStatus();
72
+ Ext.Msg.alert('Error', 'Error deleting user.');
73
+ }
140
74
  });
75
+ },
141
76
 
142
- self.initialConfig.tabPanel.add(
143
- {
144
- xtype:'shared_notesgrid',
145
- partyId:rec.get('party_id'),
146
- title:'Notes'
77
+ resetPassword: function (rec) {
78
+ var self = this;
79
+ self.setWindowStatus('Resetting password...');
80
+ Ext.Ajax.request({
81
+ url: '/users/reset_password/',
82
+ params: {
83
+ login: rec.get('email')
84
+ },
85
+ method: 'POST',
86
+ success: function (response) {
87
+ var obj = Ext.decode(response.responseText);
88
+ if (obj.success) {
89
+ self.clearWindowStatus();
90
+ Ext.Msg.alert('Notice', obj.message);
91
+ }
92
+ else {
93
+ self.clearWindowStatus();
94
+ Ext.Msg.alert('Error', obj.message);
95
+ }
96
+ },
97
+ failure: function (response) {
98
+ self.clearWindowStatus();
99
+ Ext.Msg.alert('Error', 'Error resetting password.');
100
+ }
147
101
  });
102
+ },
148
103
 
149
- self.initialConfig.tabPanel.setActiveTab(0);
150
- self.clearWindowStatus('Loading User...');
151
- },
152
- failure: function() {
153
- self.clearWindowStatus('Loading User...');
154
- Ext.Msg.alert('Status', 'Error loading User');
155
- }
156
- });
157
- },
104
+ viewUser: function (rec) {
105
+ this.setWindowStatus('Loading User...');
106
+ var userId = rec.get('id');
107
+ var self = this;
108
+ Ext.Ajax.request({
109
+ url: '/erp_app/desktop/user_management/users/get_details/' + userId,
110
+ params: {},
111
+ success: function (responseObject) {
112
+ var response = Ext.decode(responseObject.responseText);
113
+ self.tabPanel.removeAll();
158
114
 
159
- initComponent: function() {
160
- this.store.load();
161
- Compass.ErpApp.Desktop.Applications.UserManagement.UsersGrid.superclass.initComponent.call(this, arguments);
162
- },
115
+ self.initialConfig.tabPanel.add(
116
+ {
117
+ xtype: 'usermanagement_personalinfopanel',
118
+ businessParty: response.businessParty,
119
+ userInfo: response.userInfo,
120
+ entityType: response.entityType
121
+ });
163
122
 
164
- constructor : function(config) {
165
- var self = this;
123
+ self.initialConfig.tabPanel.add(
124
+ {
125
+ xtype: 'controlpanel_userapplicationmgtpanel',
126
+ userId: userId,
127
+ title: 'Desktop Applications',
128
+ appContainerType: 'Desktop'
129
+ });
130
+ self.initialConfig.tabPanel.add(
131
+ {
132
+ xtype: 'controlpanel_userapplicationmgtpanel',
133
+ userId: userId,
134
+ appContainerType: 'Organizer',
135
+ title: 'Organizer Applications'
136
+ });
137
+ self.initialConfig.tabPanel.add(
138
+ {
139
+ xtype: 'controlpanel_userapplicationmgtpanel',
140
+ userId: userId,
141
+ appContainerType: 'Mobile',
142
+ title: 'Mobile Applications'
143
+ });
166
144
 
167
- var usersStore = Ext.create('Ext.data.Store', {
168
- proxy: {
169
- type: 'ajax',
170
- url : '/erp_app/desktop/user_management/users/',
171
- reader: {
172
- idProperty: 'id',
173
- totalProperty:'totalCount',
174
- type: 'json',
175
- root: 'data'
176
- }
177
- },
178
- remoteSort:true,
179
- fields:[
180
- {
181
- name: 'id',
182
- type: 'int'
183
- },
184
- {
185
- name:'party_id',
186
- type:'int'
187
- },
188
- {
189
- name: 'username',
190
- type: 'string'
191
- },
192
- {
193
- name: 'email',
194
- type: 'string'
195
- }
196
- ]
197
- });
198
-
199
- var columns = [{
200
- header:'Username',
201
- dataIndex:'username',
202
- width:150
145
+ self.initialConfig.tabPanel.add(
146
+ {
147
+ xtype: 'shared_notesgrid',
148
+ partyId: rec.get('party_id'),
149
+ title: 'Notes'
150
+ });
151
+
152
+ self.initialConfig.tabPanel.setActiveTab(0);
153
+ self.clearWindowStatus('Loading User...');
154
+ },
155
+ failure: function () {
156
+ self.clearWindowStatus('Loading User...');
157
+ Ext.Msg.alert('Status', 'Error loading User');
158
+ }
159
+ });
203
160
  },
204
- {
205
- header:'Email',
206
- dataIndex:'email',
207
- width:150
161
+
162
+ initComponent: function () {
163
+ this.store.load();
164
+ Compass.ErpApp.Desktop.Applications.UserManagement.UsersGrid.superclass.initComponent.call(this, arguments);
208
165
  },
209
- {
210
- menuDisabled:true,
211
- resizable:false,
212
- xtype:'actioncolumn',
213
- align:'center',
214
- width:50,
215
- items:[{
216
- icon:'/images/icons/document_view/document_view_16x16.png',
217
- tooltip:'View',
218
- handler :function(grid, rowIndex, colIndex){
219
- var rec = grid.getStore().getAt(rowIndex);
220
- self.viewUser(rec);
221
- }
222
- }]
223
- }];
224
166
 
225
- if(currentUser.hasRole('admin')){
226
- columns.push({
227
- menuDisabled:true,
228
- resizable:false,
229
- xtype:'actioncolumn',
230
- align:'center',
231
- width:50,
232
- items:[{
233
- icon:'/images/icons/edit/edit_16x16.png',
234
- tooltip:'Reset Password',
235
- handler :function(grid, rowIndex, colIndex){
236
- Ext.MessageBox.confirm('Confirm', "Are you sure you want to reset this users's password?", function(btn){
237
- if(btn == 'no'){
238
- return false;
239
- }
240
- else
241
- if(btn == 'yes')
242
- {
243
- var rec = grid.getStore().getAt(rowIndex);
244
- self.resetPassword(rec);
245
- }
167
+ constructor: function (config) {
168
+ var self = this;
169
+
170
+ var usersStore = Ext.create('Ext.data.Store', {
171
+ proxy: {
172
+ type: 'ajax',
173
+ url: '/erp_app/desktop/user_management/users/',
174
+ reader: {
175
+ idProperty: 'id',
176
+ totalProperty: 'totalCount',
177
+ type: 'json',
178
+ root: 'data'
179
+ }
180
+ },
181
+ remoteSort: true,
182
+ fields: [
183
+ {
184
+ name: 'id',
185
+ type: 'int'
186
+ },
187
+ {
188
+ name: 'party_id',
189
+ type: 'int'
190
+ },
191
+ {
192
+ name: 'username',
193
+ type: 'string'
194
+ },
195
+ {
196
+ name: 'email',
197
+ type: 'string'
198
+ }
199
+ ]
200
+ });
201
+
202
+ var columns = [
203
+ {
204
+ header: 'Username',
205
+ dataIndex: 'username',
206
+ width: 150
207
+ },
208
+ {
209
+ header: 'Email',
210
+ dataIndex: 'email',
211
+ width: 150
212
+ },
213
+ {
214
+ menuDisabled: true,
215
+ resizable: false,
216
+ xtype: 'actioncolumn',
217
+ align: 'center',
218
+ width: 50,
219
+ items: [
220
+ {
221
+ icon: '/images/icons/document_view/document_view_16x16.png',
222
+ tooltip: 'View',
223
+ handler: function (grid, rowIndex, colIndex) {
224
+ var rec = grid.getStore().getAt(rowIndex);
225
+ self.viewUser(rec);
226
+ }
227
+ }
228
+ ]
229
+ }
230
+ ];
231
+
232
+ if (currentUser.hasRole('admin')) {
233
+ columns.push({
234
+ menuDisabled: true,
235
+ resizable: false,
236
+ xtype: 'actioncolumn',
237
+ align: 'center',
238
+ width: 50,
239
+ items: [
240
+ {
241
+ icon: '/images/icons/key/key_16x16.png',
242
+ tooltip: 'Reset Password',
243
+ handler: function (grid, rowIndex, colIndex) {
244
+ Ext.MessageBox.confirm('Confirm', "Are you sure you want to reset this users's password?", function (btn) {
245
+ if (btn == 'no') {
246
+ return false;
247
+ }
248
+ else if (btn == 'yes') {
249
+ var rec = grid.getStore().getAt(rowIndex);
250
+ self.resetPassword(rec);
251
+ }
252
+ });
253
+ }
254
+ }
255
+ ]
246
256
  });
247
- }
248
- }]
249
- });
250
- }
257
+ }
251
258
 
252
- if(currentUser.hasCapability('delete','User')){
253
- columns.push({
254
- menuDisabled:true,
255
- resizable:false,
256
- xtype:'actioncolumn',
257
- align:'center',
258
- width:50,
259
- items:[{
260
- icon:'/images/icons/delete/delete_16x16.png',
261
- tooltip:'Delete',
262
- handler :function(grid, rowIndex, colIndex){
263
- Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this user?', function(btn){
264
- if(btn == 'no'){
265
- return false;
266
- }
267
- else
268
- if(btn == 'yes')
269
- {
270
- var rec = grid.getStore().getAt(rowIndex);
271
- self.deleteUser(rec);
272
- }
259
+ if (currentUser.hasCapability('delete', 'User')) {
260
+ columns.push({
261
+ menuDisabled: true,
262
+ resizable: false,
263
+ xtype: 'actioncolumn',
264
+ align: 'center',
265
+ width: 50,
266
+ items: [
267
+ {
268
+ icon: '/images/icons/delete/delete_16x16.png',
269
+ tooltip: 'Delete',
270
+ handler: function (grid, rowIndex, colIndex) {
271
+ Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this user?', function (btn) {
272
+ if (btn == 'no') {
273
+ return false;
274
+ }
275
+ else if (btn == 'yes') {
276
+ var rec = grid.getStore().getAt(rowIndex);
277
+ self.deleteUser(rec);
278
+ }
279
+ });
280
+ }
281
+ }
282
+ ]
273
283
  });
274
- }
275
- }]
276
- });
277
- }
284
+ }
278
285
 
279
- var toolBarItems = [];
280
- if(currentUser.hasCapability('create','User')){
281
- toolBarItems.push({
282
- text:'Add User',
283
- iconCls:'icon-add',
284
- handler:function(){
285
- var addUserWindow = Ext.create("Ext.window.Window",{
286
- width:325,
287
- layout:'fit',
288
- title:'New User',
289
- plain: true,
290
- buttonAlign:'center',
291
- items: {
292
- xtype:'form',
293
- frame:false,
294
- bodyStyle:'padding:5px 5px 0',
295
- url:'/erp_app/desktop/user_management/users/new',
296
- defaults: {
297
- width: 225,
298
- labelWidth: 100
299
- },
300
- items: [
301
- {
302
- emptyText:'Select Gender...',
303
- xtype: 'combo',
304
- forceSelection:true,
305
- store: [['m','Male'],['f','Female']],
306
- fieldLabel: 'Gender',
307
- name: 'gender',
308
- allowBlank: false,
309
- triggerAction: 'all'
286
+ var toolBarItems = [];
287
+ if (currentUser.hasCapability('create', 'User')) {
288
+ toolBarItems.push({
289
+ text: 'Add User',
290
+ iconCls: 'icon-add',
291
+ handler: function () {
292
+ var addUserWindow = Ext.create("Ext.window.Window", {
293
+ width: 325,
294
+ layout: 'fit',
295
+ title: 'New User',
296
+ plain: true,
297
+ buttonAlign: 'center',
298
+ items: {
299
+ xtype: 'form',
300
+ frame: false,
301
+ bodyStyle: 'padding:5px 5px 0',
302
+ url: '/erp_app/desktop/user_management/users/new',
303
+ defaults: {
304
+ width: 225,
305
+ labelWidth: 100
306
+ },
307
+ items: [
308
+ {
309
+ emptyText: 'Select Gender...',
310
+ xtype: 'combo',
311
+ forceSelection: true,
312
+ store: [
313
+ ['m', 'Male'],
314
+ ['f', 'Female']
315
+ ],
316
+ fieldLabel: 'Gender',
317
+ name: 'gender',
318
+ allowBlank: false,
319
+ triggerAction: 'all'
310
320
 
311
- },
312
- {
313
- xtype:'textfield',
314
- fieldLabel:'First Name',
315
- allowBlank:false,
316
- name:'first_name'
317
- },
318
- {
319
- xtype:'textfield',
320
- fieldLabel:'Last Name',
321
- allowBlank:false,
322
- name:'last_name'
323
- },
324
- {
325
- xtype:'textfield',
326
- fieldLabel:'Email',
327
- allowBlank:false,
328
- name:'email'
329
- },
330
- {
331
- xtype:'textfield',
332
- fieldLabel:'Username',
333
- allowBlank:false,
334
- name:'username'
335
- },
336
- {
337
- xtype:'textfield',
338
- fieldLabel:'Password',
339
- inputType: 'password',
340
- allowBlank:false,
341
- name:'password'
342
- },
343
- {
344
- xtype:'textfield',
345
- fieldLabel:'Confirm Password',
346
- inputType: 'password',
347
- allowBlank:false,
348
- name:'password_confirmation'
349
- }
350
- ]
351
- },
352
- buttons: [{
353
- text:'Submit',
354
- listeners:{
355
- 'click':function(button){
356
- var window = button.findParentByType('window');
357
- var formPanel = window.query('.form')[0];
358
- self.setWindowStatus('Creating user...');
359
- formPanel.getForm().submit({
360
- reset:true,
361
- success:function(form, action){
362
- self.clearWindowStatus();
363
- var obj = Ext.decode(action.response.responseText);
364
- if(obj.success){
365
- self.getStore().load();
366
- }
367
- else{
368
- Ext.Msg.alert("Error", obj.message);
369
- }
370
- },
371
- failure:function(form, action){
372
- self.clearWindowStatus();
373
- if(action.response !== undefined){
374
- var obj = Ext.decode(action.response.responseText);
375
- Ext.Msg.alert("Error", obj.message);
376
- }
377
- else{
378
- Ext.Msg.alert("Error", 'Error adding user.');
379
- }
380
- }
381
- });
321
+ },
322
+ {
323
+ xtype: 'textfield',
324
+ fieldLabel: 'First Name',
325
+ allowBlank: false,
326
+ name: 'first_name'
327
+ },
328
+ {
329
+ xtype: 'textfield',
330
+ fieldLabel: 'Last Name',
331
+ allowBlank: false,
332
+ name: 'last_name'
333
+ },
334
+ {
335
+ xtype: 'textfield',
336
+ fieldLabel: 'Email',
337
+ allowBlank: false,
338
+ name: 'email'
339
+ },
340
+ {
341
+ xtype: 'textfield',
342
+ fieldLabel: 'Username',
343
+ allowBlank: false,
344
+ name: 'username'
345
+ },
346
+ {
347
+ xtype: 'textfield',
348
+ fieldLabel: 'Password',
349
+ inputType: 'password',
350
+ allowBlank: false,
351
+ name: 'password'
352
+ },
353
+ {
354
+ xtype: 'textfield',
355
+ fieldLabel: 'Confirm Password',
356
+ inputType: 'password',
357
+ allowBlank: false,
358
+ name: 'password_confirmation'
359
+ }
360
+ ]
361
+ },
362
+ buttons: [
363
+ {
364
+ text: 'Submit',
365
+ listeners: {
366
+ 'click': function (button) {
367
+ var window = button.findParentByType('window');
368
+ var formPanel = window.query('.form')[0];
369
+ self.setWindowStatus('Creating user...');
370
+ formPanel.getForm().submit({
371
+ reset: true,
372
+ success: function (form, action) {
373
+ self.clearWindowStatus();
374
+ var obj = Ext.decode(action.response.responseText);
375
+ if (obj.success) {
376
+ self.getStore().load();
377
+ }
378
+ else {
379
+ Ext.Msg.alert("Error", obj.message);
380
+ }
381
+ },
382
+ failure: function (form, action) {
383
+ self.clearWindowStatus();
384
+ if (action.response !== undefined) {
385
+ var obj = Ext.decode(action.response.responseText);
386
+ Ext.Msg.alert("Error", obj.message);
387
+ }
388
+ else {
389
+ Ext.Msg.alert("Error", 'Error adding user.');
390
+ }
391
+ }
392
+ });
393
+ }
394
+ }
395
+ },
396
+ {
397
+ text: 'Close',
398
+ handler: function () {
399
+ addUserWindow.close();
400
+ }
401
+ }
402
+ ]
403
+ });
404
+ addUserWindow.show();
382
405
  }
383
- }
384
- },{
385
- text: 'Close',
386
- handler: function(){
387
- addUserWindow.close();
388
- }
389
- }]
390
- });
391
- addUserWindow.show();
392
- }
393
- });
406
+ });
394
407
 
395
- toolBarItems.push('|');
396
- }
408
+ toolBarItems.push('|');
409
+ }
397
410
 
398
- toolBarItems.push({
399
- xtype:'textfield',
400
- hideLabel:true,
401
- id:'user_search_field'
402
- });
403
- toolBarItems.push({
404
- text: 'Search',
405
- iconCls: 'icon-search',
406
- handler: function(button) {
407
- var username = Ext.getCmp('user_search_field').getValue();
408
- usersStore.setProxy({
409
- type: 'ajax',
410
- url: '/erp_app/desktop/user_management/users/',
411
- reader: {
412
- type: 'json',
413
- root: 'data',
414
- idProperty: 'id',
415
- totalProperty:'totalCount'
416
- },
417
- extraParams:{
418
- username:username
419
- }
411
+ toolBarItems.push({
412
+ xtype: 'textfield',
413
+ width: 200,
414
+ hideLabel: true,
415
+ id: 'user_search_field'
416
+ });
417
+ toolBarItems.push({
418
+ text: 'Search',
419
+ iconCls: 'icon-search',
420
+ handler: function (button) {
421
+ var username = Ext.getCmp('user_search_field').getValue();
422
+ usersStore.setProxy({
423
+ type: 'ajax',
424
+ url: '/erp_app/desktop/user_management/users/',
425
+ reader: {
426
+ type: 'json',
427
+ root: 'data',
428
+ idProperty: 'id',
429
+ totalProperty: 'totalCount'
430
+ },
431
+ extraParams: {
432
+ username: username
433
+ }
434
+ });
435
+ usersStore.loadPage(1);
436
+ }
420
437
  });
421
- usersStore.loadPage(1);
422
- }
423
- });
424
438
 
425
- config = Ext.apply({
426
- width:460,
427
- region:'west',
428
- store:usersStore,
429
- loadMask:false,
430
- columns:columns,
431
- tbar:{
432
- items:toolBarItems
433
- },
434
- bbar: Ext.create("Ext.toolbar.Paging",{
435
- pageSize: 25,
436
- store: usersStore,
437
- displayInfo: true,
438
- displayMsg: 'Displaying {0} - {1} of {2}',
439
- emptyMsg: "No Users"
440
- })
441
- }, config);
439
+ config = Ext.apply({
440
+ width: 460,
441
+ region: 'west',
442
+ store: usersStore,
443
+ loadMask: false,
444
+ columns: columns,
445
+ tbar: {
446
+ items: toolBarItems
447
+ },
448
+ bbar: Ext.create("Ext.toolbar.Paging", {
449
+ pageSize: 25,
450
+ store: usersStore,
451
+ displayInfo: true,
452
+ displayMsg: 'Displaying {0} - {1} of {2}',
453
+ emptyMsg: "No Users"
454
+ })
455
+ }, config);
442
456
 
443
- Compass.ErpApp.Desktop.Applications.UserManagement.UsersGrid.superclass.constructor.call(this, config);
444
- }
457
+ Compass.ErpApp.Desktop.Applications.UserManagement.UsersGrid.superclass.constructor.call(this, config);
458
+ }
445
459
  });