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.
- data/app/controllers/erp_app/desktop/scaffold/base_controller.rb +1 -0
- data/app/controllers/erp_app/desktop/user_management/base_controller.rb +8 -10
- data/app/controllers/erp_app/organizer/crm/base_controller.rb +104 -88
- data/app/mailers/crm_mailer.rb +9 -0
- data/app/views/crm_mailer/send_message.html.erb +9 -0
- data/app/views/erp_app/desktop/base/index.erb +221 -213
- data/app/views/erp_app/mobile/base/index.erb +1 -0
- data/app/views/erp_app/organizer/base/index.erb +51 -43
- data/lib/erp_app/version.rb +1 -1
- data/lib/generators/organizer_application/templates/controllers/controller_template.erb +1 -1
- data/lib/generators/organizer_application/templates/public/base.js.erb +2 -2
- data/public/javascripts/erp_app/desktop/applications/scaffold/models_tree_panel.js +19 -0
- data/public/javascripts/erp_app/desktop/applications/user_management/module.js +432 -418
- data/public/javascripts/erp_app/desktop/applications/user_management/user_application_mgt_panel.js +1 -1
- data/public/javascripts/erp_app/login/window.js +2 -1
- data/public/javascripts/erp_app/organizer/applications/crm/contact_mechanism_grid.js +511 -389
- data/public/javascripts/erp_app/organizer/applications/crm/party_grid.js +1 -1
- data/public/javascripts/erp_app/shared/configuration/configuration_form.js +238 -262
- data/public/javascripts/erp_app/shared/configuration/configuration_panel.js +103 -104
- data/public/stylesheets/erp_app/mobile/mobile.css +6 -6
- metadata +5 -89
- data/spec/dummy/db/data_migrations/20130422163128_add_usd_currency.erp_base_erp_svcs.rb +0 -12
- data/spec/dummy/db/data_migrations/20130422163129_add_iso_codes.erp_base_erp_svcs.rb +0 -19
- data/spec/dummy/db/data_migrations/20130422163130_setup_compass_ae_instance.erp_base_erp_svcs.rb +0 -21
- data/spec/dummy/db/data_migrations/20130422163131_upgrade_compass_ae_instances_data.erp_base_erp_svcs.rb +0 -19
- data/spec/dummy/db/data_migrations/20130422163132_add_guid_to_instances.erp_base_erp_svcs.rb +0 -10
- data/spec/dummy/db/data_migrations/20130422163133_create_capability_scope_types.erp_tech_svcs.rb +0 -15
- data/spec/dummy/db/data_migrations/20130422163134_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +0 -16
- data/spec/dummy/db/data_migrations/20130422163135_setup_audit_log_types.erp_tech_svcs.rb +0 -22
- data/spec/dummy/db/data_migrations/20130422163136_create_group_relationship_and_role_types.erp_tech_svcs.rb +0 -20
- data/spec/dummy/db/data_migrations/20130422163137_note_capabilities.erp_tech_svcs.rb +0 -24
- data/spec/dummy/db/data_migrations/20130422163138_erp_app_setup.erp_app.rb +0 -252
- data/spec/dummy/db/data_migrations/20130422163139_update_preferences.erp_app.rb +0 -53
- data/spec/dummy/db/data_migrations/20130422163140_create_desktop_app_audit_log_viewer.erp_app.rb +0 -24
- data/spec/dummy/db/data_migrations/20130422163141_add_file_manager_application.erp_app.rb +0 -32
- data/spec/dummy/db/data_migrations/20130422163142_add_default_capabilities.erp_app.rb +0 -23
- data/spec/dummy/db/data_migrations/20130422163143_add_new_contact_widgets.erp_app.rb +0 -42
- data/spec/dummy/db/data_migrations/20130422163144_add_userinfo_widget.erp_app.rb +0 -29
- data/spec/dummy/db/data_migrations/20130422163145_create_party_and_role_type_for_communication_events.erp_app.rb +0 -11
- data/spec/dummy/db/data_migrations/20130422163146_create_user_management_mobile_application.erp_app.rb +0 -17
- data/spec/dummy/db/data_migrations/20130422163147_create_configuration_management_desktop_application.erp_app.rb +0 -27
- data/spec/dummy/db/data_migrations/20130422163148_create_job_tracker_desktop_application.erp_app.rb +0 -23
- data/spec/dummy/db/data_migrations/20130422163149_created_tracked_jobs.erp_app.rb +0 -15
- data/spec/dummy/db/data_migrations/20130422163150_upgrade_remove_system_mgmt_app.erp_app.rb +0 -16
- data/spec/dummy/db/data_migrations/20130422163151_create_security_management_desktop_application.erp_app.rb +0 -29
- data/spec/dummy/db/data_migrations/20130422163152_add_job_tracker_mobile_app.erp_app.rb +0 -17
- data/spec/dummy/db/migrate/20130422163121_base_erp_services.erp_base_erp_svcs.rb +0 -486
- data/spec/dummy/db/migrate/20130422163122_add_txn_status.erp_base_erp_svcs.rb +0 -37
- data/spec/dummy/db/migrate/20130422163123_upgrade_compass_ae_instances.erp_base_erp_svcs.rb +0 -34
- data/spec/dummy/db/migrate/20130422163124_add_uuid_compass_ae_instance.erp_base_erp_svcs.rb +0 -17
- data/spec/dummy/db/migrate/20130422163125_add_long_lat_to_address.erp_base_erp_svcs.rb +0 -16
- data/spec/dummy/db/migrate/20130422163126_base_tech_services.erp_tech_svcs.rb +0 -271
- data/spec/dummy/db/migrate/20130422163127_create_has_attribute_tables.erp_tech_svcs.rb +0 -39
- data/spec/dummy/db/migrate/20130422163128_create_groups.erp_tech_svcs.rb +0 -19
- data/spec/dummy/db/migrate/20130422163129_upgrade_security.erp_tech_svcs.rb +0 -54
- data/spec/dummy/db/migrate/20130422163130_upgrade_security2.erp_tech_svcs.rb +0 -275
- data/spec/dummy/db/migrate/20130422163131_add_queue_to_delayed_jobs.erp_tech_svcs.rb +0 -14
- data/spec/dummy/db/migrate/20130422163132_base_app_framework.erp_app.rb +0 -276
- data/spec/dummy/db/migrate/20130422163133_add_job_tracker.erp_app.rb +0 -20
- data/spec/dummy/db/migrate/20130422163134_update_mobile_application.erp_app.rb +0 -28
- data/spec/dummy/db/schema.rb +0 -883
- data/spec/dummy/db/spec.sqlite3 +0 -0
- data/spec/dummy/log/adam.log +0 -1
- data/spec/dummy/log/spec.log +0 -113709
@@ -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
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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%> =
|
37
|
-
|
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
|
-
|
41
|
-
|
42
|
-
});
|
42
|
+
organizerLayout.setupLogoutButton();
|
43
|
+
organizerLayout.setup();
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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
|
|
data/lib/erp_app/version.rb
CHANGED
@@ -4,7 +4,7 @@ module ErpApp
|
|
4
4
|
class BaseController < ::ErpApp::Organizer::BaseController
|
5
5
|
|
6
6
|
def menu
|
7
|
-
render :
|
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
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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
|
-
|
113
|
-
|
114
|
-
|
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
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
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
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
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
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
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
|
-
|
160
|
-
|
161
|
-
|
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
|
-
|
165
|
-
|
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
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
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
|
-
|
206
|
-
|
207
|
-
|
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
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
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
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
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
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
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
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
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
|
-
|
396
|
-
|
408
|
+
toolBarItems.push('|');
|
409
|
+
}
|
397
410
|
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
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
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
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
|
-
|
444
|
-
|
457
|
+
Compass.ErpApp.Desktop.Applications.UserManagement.UsersGrid.superclass.constructor.call(this, config);
|
458
|
+
}
|
445
459
|
});
|