erp_app 3.0.13 → 3.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. data/app/controllers/erp_app/desktop/audit_log_viewer/base_controller.rb +1 -1
  2. data/app/controllers/erp_app/desktop/file_manager/base_controller.rb +5 -5
  3. data/app/controllers/erp_app/desktop/scaffold/role_controller.rb +1 -1
  4. data/app/controllers/erp_app/desktop/security_management/base_controller.rb +47 -0
  5. data/app/controllers/erp_app/desktop/security_management/capabilities_controller.rb +129 -0
  6. data/app/controllers/erp_app/desktop/security_management/groups_controller.rb +201 -0
  7. data/app/controllers/erp_app/desktop/security_management/roles_controller.rb +188 -0
  8. data/app/controllers/erp_app/desktop/security_management/users_controller.rb +145 -0
  9. data/app/controllers/erp_app/desktop/user_management/base_controller.rb +2 -2
  10. data/app/controllers/erp_app/desktop/user_management/role_management_controller.rb +6 -6
  11. data/app/controllers/erp_app/public_controller.rb +3 -14
  12. data/app/models/application.rb +1 -10
  13. data/app/models/configuration_item_type.rb +1 -1
  14. data/app/models/configuration_option.rb +1 -1
  15. data/app/models/widget.rb +2 -11
  16. data/config/routes.rb +6 -3
  17. data/db/data_migrations/20110728201729_erp_app_setup.rb +2 -48
  18. data/db/data_migrations/20110816161238_create_desktop_app_audit_log_viewer.rb +4 -1
  19. data/db/data_migrations/20111108183739_add_default_capabilities.rb +11 -18
  20. data/db/data_migrations/20111108183740_add_new_contact_widgets.rb +4 -13
  21. data/db/data_migrations/20120229160222_add_userinfo_widget.rb +6 -8
  22. data/db/data_migrations/20120418164215_create_configuration_management_desktop_application.rb +4 -0
  23. data/db/data_migrations/20121130201859_upgrade_remove_system_mgmt_app.rb +15 -0
  24. data/db/data_migrations/20121218175028_create_security_management_desktop_application.rb +28 -0
  25. data/lib/erp_app/engine.rb +5 -5
  26. data/lib/erp_app/extensions/railties/action_view/helpers/include_helper.rb +4 -3
  27. data/lib/erp_app/extensions/railties/action_view/helpers/tag_helper.rb +8 -2
  28. data/lib/erp_app/version.rb +1 -1
  29. data/lib/erp_app/widgets/base.rb +4 -0
  30. data/lib/erp_app/widgets/loader.rb +40 -34
  31. data/public/images/icons/add/Thumbs.db +0 -0
  32. data/public/images/icons/calendar/Thumbs.db +0 -0
  33. data/public/images/icons/copy/Thumbs.db +0 -0
  34. data/public/images/icons/cut/Thumbs.db +0 -0
  35. data/public/images/icons/delete/Thumbs.db +0 -0
  36. data/public/images/icons/edit/Thumbs.db +0 -0
  37. data/public/images/icons/folder/Thumbs.db +0 -0
  38. data/public/images/icons/gear/Thumbs.db +0 -0
  39. data/public/images/icons/globe/Thumbs.db +0 -0
  40. data/public/images/icons/grid/Thumbs.db +0 -0
  41. data/public/images/icons/help/Thumbs.db +0 -0
  42. data/public/images/icons/information/Thumbs.db +0 -0
  43. data/public/images/icons/key/Thumbs.db +0 -0
  44. data/public/images/icons/log_out/Thumbs.db +0 -0
  45. data/public/images/icons/mail/Thumbs.db +0 -0
  46. data/public/images/icons/new/Thumbs.db +0 -0
  47. data/public/images/icons/next/Thumbs.db +0 -0
  48. data/public/images/icons/open/Thumbs.db +0 -0
  49. data/public/images/icons/paste/Thumbs.db +0 -0
  50. data/public/images/icons/picture/Thumbs.db +0 -0
  51. data/public/images/icons/presentation/Thumbs.db +0 -0
  52. data/public/images/icons/preview/Thumbs.db +0 -0
  53. data/public/images/icons/previous/Thumbs.db +0 -0
  54. data/public/images/icons/print/Thumbs.db +0 -0
  55. data/public/images/icons/properties/Thumbs.db +0 -0
  56. data/public/images/icons/redo/Thumbs.db +0 -0
  57. data/public/images/icons/refresh/Thumbs.db +0 -0
  58. data/public/images/icons/remove/Thumbs.db +0 -0
  59. data/public/images/icons/rename/Thumbs.db +0 -0
  60. data/public/images/icons/save/Thumbs.db +0 -0
  61. data/public/images/icons/search/Thumbs.db +0 -0
  62. data/public/images/icons/send/Thumbs.db +0 -0
  63. data/public/images/icons/settings/Thumbs.db +0 -0
  64. data/public/images/icons/synchronize/Thumbs.db +0 -0
  65. data/public/images/icons/undo/Thumbs.db +0 -0
  66. data/public/images/icons/upload/Thumbs.db +0 -0
  67. data/public/images/icons/user/Thumbs.db +0 -0
  68. data/public/images/icons/zoom_in/Thumbs.db +0 -0
  69. data/public/images/icons/zoom_out/Thumbs.db +0 -0
  70. data/public/javascripts/erp_app/authentication/compass_user.js +22 -19
  71. data/public/javascripts/erp_app/authentication/widget_manager.js +107 -107
  72. data/public/javascripts/erp_app/ckeditor/plugins/inlineeditsave/plugin.js +23 -23
  73. data/public/javascripts/erp_app/ckeditor/plugins/jwplayer/jwplayer/Thumbs.db +0 -0
  74. data/public/javascripts/erp_app/desktop/applications/file_manager/module.js +2 -2
  75. data/public/javascripts/erp_app/desktop/applications/security_management/capabilities_panel.js +82 -0
  76. data/public/javascripts/erp_app/desktop/applications/security_management/capabilities_widget.js +254 -0
  77. data/public/javascripts/erp_app/desktop/applications/security_management/groups_effective_security.js +98 -0
  78. data/public/javascripts/erp_app/desktop/applications/security_management/groups_panel.js +295 -0
  79. data/public/javascripts/erp_app/desktop/applications/security_management/groups_widget.js +254 -0
  80. data/public/javascripts/erp_app/desktop/applications/security_management/module.js +71 -0
  81. data/public/javascripts/erp_app/desktop/applications/security_management/roles_panel.js +298 -0
  82. data/public/javascripts/erp_app/desktop/applications/security_management/roles_widget.js +254 -0
  83. data/public/javascripts/erp_app/desktop/applications/security_management/users_effective_security.js +125 -0
  84. data/public/javascripts/erp_app/desktop/applications/security_management/users_panel.js +95 -0
  85. data/public/javascripts/erp_app/desktop/applications/security_management/users_widget.js +254 -0
  86. data/public/javascripts/erp_app/desktop/applications/user_management/module.js +38 -58
  87. data/public/javascripts/erp_app/organizer/applications/crm/base.js +698 -698
  88. data/public/javascripts/erp_app/organizer/applications/crm/contact_mechanism_grid.js +1 -4
  89. data/public/javascripts/erp_app/shared/compass_codemirror.js +1 -1
  90. data/public/javascripts/erp_app/shared/dynamic_editable_grid_loader_panel.js +1 -1
  91. data/public/javascripts/erp_app/shared/dynamic_forms/dynamic_form_fields.js +99 -0
  92. data/public/javascripts/erp_app/shared/file_manager_tree.js +1 -2
  93. data/public/javascripts/erp_app/shared/notes_grid.js +4 -13
  94. data/public/stylesheets/erp_app/shared/compass-ext-all.css +5 -0
  95. metadata +70 -20
  96. data/config/environment.rb +0 -0
  97. data/spec/dummy/db/schema.rb +0 -806
  98. data/spec/dummy/db/spec.sqlite3 +0 -0
  99. data/spec/dummy/log/adam.log +0 -1
  100. data/spec/dummy/log/spec.log +0 -92886
@@ -7,7 +7,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.UserManagement",{
7
7
  iconCls:'icon-user',
8
8
  handler : this.createWindow,
9
9
  scope: this
10
- }
10
+ };
11
11
  },
12
12
  createWindow : function(){
13
13
  var desktop = this.app.getDesktop();
@@ -21,6 +21,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.UserManagement",{
21
21
  title:'User Management',
22
22
  width:1100,
23
23
  height:550,
24
+ maximized: true,
24
25
  iconCls: 'icon-user',
25
26
  shim:false,
26
27
  animCollapse:false,
@@ -109,60 +110,43 @@ Ext.define("Compass.ErpApp.Desktop.Applications.UserManagement.UsersGrid",{
109
110
  var response = Ext.decode(responseObject.responseText);
110
111
  self.tabPanel.removeAll();
111
112
 
112
- if(currentUser.hasAccessToWidget("shared_notesgrid"))
113
+ self.initialConfig.tabPanel.add(
113
114
  {
114
- self.initialConfig.tabPanel.add(
115
- {
116
- xtype:'shared_notesgrid',
117
- partyId:rec.get('party_id'),
118
- title:'Notes'
119
- });
120
- }
115
+ xtype:'usermanagement_personalinfopanel',
116
+ businessParty:response.businessParty,
117
+ userInfo:response.userInfo,
118
+ entityType:response.entityType
119
+ });
121
120
 
122
- if(currentUser.hasAccessToWidget("usermanagement_personalinfopanel"))
121
+ self.initialConfig.tabPanel.add(
123
122
  {
124
- self.initialConfig.tabPanel.add(
125
- {
126
- xtype:'usermanagement_personalinfopanel',
127
- businessParty:response.businessParty,
128
- userInfo:response.userInfo,
129
- entityType:response.entityType
130
- });
131
- }
132
-
133
- if(currentUser.hasAccessToWidget("usermanagement_rolemanagementpanel"))
123
+ xtype:'controlpanel_userapplicationmgtpanel',
124
+ userId:userId,
125
+ title:'Desktop Applications',
126
+ appContainerType:'Desktop'
127
+ });
128
+ self.initialConfig.tabPanel.add(
134
129
  {
135
- self.initialConfig.tabPanel.add(
136
- {
137
- xtype:'usermanagement_rolemanagementpanel',
138
- userId:userId
139
- });
140
- }
130
+ xtype:'controlpanel_userapplicationmgtpanel',
131
+ userId:userId,
132
+ appContainerType:'Organizer',
133
+ title:'Organizer Applications'
134
+ });
135
+ self.initialConfig.tabPanel.add(
136
+ {
137
+ xtype:'controlpanel_userapplicationmgtpanel',
138
+ userId:userId,
139
+ appContainerType:'Mobile',
140
+ title:'Mobile Applications'
141
+ });
141
142
 
142
- if(currentUser.hasAccessToWidget("controlpanel_userapplicationmgtpanel"))
143
+ self.initialConfig.tabPanel.add(
143
144
  {
144
- self.initialConfig.tabPanel.add(
145
- {
146
- xtype:'controlpanel_userapplicationmgtpanel',
147
- userId:userId,
148
- title:'Desktop Applications',
149
- appContainerType:'Desktop'
150
- });
151
- self.initialConfig.tabPanel.add(
152
- {
153
- xtype:'controlpanel_userapplicationmgtpanel',
154
- userId:userId,
155
- appContainerType:'Organizer',
156
- title:'Organizer Applications'
157
- });
158
- self.initialConfig.tabPanel.add(
159
- {
160
- xtype:'controlpanel_userapplicationmgtpanel',
161
- userId:userId,
162
- appContainerType:'Mobile',
163
- title:'Mobile Applications'
164
- });
165
- }
145
+ xtype:'shared_notesgrid',
146
+ partyId:rec.get('party_id'),
147
+ title:'Notes'
148
+ });
149
+
166
150
  self.initialConfig.tabPanel.setActiveTab(0);
167
151
  self.clearWindowStatus('Loading User...');
168
152
  },
@@ -266,10 +250,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.UserManagement.UsersGrid",{
266
250
  });
267
251
  }
268
252
 
269
- if(currentUser.hasApplicationCapability('user_management', {
270
- capability_type_iid:'delete',
271
- resource:'User'
272
- })){
253
+ if(currentUser.hasCapability('delete','User')){
273
254
  columns.push({
274
255
  menuDisabled:true,
275
256
  resizable:false,
@@ -297,10 +278,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.UserManagement.UsersGrid",{
297
278
  }
298
279
 
299
280
  var toolBarItems = [];
300
- if(currentUser.hasApplicationCapability('user_management', {
301
- capability_type_iid:'create',
302
- resource:'User'
303
- })){
281
+ if(currentUser.hasCapability('create','User')){
304
282
  toolBarItems.push({
305
283
  text:'Add User',
306
284
  iconCls:'icon-add',
@@ -414,8 +392,10 @@ Ext.define("Compass.ErpApp.Desktop.Applications.UserManagement.UsersGrid",{
414
392
  addUserWindow.show();
415
393
  }
416
394
  });
395
+
396
+ toolBarItems.push('|');
417
397
  }
418
- toolBarItems.push('|');
398
+
419
399
  toolBarItems.push({
420
400
  xtype:'textfield',
421
401
  hideLabel:true,
@@ -1,748 +1,748 @@
1
- Ext.define("Compass.ErpApp.Organizer.Applications.Crm.Layout",{
2
- extend:"Ext.panel.Panel",
3
- alias:'widget.contactslayout',
4
- //private member partyId
5
- partyId:null,
6
- widget_xtypes:null,
7
-
8
- expandContacts : function(){
9
- this.southPanel.expand(true);
10
- },
11
-
12
- constructor : function(config) {
13
-
14
- this.widget_xtypes = config.widget_xtypes;
15
-
16
- config = Ext.apply({
17
- layout:'border',
18
- frame: false,
19
- autoScroll:true,
20
- region:'center',
21
- items:[]
22
-
23
- }, config);
24
-
25
- this.callParent([config]);
26
- }
1
+ Ext.define("Compass.ErpApp.Organizer.Applications.Crm.Layout", {
2
+ extend:"Ext.panel.Panel",
3
+ alias:'widget.contactslayout',
4
+ //private member partyId
5
+ partyId:null,
6
+
7
+ constructor:function (config) {
8
+ config = Ext.apply({
9
+ layout:'border',
10
+ frame:false,
11
+ autoScroll:true,
12
+ region:'center',
13
+ items:[]
14
+
15
+ }, config);
16
+
17
+ this.callParent([config]);
18
+ }
27
19
  });
28
20
 
29
- Ext.define("Compass.ErpApp.Organizer.Applications.Crm.PartyPanel",{
30
- extend:"Ext.panel.Panel",
31
- alias:'widget.crmpartypanel',
32
- //private member partyId
33
- partyId:null,
21
+ Ext.define("Compass.ErpApp.Organizer.Applications.Crm.PartyPanel", {
22
+ extend:"Ext.panel.Panel",
23
+ alias:'widget.crmpartypanel',
24
+ //private member partyId
25
+ partyId:null,
26
+
27
+ constructor:function (config) {
28
+ this.partyId = config.partyId;
29
+ var self = this;
30
+ var currentPartyGrid = config.currentPartyGrid;
31
+ var currentPartyPanel = config.currentPartyPanel;
32
+
33
+ var toolBar = Ext.create("Ext.toolbar.Toolbar", {
34
+ items:[
35
+ {
36
+ text:'Edit',
37
+ xtype:'button',
38
+ iconCls:'icon-edit',
39
+ handler:function (button) {
40
+ var rec = currentPartyGrid.store.getById(self.partyId);
41
+ currentPartyGrid.fireEvent('editpartybtnclick', this, rec);
42
+ }
43
+ },
44
+ '|',
45
+ {
46
+ text:'Delete',
47
+ xtype:'button',
48
+ iconCls:'icon-delete',
49
+ handler:function (button) {
50
+ var rec = currentPartyGrid.store.getById(self.partyId);
51
+ if (!rec) {
52
+ return false;
53
+ }
54
+ var messageBox = Ext.MessageBox.confirm(
55
+ 'Confirm', 'Are you sure?',
56
+ function (btn) {
57
+ if (btn == 'yes') {
58
+ currentPartyGrid.store.remove(rec);
59
+ Ext.getCmp('party_id_' + self.partyId).close();
60
+ }
61
+ }
62
+ );
63
+ }
64
+ }
65
+ ]
66
+ });
34
67
 
35
- constructor : function(config) {
36
- this.partyId = config.partyId;
37
- var self = this;
38
- var currentPartyGrid = config.currentPartyGrid;
39
- var currentPartyPanel = config.currentPartyPanel;
68
+ config = Ext.apply({
69
+ title:config.tabtitle,
70
+ xtype:'panel',
71
+ layout:'border',
72
+ partyType:config.party_type,
73
+ id:'party_id_' + config.partyId,
74
+ tbar:toolBar,
75
+ closable:true,
76
+ split:true,
77
+ items:[
78
+ {
79
+ id:'party_details_' + config.partyId,
80
+ region:'center',
81
+ xtype:'panel',
82
+ html:''
83
+ },
84
+ {
85
+ height:300,
86
+ collapsible:true,
87
+ region:'south',
88
+ xtype:'tabpanel',
89
+ id:'panelSouthItems_' + config.partyId,
90
+ items:config.panelSouthItems
91
+ }
92
+ ]
40
93
 
41
- var toolBar = Ext.create("Ext.toolbar.Toolbar",{
42
- items:[
43
- {
44
- text: 'Edit',
45
- xtype:'button',
46
- iconCls: 'icon-edit',
47
- handler: function(button) {
48
- var rec = currentPartyGrid.store.getById(self.partyId);
49
- currentPartyGrid.fireEvent('editpartybtnclick', this, rec);
50
- }
51
- },
52
- '|',
53
- {
54
- text: 'Delete',
55
- xtype:'button',
56
- iconCls: 'icon-delete',
57
- handler: function(button) {
58
- var rec = currentPartyGrid.store.getById(self.partyId);
59
- if (!rec) {
60
- return false;
94
+ }, config);
95
+
96
+ this.callParent([config]);
97
+ }
98
+ });
99
+
100
+ Compass.ErpApp.Organizer.Applications.Crm.Base = function (config) {
101
+ /**
102
+ * load details of party
103
+ */
104
+ loadPartyDetails = function (partyId) {
105
+ var widget_xtypes = [
106
+ 'phonenumbergrid',
107
+ 'emailaddressgrid',
108
+ 'postaladdressgrid',
109
+ 'shared_notesgrid'
110
+ ];
111
+
112
+ if (partyId == null) {
113
+ Ext.Msg.alert('Error', 'Member partyId not set');
114
+ }
115
+ else {
116
+ var tabPanel = Ext.getCmp('panelSouthItems_' + partyId);
117
+ updatePartyDetails(partyId);
118
+ Ext.getCmp('panelSouthItems_' + partyId).setActiveTab(0);
119
+
120
+ for (i = 0; i < widget_xtypes.length; i += 1) {
121
+ var widget = tabPanel.down(widget_xtypes[i]);
122
+ if (!Ext.isEmpty(widget)) {
123
+ widget.store.load();
61
124
  }
62
- var messageBox = Ext.MessageBox.confirm(
63
- 'Confirm', 'Are you sure?',
64
- function(btn){
65
- if (btn == 'yes'){
66
- currentPartyGrid.store.remove(rec);
67
- Ext.getCmp('party_id_' + self.partyId).close();
68
- }
69
- }
70
- );
71
125
  }
72
126
  }
73
- ]
74
- });
127
+ };
128
+
129
+ updatePartyDetails = function (partyId) {
130
+ Ext.Ajax.request({
131
+ url:'/erp_app/organizer/crm/get_party_details/' + partyId,
132
+ disableCaching:false,
133
+ method:'GET',
134
+ success:function (response) {
135
+ Ext.getCmp('party_details_' + partyId).update(response.responseText);
136
+ }
137
+ });
138
+ };
75
139
 
76
- config = Ext.apply({
77
- title: config.tabtitle,
78
- xtype:'panel',
79
- layout:'border',
80
- partyType: config.party_type,
81
- id : 'party_id_' + config.partyId,
82
- tbar: toolBar,
83
- closable: true,
84
- split: true,
85
- items:[
86
- {
87
- id: 'party_details_'+ config.partyId,
88
- region: 'center',
89
- xtype: 'panel',
90
- html: ''
91
- },
92
- {
93
- height: 300,
94
- collapsible: true,
95
- region: 'south',
96
- xtype:'tabpanel',
97
- id: 'panelSouthItems_' + config.partyId,
98
- items: config.panelSouthItems
140
+ openPartyTab = function (partyId, party, party_type) {
141
+ if (!party_type) {
142
+ party_type = 'Individual';
143
+ }
144
+ if (party_type == 'Individual') {
145
+ currentPartyPanel = Ext.getCmp('IndividualsCenterPanel');
146
+ currentPartyGrid = Ext.getCmp('individualSearchGrid');
147
+ } else {
148
+ currentPartyPanel = Ext.getCmp('OrganizationsCenterPanel');
149
+ currentPartyGrid = Ext.getCmp('organizationSearchGrid');
99
150
  }
100
- ]
101
-
102
- }, config);
103
151
 
104
- this.callParent([config]);
105
- }
106
- });
152
+ var panelSouthItems = [];
153
+ var xtypes = [
154
+ 'phonenumbergrid',
155
+ 'emailaddressgrid',
156
+ 'postaladdressgrid',
157
+ 'shared_notesgrid'
158
+ ];
159
+
160
+ if (party_type == 'Individual') {
161
+ for (i = 0; i < xtypes.length; i += 1) {
162
+ panelSouthItems.push({
163
+ xtype:xtypes[i],
164
+ partyId:partyId
165
+ });
166
+ }
107
167
 
108
- Compass.ErpApp.Organizer.Applications.Crm.Base = function(config){
109
- /**
110
- * load details of party
111
- */
112
- loadPartyDetails = function(partyId){
113
- widget_xtypes = individualsPanel.widget_xtypes;
168
+ var current_passport_expire_date = party.get('current_passport_expire_date');
169
+ if (!Compass.ErpApp.Utility.isBlank(current_passport_expire_date)) {
170
+ current_passport_expire_date = Ext.Date.format(current_passport_expire_date, 'm/d/Y');
171
+ }
114
172
 
115
- if(partyId == null){
116
- Ext.Msg.alert('Error', 'Member partyId not set');
117
- }
118
- else{
119
- var tabPanel = Ext.getCmp('panelSouthItems_'+partyId);
120
- updatePartyDetails(partyId);
121
-
122
- for (i=0; i < widget_xtypes.length; i += 1) {
123
- var widget = tabPanel.query(widget_xtypes[i]);
124
- if(widget.length > 0) {
125
- widget[0].setParams({
126
- partyId: partyId
127
- });
128
- widget[0].store.load();
173
+ tabtitle = party.get('current_first_name') + ' ' + party.get('current_last_name');
129
174
  }
130
- }
131
-
132
- Ext.getCmp('panelSouthItems_'+partyId).setActiveTab(0);
133
- }
134
- };
135
-
136
- updatePartyDetails = function(partyId){
137
- Ext.Ajax.request({
138
- url : '/erp_app/organizer/crm/get_party_details/'+partyId,
139
- disableCaching : false,
140
- method : 'GET',
141
- success : function(response){
142
- Ext.getCmp('party_details_' + partyId).update(response.responseText);
143
- }
144
- });
145
- };
146
-
147
- openPartyTab = function(partyId, party, party_type){
148
- if (!party_type){ party_type = 'Individual'; }
149
- if (party_type == 'Individual'){
150
- currentPartyPanel = Ext.getCmp('IndividualsCenterPanel');
151
- currentPartyGrid = Ext.getCmp('individualSearchGrid');
152
- }else{
153
- currentPartyPanel = Ext.getCmp('OrganizationsCenterPanel');
154
- currentPartyGrid = Ext.getCmp('organizationSearchGrid');
155
- }
156
-
157
- var panelSouthItems = [];
175
+ else {
176
+ for (i = 0; i < xtypes.length; i += 1) {
177
+ panelSouthItems.push({
178
+ xtype:xtypes[i]
179
+ });
180
+ }
158
181
 
159
- var xtypes = currentUser.validWidgets('crm',
160
- {
161
- partygrid : true,
162
- shared_notes_grid:true
163
- });
182
+ tabtitle = party.get('description');
183
+ }
164
184
 
165
- if (party_type == 'Individual'){
166
- for (i = 0; i < xtypes.length; i += 1) {
167
- panelSouthItems.push({
168
- xtype: xtypes[i]
185
+ var partyPanel = Ext.create("Compass.ErpApp.Organizer.Applications.Crm.PartyPanel", {
186
+ party_type:party_type,
187
+ panelSouthItems:panelSouthItems,
188
+ tabtitle:tabtitle,
189
+ party_details:'',
190
+ partyId:partyId,
191
+ currentPartyPanel:currentPartyPanel,
192
+ currentPartyGrid:currentPartyGrid
169
193
  });
170
- }
171
194
 
172
- var current_passport_expire_date = party.get('current_passport_expire_date');
173
- if (!Compass.ErpApp.Utility.isBlank(current_passport_expire_date)){
174
- current_passport_expire_date = Ext.Date.format(current_passport_expire_date, 'm/d/Y');
175
- }
195
+ currentPartyPanel.add(partyPanel);
196
+ currentPartyPanel.setActiveTab('party_id_' + partyId);
176
197
 
177
- tabtitle = party.get('current_first_name') + ' ' + party.get('current_last_name');
178
- }
179
- else{
180
- for (i = 0; i < xtypes.length; i += 1) {
181
- panelSouthItems.push({
182
- xtype: xtypes[i]
183
- });
184
- }
185
-
186
- tabtitle = party.get('description');
187
- }
198
+ loadPartyDetails(partyId);
199
+ };
188
200
 
189
- var partyPanel = Ext.create("Compass.ErpApp.Organizer.Applications.Crm.PartyPanel",{
190
- party_type: party_type,
191
- panelSouthItems: panelSouthItems,
192
- tabtitle: tabtitle,
193
- party_details: '',
194
- partyId: partyId,
195
- currentPartyPanel: currentPartyPanel,
196
- currentPartyGrid: currentPartyGrid
197
- });
201
+ var individualFormFields = [
202
+ {
203
+ xtype:'textfield',
204
+ fieldLabel:'Enterprise Identifier',
205
+ allowBlank:true,
206
+ name:'enterprise_identifier'
207
+ },
208
+ {
209
+ xtype:'textfield',
210
+ fieldLabel:'Title',
211
+ allowBlank:true,
212
+ name:'current_personal_title'
213
+ },
214
+ {
215
+ xtype:'textfield',
216
+ fieldLabel:'First Name',
217
+ allowBlank:false,
218
+ name:'current_first_name'
219
+ },
220
+ {
221
+ xtype:'textfield',
222
+ fieldLabel:'Middle Name',
223
+ allowBlank:true,
224
+ name:'current_middle_name'
225
+ },
226
+ {
227
+ xtype:'textfield',
228
+ fieldLabel:'Last Name',
229
+ allowBlank:false,
230
+ name:'current_last_name'
231
+ },
232
+ {
233
+ xtype:'textfield',
234
+ fieldLabel:'Suffix',
235
+ allowBlank:true,
236
+ name:'current_suffix'
237
+ },
238
+ {
239
+ xtype:'textfield',
240
+ fieldLabel:'Nickname',
241
+ allowBlank:true,
242
+ name:'current_nickname'
243
+ },
244
+ {
245
+ xtype:'textfield',
246
+ fieldLabel:'Passport Number',
247
+ allowBlank:true,
248
+ name:'current_passport_number'
249
+ },
250
+ {
251
+ xtype:'datefield',
252
+ fieldLabel:'Passport Expiration Date',
253
+ allowBlank:true,
254
+ name:'current_passport_expire_date'
255
+ },
256
+ {
257
+ xtype:'datefield',
258
+ fieldLabel:'DOB',
259
+ allowBlank:false,
260
+ name:'birth_date'
261
+ },
262
+ {
263
+ xtype:'combobox',
264
+ fieldLabel:'Gender',
265
+ store:Ext.create('Ext.data.Store', {
266
+ fields:['v', 'k'],
267
+ data:[
268
+ {"v":"m", "k":"Male"},
269
+ {"v":"f", "k":"Female"}
270
+ ]
271
+ }),
272
+ displayField:'k',
273
+ valueField:'v',
274
+ name:'gender'
275
+ },
276
+ {
277
+ xtype:'textfield',
278
+ fieldLabel:'Total Yrs Work Exp',
279
+ allowBlank:true,
280
+ name:'total_years_work_experience'
281
+ },
282
+ {
283
+ xtype:'textfield',
284
+ fieldLabel:'Marital Status',
285
+ allowBlank:true,
286
+ name:'marital_status'
287
+ },
288
+ {
289
+ xtype:'textfield',
290
+ fieldLabel:'Social Security Number',
291
+ allowBlank:true,
292
+ name:'social_security_number'
293
+ }
294
+ ];
198
295
 
199
- if (party_type == 'Individual'){
200
- currentPartyPanel.add(partyPanel);
201
- currentPartyPanel.setActiveTab('party_id_' + partyId);
202
- }
203
-
204
- loadPartyDetails(partyId);
205
- };
206
-
207
- var individualFormFields = [
208
- {
209
- xtype:'textfield',
210
- fieldLabel:'Enterprise Identifier',
211
- allowBlank:true,
212
- name:'enterprise_identifier'
213
- },
214
- {
215
- xtype:'textfield',
216
- fieldLabel:'Title',
217
- allowBlank:true,
218
- name:'current_personal_title'
219
- },
220
- {
221
- xtype:'textfield',
222
- fieldLabel:'First Name',
223
- allowBlank:false,
224
- name:'current_first_name'
225
- },
226
- {
227
- xtype:'textfield',
228
- fieldLabel:'Middle Name',
229
- allowBlank:true,
230
- name:'current_middle_name'
231
- },
232
- {
233
- xtype:'textfield',
234
- fieldLabel:'Last Name',
235
- allowBlank:false,
236
- name:'current_last_name'
237
- },
238
- {
239
- xtype:'textfield',
240
- fieldLabel:'Suffix',
241
- allowBlank:true,
242
- name:'current_suffix'
243
- },
244
- {
245
- xtype:'textfield',
246
- fieldLabel:'Nickname',
247
- allowBlank:true,
248
- name:'current_nickname'
249
- },
250
- {
251
- xtype:'textfield',
252
- fieldLabel:'Passport Number',
253
- allowBlank:true,
254
- name:'current_passport_number'
255
- },
256
- {
257
- xtype:'datefield',
258
- fieldLabel:'Passport Expiration Date',
259
- allowBlank:true,
260
- name:'current_passport_expire_date'
261
- },
262
- {
263
- xtype:'datefield',
264
- fieldLabel:'DOB',
265
- allowBlank:false,
266
- name:'birth_date'
267
- },
268
- {
269
- xtype:'combobox',
270
- fieldLabel: 'Gender',
271
- store: Ext.create('Ext.data.Store', {
272
- fields: ['v', 'k'],
273
- data : [
274
- {"v":"m", "k":"Male"},
275
- {"v":"f", "k":"Female"}]
276
- }),
277
- displayField: 'k',
278
- valueField: 'v',
279
- name:'gender'
280
- },
281
- {
282
- xtype:'textfield',
283
- fieldLabel:'Total Yrs Work Exp',
284
- allowBlank:true,
285
- name:'total_years_work_experience'
286
- },
287
- {
288
- xtype:'textfield',
289
- fieldLabel:'Marital Status',
290
- allowBlank:true,
291
- name:'marital_status'
292
- },
293
- {
294
- xtype:'textfield',
295
- fieldLabel:'Social Security Number',
296
- allowBlank:true,
297
- name:'social_security_number'
298
- }
299
- ];
300
-
301
- var editIndividualFormFields = [
296
+ var editIndividualFormFields = [
302
297
  {
303
- xtype:'hiddenfield',
304
- name:'id'
298
+ xtype:'hiddenfield',
299
+ name:'id'
305
300
  },
306
301
  {
307
- xtype:'hiddenfield',
308
- name:'business_party_id'
302
+ xtype:'hiddenfield',
303
+ name:'business_party_id'
309
304
  }
310
- ];
311
-
312
- var addIndividualWindow = Ext.create("Ext.window.Window",{
313
- layout:'fit',
314
- width:375,
315
- title:'New Individual',
316
- height:500,
317
- buttonAlign:'center',
318
- items: new Ext.FormPanel({
319
- labelWidth: 110,
320
- frame:false,
321
- bodyStyle:'padding:5px 5px 0',
322
- width: 425,
323
- url:'/erp_app/organizer/crm/create_party',
324
- defaults: {
325
- width: 225
326
- },
327
- items: [ individualFormFields ]
328
- }),
329
- buttons: [{
330
- text:'Submit',
331
- listeners:{
332
- 'click':function(button){
333
- var window = button.findParentByType('window');
334
- var formPanel = window.query('form')[0];
335
- formPanel.getForm().submit({
336
- reset:true,
337
- params:{
338
- party_type:'Individual'
305
+ ];
306
+
307
+ var addIndividualWindow = Ext.create("Ext.window.Window", {
308
+ layout:'fit',
309
+ width:375,
310
+ title:'New Individual',
311
+ height:500,
312
+ buttonAlign:'center',
313
+ items:new Ext.FormPanel({
314
+ labelWidth:110,
315
+ frame:false,
316
+ bodyStyle:'padding:5px 5px 0',
317
+ width:425,
318
+ url:'/erp_app/organizer/crm/create_party',
319
+ defaults:{
320
+ width:225
339
321
  },
340
- waitMsg:'Creating Individual',
341
- success:function(form, action){
342
- var response = Ext.decode(action.response.responseText);
343
- Ext.Msg.alert("Status", response.message);
344
- if(response.success){
345
- var individualName = response.individualName;
346
- addIndividualWindow.hide();
347
- var individualsSearchGrid = Ext.ComponentMgr.get('individualSearchGrid');
348
- individualsSearchGrid.store.proxy.extraParams.party_name = individualName;
349
- individualsSearchGrid.store.load();
350
- }
322
+ items:[ individualFormFields ]
323
+ }),
324
+ buttons:[
325
+ {
326
+ text:'Submit',
327
+ listeners:{
328
+ 'click':function (button) {
329
+ var window = button.findParentByType('window');
330
+ var formPanel = window.query('form')[0];
331
+ formPanel.getForm().submit({
332
+ reset:true,
333
+ params:{
334
+ party_type:'Individual'
335
+ },
336
+ waitMsg:'Creating Individual',
337
+ success:function (form, action) {
338
+ var response = Ext.decode(action.response.responseText);
339
+ Ext.Msg.alert("Status", response.message);
340
+ if (response.success) {
341
+ var individualName = response.individualName;
342
+ addIndividualWindow.hide();
343
+ var individualsSearchGrid = Ext.ComponentMgr.get('individualSearchGrid');
344
+ individualsSearchGrid.store.proxy.extraParams.party_name = individualName;
345
+ individualsSearchGrid.store.load();
346
+ }
347
+ },
348
+ failure:function (form, action) {
349
+ var message = 'Error adding individual';
350
+ if (action.response != null) {
351
+ var response = Ext.decode(action.response.responseText);
352
+ message = response.message;
353
+ }
354
+ Ext.Msg.alert("Status", message);
355
+ }
356
+ });
357
+ }
358
+ }
351
359
  },
352
- failure:function(form, action){
353
- var message = 'Error adding individual';
354
- if(action.response != null){
355
- var response = Ext.decode(action.response.responseText);
356
- message = response.message;
357
- }
358
- Ext.Msg.alert("Status", message);
360
+ {
361
+ text:'Close',
362
+ handler:function () {
363
+ addIndividualWindow.hide();
364
+ }
359
365
  }
360
- });
361
- }
362
- }
363
- },{
364
- text: 'Close',
365
- handler: function(){
366
- addIndividualWindow.hide();
367
- }
368
- }]
369
- });
370
-
371
- var editIndividualWindow = Ext.create("Ext.window.Window",{
372
- layout:'fit',
373
- width:375,
374
- title:'Edit Individual',
375
- height:500,
376
- buttonAlign:'center',
377
- items: new Ext.FormPanel({
378
- id: 'editIndividualFormPanel',
379
- labelWidth: 110,
380
- frame:false,
381
- bodyStyle:'padding:5px 5px 0',
382
- width: 425,
383
- url:'/erp_app/organizer/crm/update_party',
384
- defaults: {
385
- width: 225
386
- },
387
- items: [ individualFormFields.concat(editIndividualFormFields) ]
388
- }),
389
- buttons: [{
390
- text:'Submit',
391
- listeners:{
392
- 'click':function(button){
393
- partyId = Ext.getCmp('editIndividualFormPanel').getForm().findField('id').getValue();
394
-
395
- var window = button.findParentByType('window');
396
- var formPanel = window.query('form')[0];
397
- formPanel.getForm().submit({
398
- reset:true,
399
- params:{
400
- party_type:'Individual'
366
+ ]
367
+ });
368
+
369
+ var editIndividualWindow = Ext.create("Ext.window.Window", {
370
+ layout:'fit',
371
+ width:375,
372
+ title:'Edit Individual',
373
+ height:500,
374
+ buttonAlign:'center',
375
+ items:new Ext.FormPanel({
376
+ id:'editIndividualFormPanel',
377
+ labelWidth:110,
378
+ frame:false,
379
+ bodyStyle:'padding:5px 5px 0',
380
+ width:425,
381
+ url:'/erp_app/organizer/crm/update_party',
382
+ defaults:{
383
+ width:225
401
384
  },
402
- waitMsg:'Updating Individual',
403
- success:function(form, action){
404
- var response = Ext.decode(action.response.responseText);
405
- Ext.Msg.alert("Status", response.message);
406
- if(response.success){
407
- updatePartyDetails(partyId);
408
- editIndividualWindow.hide();
409
- Ext.getCmp('individualSearchGrid').store.load();
410
- }
385
+ items:[ individualFormFields.concat(editIndividualFormFields) ]
386
+ }),
387
+ buttons:[
388
+ {
389
+ text:'Submit',
390
+ listeners:{
391
+ 'click':function (button) {
392
+ partyId = Ext.getCmp('editIndividualFormPanel').getForm().findField('id').getValue();
393
+
394
+ var window = button.findParentByType('window');
395
+ var formPanel = window.query('form')[0];
396
+ formPanel.getForm().submit({
397
+ reset:true,
398
+ params:{
399
+ party_type:'Individual'
400
+ },
401
+ waitMsg:'Updating Individual',
402
+ success:function (form, action) {
403
+ var response = Ext.decode(action.response.responseText);
404
+ Ext.Msg.alert("Status", response.message);
405
+ if (response.success) {
406
+ updatePartyDetails(partyId);
407
+ editIndividualWindow.hide();
408
+ Ext.getCmp('individualSearchGrid').store.load();
409
+ }
410
+ },
411
+ failure:function (form, action) {
412
+ var message = 'Error updating individual';
413
+ if (action.response != null) {
414
+ var response = Ext.decode(action.response.responseText);
415
+ message = response.message;
416
+ }
417
+ Ext.Msg.alert("Status", message);
418
+ }
419
+ });
420
+ }
421
+ }
411
422
  },
412
- failure:function(form, action){
413
- var message = 'Error updating individual';
414
- if(action.response != null){
415
- var response = Ext.decode(action.response.responseText);
416
- message = response.message;
417
- }
418
- Ext.Msg.alert("Status", message);
423
+ {
424
+ text:'Close',
425
+ handler:function () {
426
+ editIndividualWindow.hide();
427
+ }
419
428
  }
420
- });
429
+ ]
430
+ });
431
+
432
+ var organizationFormFields = [
433
+ {
434
+ xtype:'textfield',
435
+ fieldLabel:'Enterprise Identifier',
436
+ allowBlank:true,
437
+ name:'enterprise_identifier'
438
+ },
439
+ {
440
+ xtype:'textfield',
441
+ fieldLabel:'Tax ID',
442
+ allowBlank:true,
443
+ name:'tax_id_number'
444
+ },
445
+ {
446
+ xtype:'textfield',
447
+ fieldLabel:'Description',
448
+ allowBlank:true,
449
+ name:'description'
421
450
  }
422
- }
423
- },{
424
- text: 'Close',
425
- handler: function(){
426
- editIndividualWindow.hide();
427
- }
428
- }]
429
- });
430
-
431
- var organizationFormFields = [
432
- {
433
- xtype:'textfield',
434
- fieldLabel:'Enterprise Identifier',
435
- allowBlank:true,
436
- name:'enterprise_identifier'
437
- },
438
- {
439
- xtype:'textfield',
440
- fieldLabel:'Tax ID',
441
- allowBlank:true,
442
- name:'tax_id_number'
443
- },
444
- {
445
- xtype:'textfield',
446
- fieldLabel:'Description',
447
- allowBlank:true,
448
- name:'description'
449
- }
450
- ];
451
-
452
- var editOrganizationFormFields = [
451
+ ];
452
+
453
+ var editOrganizationFormFields = [
453
454
  {
454
- xtype:'hiddenfield',
455
- name:'id'
455
+ xtype:'hiddenfield',
456
+ name:'id'
456
457
  },
457
458
  {
458
- xtype:'hiddenfield',
459
- name:'business_party_id'
459
+ xtype:'hiddenfield',
460
+ name:'business_party_id'
460
461
  }
461
- ];
462
-
463
- var addOrganizationWindow = Ext.create("Ext.window.Window",{
464
- layout:'fit',
465
- width:375,
466
- title:'New Organization',
467
- height:160,
468
- buttonAlign:'center',
469
- items: new Ext.FormPanel({
470
- labelWidth: 110,
471
- frame:false,
472
- bodyStyle:'padding:5px 5px 0',
473
- width: 425,
474
- url:'/erp_app/organizer/crm/create_party',
475
- defaults: {
476
- width: 225
477
- },
478
- items: [ organizationFormFields ]
479
- }),
480
- buttons: [{
481
- text:'Submit',
482
- listeners:{
483
- 'click':function(button){
484
- var window = button.findParentByType('window');
485
- var formPanel = window.query('form')[0];
486
- formPanel.getForm().submit({
487
- reset:true,
488
- waitMsg:'Creating Organization',
489
- params:{
490
- party_type:'Organization'
462
+ ];
463
+
464
+ var addOrganizationWindow = Ext.create("Ext.window.Window", {
465
+ layout:'fit',
466
+ width:375,
467
+ title:'New Organization',
468
+ height:160,
469
+ buttonAlign:'center',
470
+ items:new Ext.FormPanel({
471
+ labelWidth:110,
472
+ frame:false,
473
+ bodyStyle:'padding:5px 5px 0',
474
+ width:425,
475
+ url:'/erp_app/organizer/crm/create_party',
476
+ defaults:{
477
+ width:225
491
478
  },
492
- success:function(form, action){
493
- var response = Ext.decode(action.response.responseText);
494
- Ext.Msg.alert("Status", response.message);
495
- if(response.success){
496
- var organizationName = response.organizationName;
497
- addOrganizationWindow.hide();
498
- var organizationSearchGrid = Ext.ComponentMgr.get('organizationSearchGrid');
499
- organizationSearchGrid.store.proxy.extraParams.party_name = organizationName;
500
- organizationSearchGrid.store.load();
501
- }
479
+ items:[ organizationFormFields ]
480
+ }),
481
+ buttons:[
482
+ {
483
+ text:'Submit',
484
+ listeners:{
485
+ 'click':function (button) {
486
+ var window = button.findParentByType('window');
487
+ var formPanel = window.query('form')[0];
488
+ formPanel.getForm().submit({
489
+ reset:true,
490
+ waitMsg:'Creating Organization',
491
+ params:{
492
+ party_type:'Organization'
493
+ },
494
+ success:function (form, action) {
495
+ var response = Ext.decode(action.response.responseText);
496
+ Ext.Msg.alert("Status", response.message);
497
+ if (response.success) {
498
+ var organizationName = response.organizationName;
499
+ addOrganizationWindow.hide();
500
+ var organizationSearchGrid = Ext.ComponentMgr.get('organizationSearchGrid');
501
+ organizationSearchGrid.store.proxy.extraParams.party_name = organizationName;
502
+ organizationSearchGrid.store.load();
503
+ }
504
+ },
505
+ failure:function (form, action) {
506
+ var message = "Error adding organization";
507
+ if (action.response != null) {
508
+ var response = Ext.decode(action.response.responseText);
509
+ message = response.message;
510
+ }
511
+ Ext.Msg.alert("Status", message);
512
+ }
513
+ });
514
+ }
515
+ }
502
516
  },
503
- failure:function(form, action){
504
- var message = "Error adding organization";
505
- if(action.response != null){
506
- var response = Ext.decode(action.response.responseText);
507
- message = response.message;
508
- }
509
- Ext.Msg.alert("Status", message);
517
+ {
518
+ text:'Close',
519
+ handler:function () {
520
+ addOrganizationWindow.hide();
521
+ }
510
522
  }
511
- });
512
- }
513
- }
514
- },{
515
- text: 'Close',
516
- handler: function(){
517
- addOrganizationWindow.hide();
518
- }
519
- }]
520
- });
521
-
522
- var editOrganizationWindow = Ext.create("Ext.window.Window",{
523
- layout:'fit',
524
- width:375,
525
- title:'Edit Organization',
526
- height:160,
527
- buttonAlign:'center',
528
- items: new Ext.FormPanel({
529
- id: 'editOrganizationFormPanel',
530
- labelWidth: 110,
531
- frame:false,
532
- bodyStyle:'padding:5px 5px 0',
533
- width: 425,
534
- url:'/erp_app/organizer/crm/update_party',
535
- defaults: {
536
- width: 225
537
- },
538
- items: [ organizationFormFields.concat(editOrganizationFormFields) ]
539
- }),
540
- buttons: [{
541
- text:'Submit',
542
- listeners:{
543
- 'click':function(button){
544
- partyId = Ext.getCmp('editOrganizationFormPanel').getForm().findField('id').getValue();
545
-
546
- var window = button.findParentByType('window');
547
- var formPanel = window.query('form')[0];
548
- formPanel.getForm().submit({
549
- reset:true,
550
- waitMsg:'Updating Organization',
551
- params:{
552
- party_type:'Organization'
523
+ ]
524
+ });
525
+
526
+ var editOrganizationWindow = Ext.create("Ext.window.Window", {
527
+ layout:'fit',
528
+ width:375,
529
+ title:'Edit Organization',
530
+ height:160,
531
+ buttonAlign:'center',
532
+ items:new Ext.FormPanel({
533
+ id:'editOrganizationFormPanel',
534
+ labelWidth:110,
535
+ frame:false,
536
+ bodyStyle:'padding:5px 5px 0',
537
+ width:425,
538
+ url:'/erp_app/organizer/crm/update_party',
539
+ defaults:{
540
+ width:225
553
541
  },
554
- success:function(form, action){
555
- var response = Ext.decode(action.response.responseText);
556
- Ext.Msg.alert("Status", response.message);
557
- if(response.success){
558
- updatePartyDetails(partyId);
559
- var organizationName = response.organizationName;
560
- editOrganizationWindow.hide();
561
- var organizationSearchGrid = Ext.ComponentMgr.get('organizationSearchGrid');
562
- organizationSearchGrid.store.proxy.extraParams.party_name = organizationName;
563
- organizationSearchGrid.store.load();
564
- }
542
+ items:[ organizationFormFields.concat(editOrganizationFormFields) ]
543
+ }),
544
+ buttons:[
545
+ {
546
+ text:'Submit',
547
+ listeners:{
548
+ 'click':function (button) {
549
+ partyId = Ext.getCmp('editOrganizationFormPanel').getForm().findField('id').getValue();
550
+
551
+ var window = button.findParentByType('window');
552
+ var formPanel = window.query('form')[0];
553
+ formPanel.getForm().submit({
554
+ reset:true,
555
+ waitMsg:'Updating Organization',
556
+ params:{
557
+ party_type:'Organization'
558
+ },
559
+ success:function (form, action) {
560
+ var response = Ext.decode(action.response.responseText);
561
+ Ext.Msg.alert("Status", response.message);
562
+ if (response.success) {
563
+ updatePartyDetails(partyId);
564
+ var organizationName = response.organizationName;
565
+ editOrganizationWindow.hide();
566
+ var organizationSearchGrid = Ext.ComponentMgr.get('organizationSearchGrid');
567
+ organizationSearchGrid.store.proxy.extraParams.party_name = organizationName;
568
+ organizationSearchGrid.store.load();
569
+ }
570
+ },
571
+ failure:function (form, action) {
572
+ var message = "Error adding organization";
573
+ if (action.response != null) {
574
+ var response = Ext.decode(action.response.responseText);
575
+ message = response.message;
576
+ }
577
+ Ext.Msg.alert("Status", message);
578
+ }
579
+ });
580
+ }
581
+ }
565
582
  },
566
- failure:function(form, action){
567
- var message = "Error adding organization";
568
- if(action.response != null){
569
- var response = Ext.decode(action.response.responseText);
570
- message = response.message;
571
- }
572
- Ext.Msg.alert("Status", message);
583
+ {
584
+ text:'Close',
585
+ handler:function () {
586
+ editOrganizationWindow.hide();
587
+ }
588
+ }
589
+ ]
590
+ });
591
+
592
+ var treeMenuStore = Ext.create('Compass.ErpApp.Organizer.DefaultMenuTreeStore', {
593
+ url:'/erp_app/organizer/crm/menu',
594
+ rootText:'Customers',
595
+ rootIconCls:'icon-content',
596
+ additionalFields:[
597
+ {
598
+ name:'businessPartType'
599
+ }
600
+ ]
601
+ });
602
+
603
+ var menuTreePanel = {
604
+ xtype:'defaultmenutree',
605
+ title:'CRM',
606
+ store:treeMenuStore,
607
+ listeners:{
608
+ scope:this,
609
+ 'itemcontextmenu':function (view, record, htmlItem, index, e) {
610
+ e.stopEvent();
611
+ if (record.isLeaf()) {
612
+ var contextMenu = null;
613
+ if (record.data.businessPartType == "individual") {
614
+ contextMenu = new Ext.menu.Menu({
615
+ items:[
616
+ {
617
+ text:"Add Individual",
618
+ iconCls:'icon-add',
619
+ listeners:{
620
+ 'click':function () {
621
+ addIndividualWindow.show();
622
+ }
623
+ }
624
+ }
625
+ ]
626
+ });
627
+ }
628
+ else if (record.data.businessPartType == "organization") {
629
+ contextMenu = new Ext.menu.Menu({
630
+ items:[
631
+ {
632
+ text:"Add Organization",
633
+ iconCls:'icon-add',
634
+ listeners:{
635
+ 'click':function () {
636
+ addOrganizationWindow.show();
637
+ }
638
+ }
639
+ }
640
+ ]
641
+ });
642
+ }
643
+ contextMenu.showAt(e.xy);
644
+ }
573
645
  }
574
- });
575
646
  }
576
- }
577
- },{
578
- text: 'Close',
579
- handler: function(){
580
- editOrganizationWindow.hide();
581
- }
582
- }]
583
- });
584
-
585
- var treeMenuStore = Ext.create('Compass.ErpApp.Organizer.DefaultMenuTreeStore', {
586
- url:'/erp_app/organizer/crm/menu',
587
- rootText:'Customers',
588
- rootIconCls:'icon-content',
589
- additionalFields:[
590
- {
591
- name:'businessPartType'
592
- }
593
- ]
594
- });
595
-
596
- var menuTreePanel = {
597
- xtype:'defaultmenutree',
598
- title:'CRM',
599
- store:treeMenuStore,
600
- listeners:{
601
- scope:this,
602
- 'itemcontextmenu':function(view, record, htmlItem, index, e){
603
- e.stopEvent();
604
- if(record.isLeaf()){
605
- var contextMenu = null;
606
- if(record.data.businessPartType == "individual"){
607
- contextMenu = new Ext.menu.Menu({
608
- items:[
609
- {
610
- text:"Add Individual",
611
- iconCls:'icon-add',
612
- listeners:{
613
- 'click':function(){
614
- addIndividualWindow.show();
615
- }
647
+ };
648
+
649
+ var individualsGrid = {
650
+ id:'individualSearchGrid',
651
+ title:'Search',
652
+ xtype:'partygrid',
653
+ partyType:'Individual',
654
+ listeners:{
655
+ 'addpartybtnclick':function (btn, grid) {
656
+ addIndividualWindow.show();
657
+ },
658
+ 'editpartybtnclick':function (btn, rec) {
659
+ //rec = grid.getSelectionModel().getSelection()[0];
660
+ if (rec) {
661
+ Ext.getCmp('editIndividualFormPanel').getForm().loadRecord(rec);
662
+ editIndividualWindow.show();
616
663
  }
617
- }
618
- ]
619
- });
620
- }
621
- else
622
- if(record.data.businessPartType == "organization"){
623
- contextMenu = new Ext.menu.Menu({
624
- items:[
625
- {
626
- text:"Add Organization",
627
- iconCls:'icon-add',
628
- listeners:{
629
- 'click':function(){
630
- addOrganizationWindow.show();
631
- }
664
+ else {
665
+ Ext.Msg.alert('Please select a record to edit.');
632
666
  }
633
- }
634
- ]
635
- });
636
- }
637
- contextMenu.showAt(e.xy);
638
- }
639
- }
640
- }
641
- };
642
-
643
- var individualsGrid = {
644
- id:'individualSearchGrid',
645
- title: 'Search',
646
- xtype:'partygrid',
647
- partyType:'Individual',
648
- listeners:{
649
- 'addpartybtnclick':function(btn, grid){
650
- addIndividualWindow.show();
651
- },
652
- 'editpartybtnclick':function(btn, rec){
653
- //rec = grid.getSelectionModel().getSelection()[0];
654
- if (rec){
655
- Ext.getCmp('editIndividualFormPanel').getForm().loadRecord(rec);
656
- editIndividualWindow.show();
657
- }
658
- else{
659
- Ext.Msg.alert('Please select a record to edit.');
660
- }
661
- },
662
- 'itemdblclick':function(view, record, item, index, e, options){
663
- var partyId = record.get("id");
664
- var partyTab = Ext.getCmp('party_id_' + partyId);
665
- if (partyTab){
666
- Ext.getCmp('IndividualsCenterPanel').setActiveTab('party_id_' + partyId);
667
- }
668
- else{
669
- openPartyTab(partyId, record, 'Individual');
670
- }
671
- }
672
- }
673
- };
674
-
675
- var organizationsGrid = {
676
- id:'organizationSearchGrid',
677
- title: 'Search',
678
- xtype:'partygrid',
679
- partyType:'Organization',
680
- listeners:{
681
- 'addpartybtnclick':function(btn, grid){
682
- addOrganizationWindow.show();
683
- },
684
- 'editpartybtnclick':function(btn, rec){
685
- //rec = grid.getSelectionModel().getSelection()[0];
686
- if (rec){
687
- Ext.getCmp('editOrganizationFormPanel').getForm().loadRecord(rec);
688
- editOrganizationWindow.show();
689
- }
690
- else{
691
- Ext.Msg.alert('Please select a record to edit.');
692
- }
693
- },
694
- 'itemdblclick':function(view, record, item, index, e, options){
695
- var partyId = record.get("id");
696
- var partyTab = Ext.getCmp('party_id_' + partyId);
697
- if (partyTab){
698
- Ext.getCmp('OrganizationsCenterPanel').setActiveTab('party_id_' + partyId);
667
+ },
668
+ 'itemdblclick':function (view, record, item, index, e, options) {
669
+ var partyId = record.get("id");
670
+ var partyTab = Ext.getCmp('party_id_' + partyId);
671
+ if (partyTab) {
672
+ Ext.getCmp('IndividualsCenterPanel').setActiveTab('party_id_' + partyId);
673
+ }
674
+ else {
675
+ openPartyTab(partyId, record, 'Individual');
676
+ }
677
+ }
699
678
  }
700
- else{
701
- openPartyTab(partyId, record, 'Organization');
679
+ };
680
+
681
+ var organizationsGrid = {
682
+ id:'organizationSearchGrid',
683
+ title:'Search',
684
+ xtype:'partygrid',
685
+ partyType:'Organization',
686
+ listeners:{
687
+ 'addpartybtnclick':function (btn, grid) {
688
+ addOrganizationWindow.show();
689
+ },
690
+ 'editpartybtnclick':function (btn, rec) {
691
+ //rec = grid.getSelectionModel().getSelection()[0];
692
+ if (rec) {
693
+ Ext.getCmp('editOrganizationFormPanel').getForm().loadRecord(rec);
694
+ editOrganizationWindow.show();
695
+ }
696
+ else {
697
+ Ext.Msg.alert('Please select a record to edit.');
698
+ }
699
+ },
700
+ 'itemdblclick':function (view, record, item, index, e, options) {
701
+ var partyId = record.get("id");
702
+ var partyTab = Ext.getCmp('party_id_' + partyId);
703
+ if (partyTab) {
704
+ Ext.getCmp('OrganizationsCenterPanel').setActiveTab('party_id_' + partyId);
705
+ }
706
+ else {
707
+ openPartyTab(partyId, record, 'Organization');
708
+ }
709
+ }
702
710
  }
703
- }
704
- }
705
- };
711
+ };
706
712
 
707
- var xtypes = currentUser.validWidgets('crm',
708
- {
709
- partygrid : true,
710
- shared_notes_grid:true
711
- });
713
+ var individualsPanel = {
714
+ xtype:'contactslayout',
715
+ id:'individuals_search_grid',
716
+ title:'Individuals',
717
+ items:[
718
+ {
719
+ xtype:'tabpanel',
720
+ layout:'fit',
721
+ region:'center',
722
+ id:'IndividualsCenterPanel',
723
+ items:[individualsGrid]
724
+ }
725
+ ]
726
+ };
727
+
728
+ var organizationsPanel = {
729
+ xtype:'contactslayout',
730
+ id:'organizations_search_grid',
731
+ title:'Organizations',
732
+ items:[
733
+ {
734
+ xtype:'tabpanel',
735
+ layout:'fit',
736
+ region:'center',
737
+ id:'OrganizationsCenterPanel',
738
+ items:[organizationsGrid]
739
+ }
740
+ ]
741
+ };
742
+
743
+ this.setup = function () {
744
+ config.organizerLayout.addApplication(menuTreePanel, [individualsPanel, organizationsPanel]);
745
+ };
712
746
 
713
- var individualsPanel = {
714
- xtype:'contactslayout',
715
- id:'individuals_search_grid',
716
- title: 'Individuals',
717
- widget_xtypes: xtypes,
718
- items:[{
719
- xtype: 'tabpanel',
720
- layout:'fit',
721
- region:'center',
722
- id: 'IndividualsCenterPanel',
723
- autoScroll:true,
724
- items:[individualsGrid]
725
- }]
726
- };
727
-
728
- var organizationsPanel = {
729
- xtype:'contactslayout',
730
- id:'organizations_search_grid',
731
- title: 'Organizations',
732
- widget_xtypes: xtypes,
733
- items:[{
734
- xtype: 'tabpanel',
735
- layout:'fit',
736
- region:'center',
737
- id: 'OrganizationsCenterPanel',
738
- autoScroll:true,
739
- items:[organizationsGrid]
740
- }]
741
- };
742
-
743
- this.setup = function(){
744
- config.organizerLayout.addApplication(menuTreePanel, [individualsPanel, organizationsPanel]);
745
- };
746
-
747
747
  };
748
748