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
@@ -32,7 +32,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.UserManagement.UserApplicationMg
32
32
  },
33
33
 
34
34
  saveApplications : function(){
35
- var appIds = []
35
+ var appIds = [];
36
36
  var treePanel = this.current_applications_tree;
37
37
  var treeRoot = treePanel.getRootNode();
38
38
  this.setWindowStatus('Saving...');
@@ -17,7 +17,8 @@ Ext.define("Compass.ErpApp.Login.Window",{
17
17
  success:function(form, action){
18
18
  var result = Ext.decode(action.response.responseText);
19
19
  if(result.success){
20
- window.location = loginTo;
20
+ window.history.forward(1);
21
+ window.location = loginTo;
21
22
  }
22
23
  else{
23
24
  Ext.Msg.alert("Error", "Login failed. Try again");
@@ -1,203 +1,213 @@
1
1
  var contactPurposeStore = Ext.create('Ext.data.Store', {
2
- autoLoad:true,
3
- proxy: {
4
- type: 'ajax',
5
- url : '/erp_app/organizer/crm/contact_purposes',
6
- reader: {
7
- type: 'json',
8
- root: 'types'
9
- }
10
- },
11
- fields:[
12
- {
13
- name: 'description'
14
- },
15
- {
16
- name: 'id'
17
- }
18
- ]
19
- });
20
-
21
- Ext.define("Compass.ErpApp.Organizer.Applications.Crm.ContactMechanismGrid",{
22
- extend:"Ext.grid.Panel",
23
- alias:'widget.contactmechanismgrid',
24
- initComponent: function() {
25
- var config = this.initialConfig;
26
- var store = Ext.create('Ext.data.Store', {
27
- fields:config['fields'],
28
- autoLoad: false,
29
- autoSync: true,
30
- proxy: {
31
- type: 'rest',
32
- url:config['url'] || '/erp_app/organizer/crm/contact_mechanism',
33
- extraParams:{
34
- party_id:config['partyId'],
35
- contact_type:config['contactMechanism']
36
- },
2
+ autoLoad: true,
3
+ proxy: {
4
+ type: 'ajax',
5
+ url: '/erp_app/organizer/crm/contact_purposes',
37
6
  reader: {
38
- type: 'json',
39
- successProperty: 'success',
40
- idProperty: 'id',
41
- root: 'data',
42
- totalProperty:'totalCount',
43
- messageProperty: 'message'
44
- },
45
- writer: {
46
- type: 'json',
47
- writeAllFields:true,
48
- root: 'data'
7
+ type: 'json',
8
+ root: 'types'
9
+ }
10
+ },
11
+ fields: [
12
+ {
13
+ name: 'description'
49
14
  },
50
- listeners: {
51
- exception: function(proxy, response, operation){
52
- Ext.MessageBox.show({
53
- title: 'REMOTE EXCEPTION',
54
- msg: 'Make sure an Individual or Organization is selected' + config.title,
55
- icon: Ext.MessageBox.ERROR,
56
- buttons: Ext.Msg.OK
57
- });
58
- }
15
+ {
16
+ name: 'id'
59
17
  }
60
- }
61
- });
62
-
63
- this.store = store;
18
+ ]
19
+ });
64
20
 
65
- this.bbar = Ext.create("Ext.PagingToolbar",{
66
- pageSize: 30,
67
- store: store,
68
- displayInfo: true,
69
- displayMsg: 'Displaying {0} - {1} of {2}',
70
- emptyMsg: "No " + config.title
71
- });
72
-
73
- this.callParent(arguments);
74
- },
75
- constructor : function(config) {
76
- config['contactPurposeStore'] = contactPurposeStore;
21
+ Ext.define("Compass.ErpApp.Organizer.Applications.Crm.ContactMechanismGrid", {
22
+ extend: "Ext.grid.Panel",
23
+ alias: 'widget.contactmechanismgrid',
24
+ initComponent: function () {
25
+ var config = this.initialConfig;
26
+ var store = Ext.create('Ext.data.Store', {
27
+ fields: config['fields'],
28
+ autoLoad: false,
29
+ autoSync: true,
30
+ proxy: {
31
+ type: 'rest',
32
+ url: config['url'] || '/erp_app/organizer/crm/contact_mechanism',
33
+ extraParams: {
34
+ party_id: config['partyId'],
35
+ contact_type: config['contactMechanism']
36
+ },
37
+ reader: {
38
+ type: 'json',
39
+ successProperty: 'success',
40
+ idProperty: 'id',
41
+ root: 'data',
42
+ totalProperty: 'totalCount',
43
+ messageProperty: 'message'
44
+ },
45
+ writer: {
46
+ type: 'json',
47
+ writeAllFields: true,
48
+ root: 'data'
49
+ },
50
+ listeners: {
51
+ exception: function (proxy, response, operation) {
52
+ Ext.MessageBox.show({
53
+ title: 'REMOTE EXCEPTION',
54
+ msg: 'Make sure an Individual or Organization is selected' + config.title,
55
+ icon: Ext.MessageBox.ERROR,
56
+ buttons: Ext.Msg.OK
57
+ });
58
+ }
59
+ }
60
+ }
61
+ });
77
62
 
78
- if (config.columns === undefined) {
79
- config.columns = [];
80
- }
63
+ this.store = store;
81
64
 
82
- config.columns = config.columns.concat([
83
- {
84
- header: 'Contact Purpose',
85
- dataIndex: 'contact_purpose_id',
86
- renderer:function(){
87
- var record = arguments[2];
88
- if(!Compass.ErpApp.Utility.isBlank(record.data['contact_purpose_id'])){
89
- return config['contactPurposeStore'].getAt(config['contactPurposeStore'].find("id", record.data['contact_purpose_id'])).get("description");
90
- }
91
- else{
92
- return '';
93
- }
94
- },
95
- editor:{
96
- xtype:'combo',
97
- forceSelection:true,
98
- typeAhead: true,
99
- mode: 'local',
100
- displayField:'description',
101
- valueField:'id',
102
- triggerAction: 'all',
103
- store: config['contactPurposeStore'],
104
- selectOnFocus:true
105
- },
106
- width:200
107
- },
108
- {
109
- header: 'Created',
110
- dataIndex: 'created_at',
111
- renderer: Ext.util.Format.dateRenderer('m/d/Y g:i a'),
112
- width:200
65
+ this.bbar = Ext.create("Ext.PagingToolbar", {
66
+ pageSize: 30,
67
+ store: store,
68
+ displayInfo: true,
69
+ displayMsg: 'Displaying {0} - {1} of {2}',
70
+ emptyMsg: "No " + config.title
71
+ });
72
+
73
+ this.callParent(arguments);
113
74
  },
114
- {
115
- header: 'Last Update',
116
- dataIndex: 'updated_at',
117
- renderer: Ext.util.Format.dateRenderer('m/d/Y g:i a'),
118
- width:200
119
- }
120
- ]);
75
+ constructor: function (config) {
76
+ config['contactPurposeStore'] = contactPurposeStore;
121
77
 
122
- if(!config.validations)
123
- config.validations = [];
124
- config.validations = config.validations.concat({
125
- type: 'presence',
126
- field: 'contact_purpose_id'
127
- });
78
+ if (config.columns === undefined) {
79
+ config.columns = [];
80
+ }
128
81
 
129
- if (config.fields === undefined) {
130
- config.fields = [];
131
- }
82
+ config.columns = config.columns.concat([
83
+ {
84
+ header: 'Contact Purpose',
85
+ dataIndex: 'contact_purpose_id',
86
+ renderer: function () {
87
+ var record = arguments[2];
88
+ if (!Compass.ErpApp.Utility.isBlank(record.data['contact_purpose_id'])) {
89
+ return config['contactPurposeStore'].getAt(config['contactPurposeStore'].find("id", record.data['contact_purpose_id'])).get("description");
90
+ }
91
+ else {
92
+ return '';
93
+ }
94
+ },
95
+ editor: {
96
+ xtype: 'combo',
97
+ forceSelection: true,
98
+ typeAhead: true,
99
+ mode: 'local',
100
+ displayField: 'description',
101
+ valueField: 'id',
102
+ triggerAction: 'all',
103
+ store: config['contactPurposeStore'],
104
+ selectOnFocus: true
105
+ },
106
+ width: 200
107
+ },
108
+ {
109
+ header: 'Created',
110
+ dataIndex: 'created_at',
111
+ renderer: Ext.util.Format.dateRenderer('m/d/Y g:i a'),
112
+ width: 200
113
+ },
114
+ {
115
+ header: 'Last Update',
116
+ dataIndex: 'updated_at',
117
+ renderer: Ext.util.Format.dateRenderer('m/d/Y g:i a'),
118
+ width: 200
119
+ }
120
+ ]);
132
121
 
133
- config.fields = config.fields.concat([
134
- {
135
- name:'contact_purpose_id'
136
- },
137
- {
138
- name:'created_at'
139
- },
140
- {
141
- name:'updated_at'
142
- },
143
- {
144
- name:'id'
145
- }
146
- ]);
122
+ if (!config.validations)
123
+ config.validations = [];
124
+ config.validations = config.validations.concat({
125
+ type: 'presence',
126
+ field: 'contact_purpose_id'
127
+ });
147
128
 
148
- var Model = Ext.define(config.title,{
149
- extend:'Ext.data.Model',
150
- fields:config.fields,
151
- validations:config.validations
152
- });
129
+ if (config.fields === undefined) {
130
+ config.fields = [];
131
+ }
153
132
 
154
- this.editing = Ext.create('Ext.grid.plugin.RowEditing', {
155
- clicksToMoveEditor: 1
156
- });
133
+ config.fields = config.fields.concat([
134
+ {
135
+ name: 'contact_purpose_id'
136
+ },
137
+ {
138
+ name: 'created_at'
139
+ },
140
+ {
141
+ name: 'updated_at'
142
+ },
143
+ {
144
+ name: 'id'
145
+ }
146
+ ]);
157
147
 
158
- config = Ext.apply({
159
- layout:'fit',
160
- frame: false,
161
- region:'center',
162
- loadMask:true,
163
- plugins:[this.editing],
164
- tbar:{
165
- items:[{
166
- text: 'Add',
167
- xtype:'button',
168
- iconCls: 'icon-add',
169
- handler: function(button) {
170
- var grid = button.findParentByType('contactmechanismgrid');
171
- var edit = grid.editing;
172
- grid.store.insert(0, new Model());
173
- edit.startEdit(0,0);
174
- }
175
- },
176
- '-',
177
- {
178
- text: 'Delete',
179
- type:'button',
180
- iconCls: 'icon-delete',
181
- handler: function(button) {
182
- var grid = button.findParentByType('contactmechanismgrid');
183
- var selection = grid.getView().getSelectionModel().getSelection()[0];
184
- if (selection) {
185
- var messageBox = Ext.MessageBox.confirm(
186
- 'Confirm', 'Are you sure?',
187
- function(btn){
188
- if (btn == 'yes'){
189
- grid.store.remove(selection);
190
- }
148
+ var Model = Ext.define(config.title, {
149
+ extend: 'Ext.data.Model',
150
+ fields: config.fields,
151
+ validations: config.validations
152
+ });
153
+
154
+ this.editing = Ext.create('Ext.grid.plugin.RowEditing', {
155
+ clicksToMoveEditor: 1
156
+ });
157
+
158
+ var toolBarItems = [
159
+ {
160
+ text: 'Add',
161
+ xtype: 'button',
162
+ iconCls: 'icon-add',
163
+ handler: function (button) {
164
+ var grid = button.findParentByType('contactmechanismgrid');
165
+ var edit = grid.editing;
166
+ grid.store.insert(0, new Model());
167
+ edit.startEdit(0, 0);
168
+ }
169
+ },
170
+ '-',
171
+ {
172
+ text: 'Delete',
173
+ type: 'button',
174
+ iconCls: 'icon-delete',
175
+ handler: function (button) {
176
+ var grid = button.findParentByType('contactmechanismgrid');
177
+ var selection = grid.getView().getSelectionModel().getSelection()[0];
178
+ if (selection) {
179
+ var messageBox = Ext.MessageBox.confirm(
180
+ 'Confirm', 'Are you sure?',
181
+ function (btn) {
182
+ if (btn == 'yes') {
183
+ grid.store.remove(selection);
184
+ }
185
+ }
186
+ );
187
+ }
191
188
  }
192
- );
193
189
  }
194
- }
195
- }]
196
- }
197
- }, config);
198
-
199
- this.callParent([config]);
200
- }
190
+ ];
191
+
192
+ if (!Ext.isEmpty(config.toolbarItems)) {
193
+ toolBarItems = toolBarItems.concat(config.toolbarItems);
194
+ }
195
+
196
+ config = Ext.apply({
197
+ layout: 'fit',
198
+ frame: false,
199
+ region: 'center',
200
+ loadMask: true,
201
+ plugins: [this.editing],
202
+ dockedItems: {
203
+ xtype: 'toolbar',
204
+ docked: 'top',
205
+ items: toolBarItems
206
+ }
207
+ }, config);
208
+
209
+ this.callParent([config]);
210
+ }
201
211
  });
202
212
 
203
213
  /**
@@ -205,38 +215,38 @@ Ext.define("Compass.ErpApp.Organizer.Applications.Crm.ContactMechanismGrid",{
205
215
  * This grid extends the ContactMechanismGrid and sets it up with columns for
206
216
  * displaying phone numbers
207
217
  */
208
- Ext.define("Compass.ErpApp.Organizer.Applications.Crm.ContactMechanismGrid.PhoneNumberGrid",{
209
- extend:"Compass.ErpApp.Organizer.Applications.Crm.ContactMechanismGrid",
210
- alias:'widget.phonenumbergrid',
211
- initComponent: function () {
212
- this.callParent(arguments);
213
- },
214
- constructor: function(config) {
215
- config.title = 'Phone Numbers';
216
- config.contactMechanism = 'PhoneNumber';
217
- config.columns = [
218
- {
219
- header: 'Phone Number',
220
- dataIndex: 'phone_number',
221
- editor: {
222
- xtype:'textfield'
223
- },
224
- width:200
225
- }
226
- ];
227
- config.fields = [
228
- {
229
- name:'phone_number'
230
- }
231
- ];
232
- config.validations = [
233
- {
234
- type: 'presence',
235
- field: 'phone_number'
218
+ Ext.define("Compass.ErpApp.Organizer.Applications.Crm.ContactMechanismGrid.PhoneNumberGrid", {
219
+ extend: "Compass.ErpApp.Organizer.Applications.Crm.ContactMechanismGrid",
220
+ alias: 'widget.phonenumbergrid',
221
+ initComponent: function () {
222
+ this.callParent(arguments);
223
+ },
224
+ constructor: function (config) {
225
+ config.title = 'Phone Numbers';
226
+ config.contactMechanism = 'PhoneNumber';
227
+ config.columns = [
228
+ {
229
+ header: 'Phone Number',
230
+ dataIndex: 'phone_number',
231
+ editor: {
232
+ xtype: 'textfield'
233
+ },
234
+ width: 200
235
+ }
236
+ ];
237
+ config.fields = [
238
+ {
239
+ name: 'phone_number'
240
+ }
241
+ ];
242
+ config.validations = [
243
+ {
244
+ type: 'presence',
245
+ field: 'phone_number'
246
+ }
247
+ ];
248
+ this.callParent([config]);
236
249
  }
237
- ];
238
- this.callParent([config]);
239
- }
240
250
  });
241
251
 
242
252
  /**
@@ -244,194 +254,306 @@ Ext.define("Compass.ErpApp.Organizer.Applications.Crm.ContactMechanismGrid.Phone
244
254
  * This grid extends ContactMechanismGrid and provides a column configuration for
245
255
  * displaying and editing email addresses for a given party
246
256
  */
247
- Ext.define("Compass.ErpApp.Organizer.Applications.Crm.ContactMechanismGrid.EmailAddressGrid",{
248
- extend:"Compass.ErpApp.Organizer.Applications.Crm.ContactMechanismGrid",
249
- alias:'widget.emailaddressgrid',
250
- initComponent: function () {
251
- this.callParent(arguments);
252
- },
253
- constructor: function(config) {
254
- config.title = 'Email Addresses';
255
- config.contactMechanism = 'EmailAddress';
256
- config.columns = [
257
- {
258
- header: 'Email Address',
259
- dataIndex: 'email_address',
260
- editor: {
261
- xtype:'textfield'
262
- },
263
- width:200
264
- }
265
- ];
266
- config.fields = [
267
- {
268
- name:'email_address'
269
- }
270
- ];
271
- config.validations = [
272
- {
273
- type: 'presence',
274
- field: 'email_address'
275
- }
257
+ Ext.define("Compass.ErpApp.Organizer.Applications.Crm.ContactMechanismGrid.EmailAddressGrid", {
258
+ extend: "Compass.ErpApp.Organizer.Applications.Crm.ContactMechanismGrid",
259
+ alias: 'widget.emailaddressgrid',
260
+ initComponent: function () {
261
+ this.callParent(arguments);
262
+ },
263
+ constructor: function (config) {
264
+ config.title = 'Email Addresses';
265
+ config.contactMechanism = 'EmailAddress';
266
+ config.columns = [
267
+ {
268
+ header: 'Email Address',
269
+ dataIndex: 'email_address',
270
+ editor: {
271
+ xtype: 'textfield'
272
+ },
273
+ width: 200
274
+ }
275
+ ];
276
+ config.fields = [
277
+ {
278
+ name: 'email_address'
279
+ }
280
+ ];
281
+ config.validations = [
282
+ {
283
+ type: 'presence',
284
+ field: 'email_address'
285
+ }
286
+
287
+ ];
288
+ config.toolbarItems = [
289
+ {
290
+ xtype: 'button',
291
+ text: 'Send Email',
292
+ iconCls: 'icon-mail',
293
+ handler: function (btn) {
294
+ var required = '<span style="color:red;font-weight:bold" data-qtip="Required">*</span>',
295
+ grid = btn.findParentByType('emailaddressgrid'),
296
+ selection = grid.getView().getSelectionModel().getSelection()[0],
297
+ sendEmailWindow = null;
298
+
299
+ if (selection) {
300
+ if (!sendEmailWindow) {
301
+ var form = Ext.widget('form', {
302
+ layout: {
303
+ type: 'vbox',
304
+ align: 'stretch'
305
+ },
306
+ border: false,
307
+ bodyPadding: 10,
308
+ buttonAlign: 'center',
309
+ fieldDefaults: {
310
+ labelAlign: 'top',
311
+ labelWidth: 100,
312
+ labelStyle: 'font-weight:bold'
313
+ },
314
+ items: [
315
+ {
316
+ xtype: 'textfield',
317
+ fieldLabel: 'Send To',
318
+ width: 300,
319
+ name: 'send_to',
320
+ vtype: 'email',
321
+ value: selection.get('email_address'),
322
+ afterLabelTextTpl: required,
323
+ allowBlank: false
324
+ },
325
+ {
326
+ xtype: 'textfield',
327
+ fieldLabel: 'CC',
328
+ width: 300,
329
+ vtype: 'email',
330
+ name: 'cc_email'
331
+ },
332
+ {
333
+ xtype: 'textfield',
334
+ fieldLabel: 'Subject',
335
+ name: 'subject',
336
+ width: 300,
337
+ afterLabelTextTpl: required,
338
+ allowBlank: false
339
+ },
340
+ {
341
+ xtype: 'htmleditor',
342
+ name: 'message',
343
+ fieldLabel: 'Biography',
344
+ height: 200,
345
+ allowBlank: false
346
+ }
347
+ ],
348
+
349
+ buttons: [
350
+ {
351
+ text: 'Cancel',
352
+ handler: function () {
353
+ this.up('form').getForm().reset();
354
+ this.up('window').hide();
355
+ }
356
+ },
357
+ {
358
+ text: 'Send',
359
+ handler: function (btn) {
360
+ if (this.up('form').getForm().isValid()) {
361
+ this.up('form').getForm().submit({
362
+ waitMsg: 'sending email',
363
+ url: '/erp_app/organizer/crm/send_email',
364
+ success: function (form, result) {
365
+ btn.up('form').getForm().reset();
366
+ btn.up('window').hide();
367
+ Ext.Msg.alert('Email Sent!', 'Your emails has been sent.');
368
+ },
369
+ failure: function (form, result) {
370
+ Ext.Msg.alert('Error', 'Could not send email.');
371
+ }
372
+ });
276
373
 
277
- ];
278
374
 
279
- this.callParent([config]);
280
- }
375
+ }
376
+ }
377
+ }
378
+ ]
379
+ });
380
+
381
+ sendEmailWindow = Ext.widget('window', {
382
+ title: 'Send Email',
383
+ closeAction: 'hide',
384
+ layout: 'fit',
385
+ resizable: true,
386
+ modal: true,
387
+ items: form,
388
+ defaultFocus: 'firstName'
389
+ });
390
+ }
391
+ sendEmailWindow.show();
392
+ }
393
+ }
394
+ }
395
+ ];
396
+
397
+ this.callParent([config]);
398
+ }
281
399
  });
282
400
 
283
401
  /**
284
402
  * PostalAddrGrid
285
- * This extends the ContactMechanismGrid and setups up configuration for
403
+ * This extends the ContactMechanismGrid and setups up configuration for
286
404
  * displaying and editing postal addresses for a given party
287
405
  */
288
- Ext.define("Compass.ErpApp.Organizer.Applications.Crm.ContactMechanismGrid.PostalAddressGrid",{
289
- extend:"Compass.ErpApp.Organizer.Applications.Crm.ContactMechanismGrid",
290
- alias:'widget.postaladdressgrid',
291
- initComponent: function () {
292
- this.callParent(arguments);
293
- },
294
- constructor: function(config) {
295
- config.title = 'Postal Addresses';
296
- config.contactMechanism = 'PostalAddress';
297
- config.columns = [
298
- {
299
- header: 'Address Line 1',
300
- dataIndex: 'address_line_1',
301
- editor: {
302
- xtype:'textfield'
303
- },
304
- width:200
406
+ Ext.define("Compass.ErpApp.Organizer.Applications.Crm.ContactMechanismGrid.PostalAddressGrid", {
407
+ extend: "Compass.ErpApp.Organizer.Applications.Crm.ContactMechanismGrid",
408
+ alias: 'widget.postaladdressgrid',
409
+ initComponent: function () {
410
+ this.callParent(arguments);
305
411
  },
306
- {
307
- header: 'Address Line 2',
308
- dataIndex: 'address_line_2',
309
- editor: {
310
- xtype:'textfield'
311
- },
312
- width:200
313
- },
314
- {
315
- header: 'City',
316
- dataIndex: 'city',
317
- editor: {
318
- xtype:'textfield'
319
- },
320
- width:200
321
- },
322
- {
323
- header: 'State',
324
- dataIndex: 'state',
325
- editor: {
326
- xtype:'textfield'
327
- },
328
- width:200
329
- },
330
- {
331
- header: 'Zip',
332
- dataIndex: 'zip',
333
- editor: {
334
- xtype:'textfield'
335
- },
336
- width:200
337
- },
338
- {
339
- header: 'Country',
340
- dataIndex: 'country',
341
- editor: {
342
- xtype:'textfield'
343
- },
344
- width:200
345
- },
346
- {
347
- menuDisabled:true,
348
- resizable:false,
349
- xtype:'actioncolumn',
350
- header:'Map It',
351
- align:'center',
352
- width:60,
353
- items:[{
354
- icon:'/images/icons/map/map_16x16.png',
355
- tooltip:'Revert',
356
- handler :function(grid, rowIndex, colIndex){
357
- var rec = grid.getStore().getAt(rowIndex);
358
- var addressLines;
359
- if(Compass.ErpApp.Utility.isBlank(rec.get('address_line_2'))){
360
- addressLines = rec.get('address_line_1');
361
- }
362
- else{
363
- addressLines = rec.get('address_line_1') + ' ,' + rec.get('address_line_2');
364
- }
412
+ constructor: function (config) {
413
+ config.title = 'Postal Addresses';
414
+ config.contactMechanism = 'PostalAddress';
415
+ config.columns = [
416
+ {
417
+ header: 'Address Line 1',
418
+ dataIndex: 'address_line_1',
419
+ editor: {
420
+ xtype: 'textfield'
421
+ },
422
+ width: 200
423
+ },
424
+ {
425
+ header: 'Address Line 2',
426
+ dataIndex: 'address_line_2',
427
+ editor: {
428
+ xtype: 'textfield'
429
+ },
430
+ width: 200
431
+ },
432
+ {
433
+ header: 'City',
434
+ dataIndex: 'city',
435
+ editor: {
436
+ xtype: 'textfield'
437
+ },
438
+ width: 200
439
+ },
440
+ {
441
+ header: 'State',
442
+ dataIndex: 'state',
443
+ editor: {
444
+ xtype: 'textfield'
445
+ },
446
+ width: 200
447
+ },
448
+ {
449
+ header: 'Zip',
450
+ dataIndex: 'zip',
451
+ editor: {
452
+ xtype: 'textfield'
453
+ },
454
+ width: 200
455
+ },
456
+ {
457
+ header: 'Country',
458
+ dataIndex: 'country',
459
+ editor: {
460
+ xtype: 'textfield'
461
+ },
462
+ width: 200
463
+ },
464
+ {
465
+ menuDisabled: true,
466
+ resizable: false,
467
+ xtype: 'actioncolumn',
468
+ header: 'Map It',
469
+ align: 'center',
470
+ width: 60,
471
+ items: [
472
+ {
473
+ icon: '/images/icons/map/map_16x16.png',
474
+ tooltip: 'Revert',
475
+ handler: function (grid, rowIndex, colIndex) {
476
+ var rec = grid.getStore().getAt(rowIndex);
477
+ var addressLines;
478
+ if (Compass.ErpApp.Utility.isBlank(rec.get('address_line_2'))) {
479
+ addressLines = rec.get('address_line_1');
480
+ }
481
+ else {
482
+ addressLines = rec.get('address_line_1') + ' ,' + rec.get('address_line_2');
483
+ }
365
484
 
366
- var fullAddress = addressLines + ' ,' + rec.get('city') + ' ,' + rec.get('state') + ' ,' + rec.get('zip') + ' ,' + rec.get('country');
367
- var mapwin = Ext.create('Ext.Window', {
368
- layout: 'fit',
369
- title: addressLines,
370
- width:450,
371
- height:450,
372
- border: false,
373
- items: {
374
- xtype: 'googlemappanel',
375
- zoomLevel: 17,
376
- mapType:'hybrid',
377
- dropPins: [{
378
- address: fullAddress,
379
- center:true,
380
- title:addressLines
381
- }]
485
+ var fullAddress = addressLines + ' ,' + rec.get('city') + ' ,' + rec.get('state') + ' ,' + rec.get('zip') + ' ,' + rec.get('country');
486
+ var mapwin = Ext.create('Ext.Window', {
487
+ layout: 'fit',
488
+ title: addressLines,
489
+ width: 450,
490
+ height: 450,
491
+ border: false,
492
+ items: {
493
+ xtype: 'googlemappanel',
494
+ zoomLevel: 17,
495
+ mapType: 'hybrid',
496
+ dropPins: [
497
+ {
498
+ address: fullAddress,
499
+ center: true,
500
+ title: addressLines
501
+ }
502
+ ]
503
+ }
504
+ });
505
+ mapwin.show();
506
+ }
507
+ }
508
+ ]
382
509
  }
383
- });
384
- mapwin.show();
385
- }
386
- }]
387
- }
388
- ];
389
- config.fields = [
390
- {
391
- name: 'address_line_1'
392
- },
393
- {
394
- name: 'address_line_2'
395
- },
396
- {
397
- name: 'city'
398
- },
399
- {
400
- name: 'state'
401
- },
402
- {
403
- name: 'zip'
404
- },
405
- {
406
- name: 'country'
407
- }
408
- ];
409
- config.validations = [
410
- {
411
- type: 'presence',
412
- field: 'address_line_1'
413
- },
510
+ ];
511
+ config.fields = [
512
+ {
513
+ name: 'address_line_1'
514
+ },
515
+ {
516
+ name: 'address_line_2'
517
+ },
518
+ {
519
+ name: 'city'
520
+ },
521
+ {
522
+ name: 'state'
523
+ },
524
+ {
525
+ name: 'zip'
526
+ },
527
+ {
528
+ name: 'country'
529
+ }
530
+ ];
531
+ config.validations = [
532
+ {
533
+ type: 'presence',
534
+ field: 'address_line_1'
535
+ },
414
536
 
415
- {
416
- type: 'presence',
417
- field: 'city'
418
- },
537
+ {
538
+ type: 'presence',
539
+ field: 'city'
540
+ },
419
541
 
420
- {
421
- type: 'presence',
422
- field: 'state'
423
- },
542
+ {
543
+ type: 'presence',
544
+ field: 'state'
545
+ },
424
546
 
425
- {
426
- type: 'presence',
427
- field: 'zip'
428
- },
547
+ {
548
+ type: 'presence',
549
+ field: 'zip'
550
+ },
429
551
 
430
- {
431
- type: 'presence',
432
- field: 'country'
552
+ {
553
+ type: 'presence',
554
+ field: 'country'
555
+ }
556
+ ];
557
+ this.callParent([config]);
433
558
  }
434
- ];
435
- this.callParent([config]);
436
- }
437
559
  });