erp_app 3.1.5 → 3.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. data/app/controllers/erp_app/desktop/job_tracker/base_controller.rb +6 -1
  2. data/app/controllers/erp_app/mobile/user_management/base_controller.rb +0 -3
  3. data/app/models/application.rb +1 -1
  4. data/app/views/erp_app/desktop/base/index.erb +11 -6
  5. data/app/views/erp_app/mobile/base/index.erb +37 -32
  6. data/app/views/erp_app/mobile/login/index.erb +1 -2
  7. data/app/views/erp_app/organizer/base/index.erb +6 -0
  8. data/db/data_migrations/20120411180756_create_user_management_mobile_application.rb +5 -7
  9. data/db/data_migrations/20130411200351_add_job_tracker_mobile_app.rb +16 -0
  10. data/db/migrate/20120920145259_add_job_tracker.rb +11 -7
  11. data/db/migrate/20130410182333_update_mobile_application.rb +27 -0
  12. data/lib/erp_app/version.rb +1 -1
  13. data/lib/generators/compass_ae_mobile/compass_ae_mobile_generator.rb +5 -2
  14. data/lib/generators/mobile_application/mobile_application_generator.rb +0 -2
  15. data/lib/generators/mobile_application/templates/controllers/controller_template.erb +1 -1
  16. data/lib/generators/mobile_application/templates/migrate/migration_template.erb +2 -2
  17. data/lib/generators/mobile_application/templates/public/app.js.erb +23 -34
  18. data/public/images/erp_app/mobile/green_light.png +0 -0
  19. data/public/images/erp_app/mobile/red_light.png +0 -0
  20. data/public/images/erp_app/mobile/yellow_light.png +0 -0
  21. data/public/javascripts/erp_app/desktop/applications/job_tracker/jobs_grid.js +2 -2
  22. data/public/javascripts/erp_app/login/mobile.js +55 -48
  23. data/public/javascripts/erp_app/mobile/app.js +71 -43
  24. data/public/javascripts/erp_app/mobile/applications/job_tracker/app.js +177 -0
  25. data/public/javascripts/erp_app/mobile/applications/job_tracker/model/job.js +15 -0
  26. data/public/javascripts/erp_app/mobile/applications/job_tracker/store/jobs.js +16 -0
  27. data/public/javascripts/erp_app/mobile/applications/job_tracker/store/view/templates.js +22 -0
  28. data/public/javascripts/erp_app/mobile/applications/user_management/app.js +103 -159
  29. data/public/javascripts/erp_app/mobile/applications/user_management/app/view/templates.js +32 -22
  30. data/public/stylesheets/erp_app/mobile/applications/user_management/main.css +20 -4
  31. data/public/stylesheets/erp_app/mobile/mobile.css +35 -324
  32. data/public/stylesheets/erp_app/shared/compass-ext-all.css +5 -11
  33. data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb +15 -0
  34. data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +12 -0
  35. data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +19 -0
  36. data/spec/dummy/db/data_migrations/20110728201729_erp_app_setup.erp_app.rb +252 -0
  37. data/spec/dummy/db/data_migrations/20110728201733_update_preferences.erp_app.rb +53 -0
  38. data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +16 -0
  39. data/spec/dummy/db/data_migrations/20110816161238_create_desktop_app_audit_log_viewer.erp_app.rb +21 -0
  40. data/spec/dummy/db/data_migrations/20110817160743_add_file_manager_application.erp_app.rb +32 -0
  41. data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +12 -0
  42. data/spec/dummy/db/data_migrations/20111108183739_add_default_capabilities.erp_app.rb +23 -0
  43. data/spec/dummy/db/data_migrations/20111108183740_add_new_contact_widgets.erp_app.rb +42 -0
  44. data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +22 -0
  45. data/spec/dummy/db/data_migrations/20120229160222_add_userinfo_widget.erp_app.rb +29 -0
  46. data/spec/dummy/db/data_migrations/20120405193721_create_party_and_role_type_for_communication_events.erp_app.rb +11 -0
  47. data/spec/dummy/db/data_migrations/20120411180756_create_user_management_mobile_application.erp_app.rb +19 -0
  48. data/spec/dummy/db/data_migrations/20120418164215_create_configuration_management_desktop_application.erp_app.rb +23 -0
  49. data/spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb +20 -0
  50. data/spec/dummy/db/data_migrations/20121130201859_upgrade_remove_system_mgmt_app.erp_app.rb +16 -0
  51. data/spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb +24 -0
  52. data/spec/dummy/db/data_migrations/20121218175028_create_security_management_desktop_application.erp_app.rb +23 -0
  53. data/spec/dummy/db/data_migrations/20130422153811_upgrade_compass_ae_instances_data.erp_base_erp_svcs.rb +19 -0
  54. data/spec/dummy/db/data_migrations/20130422153812_add_guid_to_instances.erp_base_erp_svcs.rb +10 -0
  55. data/spec/dummy/db/data_migrations/20130422153813_create_job_tracker_desktop_application.erp_app.rb +23 -0
  56. data/spec/dummy/db/data_migrations/20130422153814_created_tracked_jobs.erp_app.rb +15 -0
  57. data/spec/dummy/db/data_migrations/20130422153815_add_job_tracker_mobile_app.erp_app.rb +17 -0
  58. data/spec/dummy/db/migrate/20130105135833_base_erp_services.erp_base_erp_svcs.rb +461 -0
  59. data/spec/dummy/db/migrate/20130105135834_base_tech_services.erp_tech_svcs.rb +271 -0
  60. data/spec/dummy/db/migrate/20130105135835_create_has_attribute_tables.erp_tech_svcs.rb +39 -0
  61. data/spec/dummy/db/migrate/20130105135836_create_groups.erp_tech_svcs.rb +19 -0
  62. data/spec/dummy/db/migrate/20130105135837_upgrade_security.erp_tech_svcs.rb +54 -0
  63. data/spec/dummy/db/migrate/20130105135838_upgrade_security2.erp_tech_svcs.rb +270 -0
  64. data/spec/dummy/db/migrate/20130105135839_base_app_framework.erp_app.rb +276 -0
  65. data/spec/dummy/db/migrate/20130422153805_add_txn_status.erp_base_erp_svcs.rb +37 -0
  66. data/spec/dummy/db/migrate/20130422153806_upgrade_compass_ae_instances.erp_base_erp_svcs.rb +34 -0
  67. data/spec/dummy/db/migrate/20130422153807_add_uuid_compass_ae_instance.erp_base_erp_svcs.rb +17 -0
  68. data/spec/dummy/db/migrate/20130422153808_add_long_lat_to_address.erp_base_erp_svcs.rb +16 -0
  69. data/spec/dummy/db/migrate/20130422153809_add_queue_to_delayed_jobs.erp_tech_svcs.rb +14 -0
  70. data/spec/dummy/db/migrate/20130422153810_add_job_tracker.erp_app.rb +20 -0
  71. data/spec/dummy/db/migrate/20130422153811_update_mobile_application.erp_app.rb +28 -0
  72. data/spec/dummy/db/schema.rb +883 -0
  73. data/spec/dummy/db/spec.sqlite3 +0 -0
  74. data/spec/dummy/log/adam.log +1 -0
  75. data/spec/dummy/log/spec.log +107402 -0
  76. metadata +98 -46
  77. data/app/views/erp_app/mobile/user_management/base/index.html.erb +0 -28
  78. data/lib/generators/mobile_application/templates/INSTALL +0 -25
  79. data/lib/generators/mobile_application/templates/views/index.html.erb +0 -28
  80. data/public/images/icons/add/Thumbs.db +0 -0
  81. data/public/images/icons/calendar/Thumbs.db +0 -0
  82. data/public/images/icons/copy/Thumbs.db +0 -0
  83. data/public/images/icons/cut/Thumbs.db +0 -0
  84. data/public/images/icons/delete/Thumbs.db +0 -0
  85. data/public/images/icons/edit/Thumbs.db +0 -0
  86. data/public/images/icons/folder/Thumbs.db +0 -0
  87. data/public/images/icons/gear/Thumbs.db +0 -0
  88. data/public/images/icons/globe/Thumbs.db +0 -0
  89. data/public/images/icons/grid/Thumbs.db +0 -0
  90. data/public/images/icons/help/Thumbs.db +0 -0
  91. data/public/images/icons/information/Thumbs.db +0 -0
  92. data/public/images/icons/key/Thumbs.db +0 -0
  93. data/public/images/icons/log_out/Thumbs.db +0 -0
  94. data/public/images/icons/mail/Thumbs.db +0 -0
  95. data/public/images/icons/new/Thumbs.db +0 -0
  96. data/public/images/icons/next/Thumbs.db +0 -0
  97. data/public/images/icons/open/Thumbs.db +0 -0
  98. data/public/images/icons/paste/Thumbs.db +0 -0
  99. data/public/images/icons/picture/Thumbs.db +0 -0
  100. data/public/images/icons/presentation/Thumbs.db +0 -0
  101. data/public/images/icons/preview/Thumbs.db +0 -0
  102. data/public/images/icons/previous/Thumbs.db +0 -0
  103. data/public/images/icons/print/Thumbs.db +0 -0
  104. data/public/images/icons/properties/Thumbs.db +0 -0
  105. data/public/images/icons/redo/Thumbs.db +0 -0
  106. data/public/images/icons/refresh/Thumbs.db +0 -0
  107. data/public/images/icons/remove/Thumbs.db +0 -0
  108. data/public/images/icons/rename/Thumbs.db +0 -0
  109. data/public/images/icons/save/Thumbs.db +0 -0
  110. data/public/images/icons/search/Thumbs.db +0 -0
  111. data/public/images/icons/send/Thumbs.db +0 -0
  112. data/public/images/icons/settings/Thumbs.db +0 -0
  113. data/public/images/icons/synchronize/Thumbs.db +0 -0
  114. data/public/images/icons/undo/Thumbs.db +0 -0
  115. data/public/images/icons/upload/Thumbs.db +0 -0
  116. data/public/images/icons/user/Thumbs.db +0 -0
  117. data/public/images/icons/zoom_in/Thumbs.db +0 -0
  118. data/public/images/icons/zoom_out/Thumbs.db +0 -0
  119. data/public/javascripts/erp_app/ckeditor/plugins/jwplayer/jwplayer/Thumbs.db +0 -0
@@ -1,46 +1,74 @@
1
1
  Ext.application({
2
- name: 'compass_ae_mobile',
3
- useLoadMask: true,
2
+ name: 'compass_ae_mobile',
3
+ useLoadMask: true,
4
4
 
5
- launch: function () {
6
- Ext.create("Ext.tab.Panel", {
7
- fullscreen: true,
8
- tabBarPosition: 'bottom',
9
- items: [
10
- {
11
- xtype:'toolbar',
12
- ui:'light',
13
- docked:'top',
14
- items:[
15
- {
16
- text:'Logout',
17
- ui:'back',
18
- handler:function(btn){
19
- window.location = '/session/sign_out?login_url=/erp_app/mobile/login';
20
- }
21
- }
22
- ]
23
- },
24
- {
25
- title: 'Home',
26
- iconCls: 'home',
27
- style:'background-image: url("/images/wallpaper/truenorth.png");background-position:center;'
28
- },
29
- {
30
- xtype: 'container',
31
- title: 'Applications',
32
- iconCls: 'star',
33
- layout:{
34
- type:'vbox',
35
- align:'strech'
36
- },
37
- defaults:{
38
- xtype:'button',
39
- margin:10
40
- },
41
- items:mobileApplications
42
- }
43
- ]
44
- });
45
- }
5
+ launch: function () {
6
+ var items = [
7
+ {
8
+ itemId: 'home',
9
+ xtype: 'tabpanel',
10
+ tabBarPosition: 'bottom',
11
+ items: [
12
+ {
13
+ itemId:'applications',
14
+ xtype: 'container',
15
+ cls: 'applications-background',
16
+ title: 'Applications',
17
+ iconCls: 'home',
18
+ layout: 'fit',
19
+ items: {
20
+ xtype: 'dataview',
21
+ itemSelector: 'div.thumb-wrap',
22
+ store: {
23
+ fields: ['iconCls', 'name', 'itemId'],
24
+ data: mobileApplicationsData
25
+ },
26
+ itemTpl: [
27
+ '<div id="applications">',
28
+ '<div class="thumb-wrap">',
29
+ '<div class="thumb {iconCls}">',
30
+ '</div>',
31
+ '<span class="title">{name}</span>',
32
+ '</div>',
33
+ '</div>'
34
+ ],
35
+ listeners:{
36
+ 'itemtap':function(me, index, targe, record, e, options){
37
+ var itemId = record.get('itemId'),
38
+ container = this.up('#mainContainer');
39
+ app = container.down(itemId);
40
+ container.setActiveItem(app);
41
+ }
42
+ }
43
+ }
44
+ },
45
+ {
46
+ xtype: 'button',
47
+ title: 'Logout',
48
+ iconCls: 'reply',
49
+ listeners:{
50
+ activate:function(){
51
+ var me = this;
52
+ Ext.Msg.confirm('Warning', 'Are you sure you want to logout?', function(btn){
53
+ if(btn == 'yes'){
54
+ window.location = '/session/sign_out?login_url=/erp_app/mobile/login';
55
+ }
56
+ else{
57
+ me.up('tabpanel').setActiveItem('#applications');
58
+ }
59
+ });
60
+ }
61
+ }
62
+ }
63
+ ]
64
+ }
65
+ ];
66
+
67
+ Ext.create("Ext.Container", {
68
+ itemId: 'mainContainer',
69
+ layout: 'card',
70
+ fullscreen: true,
71
+ items: items.concat(mobileApplications)
72
+ });
73
+ }
46
74
  });
@@ -0,0 +1,177 @@
1
+ Ext.define('Compass.ErpApp.Mobile.JobTracker.Application', {
2
+ extend: 'Ext.Carousel',
3
+ xtype: 'compass-erpapp-mobile-jobtracker-application',
4
+ selectedJob: null,
5
+ config: {
6
+ layout: 'card',
7
+ listeners: {
8
+ activate: function () {
9
+ this.setActiveItem(0);
10
+ }
11
+ }
12
+ },
13
+
14
+ scheduleJob: function () {
15
+ var me = this;
16
+ this.setMasked({xtype: 'loadmask', message: 'scheduling job...'});
17
+
18
+ Ext.Ajax.request({
19
+ url: '/erp_app/desktop/job_tracker/schedule',
20
+ method: 'POST',
21
+ params: {
22
+ id: this.selectedJob.get('id'),
23
+ authenticity_token:Compass.ErpApp.AuthentictyToken
24
+ },
25
+ success: function (response) {
26
+ me.setMasked(false);
27
+ var obj = Ext.decode(response.responseText);
28
+ if (obj.success) {
29
+ me.store.load();
30
+ me.setActiveItem(0);
31
+ }
32
+ else {
33
+ Ext.Msg.alert('Error', 'Error scheduling job.');
34
+ }
35
+ },
36
+ failure: function (response) {
37
+ me.setMasked(false);
38
+ Ext.Msg.alert('Error', 'Error scheduling job.');
39
+ }
40
+ });
41
+ },
42
+
43
+ unScheduleJob: function () {
44
+ var me = this;
45
+ this.setMasked({xtype: 'loadmask', message: 'Unscheduling job...'});
46
+
47
+ Ext.Ajax.request({
48
+ url: '/erp_app/desktop/job_tracker/unschedule',
49
+ method: 'POST',
50
+ params: {
51
+ id: this.selectedJob.get('id'),
52
+ authenticity_token:Compass.ErpApp.AuthentictyToken
53
+ },
54
+ success: function (response) {
55
+ me.setMasked(false);
56
+ var obj = Ext.decode(response.responseText);
57
+ if (obj.success) {
58
+ me.store.load();
59
+ me.setActiveItem(0);
60
+ }
61
+ else {
62
+ Ext.Msg.alert('Error', 'Error unscheduling job.');
63
+ }
64
+ },
65
+ failure: function (response) {
66
+ me.setMasked(false);
67
+ Ext.Msg.alert('Error', 'Error unscheduling job.');
68
+ }
69
+ });
70
+ },
71
+
72
+ constructor: function (config) {
73
+ this.store = Ext.create('Compass.ErpApp.Mobile.JobTracker.Store.Jobs', {
74
+ storeId: 'jobtracker-jobstore'
75
+ });
76
+ this.store.load();
77
+
78
+ config['items'] = [
79
+ {
80
+
81
+ xtype: 'toolbar',
82
+ ui: 'light',
83
+ iconMask:true,
84
+ docked: 'top',
85
+ items: [
86
+ {
87
+ text: 'Home',
88
+ ui: 'back',
89
+ handler: function (btn) {
90
+ btn.up('#mainContainer').setActiveItem('#home');
91
+ }
92
+ },
93
+ {
94
+ iconCls: 'refresh',
95
+ iconMask: true,
96
+ handler: function (btn) {
97
+ btn.up('compass-erpapp-mobile-jobtracker-application').store.load();
98
+ }
99
+ }
100
+ ]
101
+ },
102
+ {
103
+
104
+ xtype: 'list',
105
+ store: 'jobtracker-jobstore',
106
+ onItemDisclosure: true,
107
+ itemTpl: [
108
+ '<tpl if="!scheduled">',
109
+ '<div style="float:right"><img src="/images/erp_app/mobile/yellow_light.png" /></div>',
110
+ '<tpl elseif="next_run_at &gt; new Date()">',
111
+ '<div style="float:right"><img src="/images/erp_app/mobile/green_light.png" /></div>',
112
+ '<tpl else>',
113
+ '<div style="float:right"><img src="/images/erp_app/mobile/red_light.png" /></div>',
114
+ '</tpl>',
115
+ '<div class="contact"><strong>{job_name}</strong></div>',
116
+ '<tpl if="Ext.isEmpty(last_run_at)">',
117
+ '<div>Last run: N/A</div>',
118
+ '<tpl else>',
119
+ '<div>Last run: {last_run_at:date("m/d/Y g:i:s")}</div>',
120
+ '</tpl>',
121
+ '<tpl if="Ext.isEmpty(next_run_at)">',
122
+ '<div>Next run: N/A</div>',
123
+ '<tpl else>',
124
+ '<div>Next run: {next_run_at:date("m/d/Y g:i:s")}</div>',
125
+ '</tpl>'],
126
+ listeners: {
127
+ disclose: function (me, record, target, e, eOpts) {
128
+ var app = me.up('compass-erpapp-mobile-jobtracker-application'),
129
+ details = app.down('#details');
130
+ details.setHtml(Compass.ErpApp.Mobile.JobTracker.Templates.jobDetails.apply(record.getData()));
131
+ app.setActiveItem(details);
132
+ app.selectedJob = record;
133
+ }
134
+ }
135
+ },
136
+ {
137
+ itemId: 'details',
138
+ items: [
139
+ {
140
+ xtype: 'toolbar',
141
+ docked: 'top',
142
+ items: [
143
+ {
144
+ text: 'Schedule',
145
+ handler: function (btn) {
146
+ var app = btn.up('compass-erpapp-mobile-jobtracker-application');
147
+ if(Ext.isEmpty(app.selectedJob)){
148
+ Ext.Msg.alert('Error', 'No job selected');
149
+ }
150
+ else{
151
+ app.scheduleJob();
152
+ }
153
+ }
154
+ },
155
+ {
156
+ text: 'UnSchedule',
157
+ handler: function (btn) {
158
+ var app = btn.up('compass-erpapp-mobile-jobtracker-application');
159
+ if(Ext.isEmpty(app.selectedJob)){
160
+ Ext.Msg.alert('Error', 'No job selected');
161
+ }
162
+ else{
163
+ app.unScheduleJob();
164
+ }
165
+ }
166
+ }
167
+ ]
168
+ }
169
+ ],
170
+ layout: 'fit',
171
+ autoScroll: true
172
+ }
173
+ ];
174
+
175
+ this.callParent([config]);
176
+ }
177
+ });
@@ -0,0 +1,15 @@
1
+ Ext.define('Compass.ErpApp.Mobile.JobTracker.Job',{
2
+ extend:'Ext.data.Model',
3
+ config:{
4
+ fields:[
5
+ {name: 'id', type:'integer'},
6
+ {name: 'job_name', type:'string'},
7
+ {name: 'job_klass', type:'string'},
8
+ {name: 'run_time', type:'string'},
9
+ {name: 'last_run_at', type:'date', dateFormat:'m-d-Y g:i:s'},
10
+ {name: 'next_run_at', type:'date', dateFormat:'m-d-Y g:i:s'},
11
+ {name: 'scheduled', type:'boolean'}
12
+ ]
13
+ }
14
+ });
15
+
@@ -0,0 +1,16 @@
1
+ Ext.define('Compass.ErpApp.Mobile.JobTracker.Store.Jobs', {
2
+ extend: 'Ext.data.Store',
3
+ config: {
4
+ model: 'Compass.ErpApp.Mobile.JobTracker.Job',
5
+ proxy:{
6
+ autoLoad: true,
7
+ url:'/erp_app/desktop/job_tracker/jobs',
8
+ type:'ajax',
9
+ reader:{
10
+ type:'json',
11
+ rootProperty:'jobs'
12
+ }
13
+ }
14
+ }
15
+ });
16
+
@@ -0,0 +1,22 @@
1
+ Compass.ErpApp.Mobile.JobTracker.Templates = {};
2
+ Compass.ErpApp.Mobile.JobTracker.Templates.jobDetails = new Ext.XTemplate(
3
+ '<div class="profile">',
4
+ '<p>',
5
+ '<span class="label">Job Name</span>',
6
+ '<span class="value">{job_name}</span>',
7
+ '</p>',
8
+ '<p>',
9
+ '<span class="label">Last Run At</span>',
10
+ '<span class="value">{last_run_at:date("m/d/Y g:i:s")}</span>',
11
+ '</p>',
12
+ '<p>',
13
+ '<span class="label">Next Run At</span>',
14
+ '<span class="value">{next_run_at:date("m/d/Y g:i:s")}</span>',
15
+ '</p>',
16
+ '<p>',
17
+ '<span class="label">Runtime</span>',
18
+ '<span class="value">{run_time}</span>',
19
+ '</p>',
20
+ '</div>',
21
+ '<br/>',
22
+ '<div id="resetPasswdBtnHolder"></div>');
@@ -1,168 +1,112 @@
1
- Ext.ns('Compass.ErpApp.Mobile.UserManagement');
1
+ Ext.define('Compass.ErpApp.Mobile.UserManagement.Application', {
2
+ extend: 'Ext.Carousel',
3
+ xtype: 'compass-erpapp-mobile-usermanagement-application',
4
+ selectedUser: null,
5
+ config: {
6
+ listeners: {
7
+ activate: function () {
8
+ this.setActiveItem(0);
9
+ }
10
+ }
11
+ },
2
12
 
3
- Ext.application({
4
- name: 'UserManagement',
5
- useLoadMask: true,
6
- launch: function () {
7
- Ext.create('Compass.ErpApp.Mobile.UserManagement.Store.Users',{
8
- storeId:'usermanagement-usersstore'
9
- }).load();
10
-
11
- var center = null;
12
- if(Ext.os.deviceType == 'Phone'){
13
- center = {
14
- layout:'card',
15
- itemId:'userList',
16
- title: 'Find User',
17
- iconCls: 'search',
18
- items:[
19
- {
20
- xtype: 'list',
21
- store: 'usermanagement-usersstore',
22
- itemTpl: '<div class="contact"><strong>{username}</strong></div>',
23
- grouped: true,
24
- indexBar: true,
25
- listeners:{
26
- itemdoubletap:function(view, index, target, record, e, eOpts){
27
- e.stopEvent();
28
- var userList = view.up('#userList');
29
- userList.add({
30
- layout:'fit',
31
- tpl:Compass.ErpApp.Mobile.UserManagement.Templates.userDetails,
32
- data:record.getData(),
33
- items:[{
34
- xtype:'toolbar',
35
- ui:'light',
36
- docked:'top',
37
- items:[
38
- {
39
- text:'Back',
40
- ui:'back',
41
- handler:function(btn){
42
- userList.setActiveItem(userList.items.first());
43
- userList.removeAt(1);
44
- }
45
- }
46
- ]
47
- }]
48
- });
49
- userList.setActiveItem(userList.items.last());
13
+ resetPassword: function () {
14
+ var me = this;
15
+ this.setMasked({xtype: 'loadmask', message: 'Resetting password...'});
50
16
 
51
- Ext.create('Ext.Button',{
52
- renderTo:'resetPasswdBtnHolder',
53
- text:'Reset Password',
54
- flex:0.5,
55
- login:record.get('username'),
56
- handler:function(btn){
57
- Ext.Ajax.request({
58
- url:'/users/reset_password',
59
- params:{
60
- login:btn.initialConfig.login,
61
- login_to:'/erp_app/mobile/login'
62
- },
63
- success:function(response, opts){
64
- var obj = Ext.decode(response.responseText);
65
- if(obj.success){
66
- Ext.Msg.alert("Success", "Password reset and email sent.");
67
- }
68
- },
69
- failure:function(response, opts){
70
- Ext.Msg.alert("Error", "Error re-setting password.");
71
- }
72
- });
17
+ Ext.Ajax.request({
18
+ url: '/users/reset_password',
19
+ params: {
20
+ login: this.selectedUser.get('email'),
21
+ login_to: '/erp_app/mobile/login',
22
+ authenticity_token:Compass.ErpApp.AuthentictyToken
23
+ },
24
+ success: function (response, opts) {
25
+ me.setMasked(false);
26
+ var obj = Ext.decode(response.responseText);
27
+ if (obj.success) {
28
+ Ext.Msg.alert("Success", "Password reset and email sent.");
29
+ }
30
+ else {
31
+ Ext.Msg.alert("Error", "Error re-setting password.");
73
32
  }
74
- });
33
+ },
34
+ failure: function (response, opts) {
35
+ me.setMasked(false);
36
+ Ext.Msg.alert("Error", "Error re-setting password.");
75
37
  }
76
- }
77
- }
78
- ]
79
- };
80
- }
81
- else{
82
- center = {
83
- layout:{
84
- type:'hbox'
85
- },
86
- itemId:'userList',
87
- title: 'Find User',
88
- iconCls: 'search',
89
- items:[
90
- {
91
- xtype: 'list',
92
- width: 300,
93
- height: 500,
94
- store: 'usermanagement-usersstore',
95
- itemTpl: '<div class="contact"><strong>{username}</strong></div>',
96
- grouped: true,
97
- indexBar: true,
98
- listeners:{
99
- itemdoubletap:function(view, index, target, record, e, eOpts){
100
- e.stopEvent();
101
- var userList = view.up('#userList');
102
- userList.query('#userDetails').first().setHtml(Compass.ErpApp.Mobile.UserManagement.Templates.userDetails.apply(record.getData()));
103
- Ext.create('Ext.Button',{
104
- renderTo:'resetPasswdBtnHolder',
105
- text:'Reset Password',
106
- flex:0.5,
107
- login:record.get('username'),
108
- handler:function(btn){
109
- Ext.Ajax.request({
110
- url:'/users/reset_password',
111
- params:{
112
- login:btn.initialConfig.login,
113
- login_to:'/erp_app/mobile/login'
114
- },
115
- success:function(response, opts){
116
- var obj = Ext.decode(response.responseText);
117
- if(obj.success){
118
- Ext.Msg.alert("Success", "Password reset and email sent.");
119
- }
120
- },
121
- failure:function(response, opts){
122
- Ext.Msg.alert("Error", "Error re-setting password.");
38
+ });
39
+ },
40
+
41
+ constructor: function (config) {
42
+ Ext.create('Compass.ErpApp.Mobile.UserManagement.Store.Users', {
43
+ storeId: 'usermanagement-usersstore'
44
+ }).load();
45
+
46
+ config['items'] = [
47
+ {
48
+
49
+ xtype: 'toolbar',
50
+ ui: 'light',
51
+ docked: 'top',
52
+ items: [
53
+ {
54
+ text: 'Home',
55
+ ui: 'back',
56
+ handler: function (btn) {
57
+ btn.up('#mainContainer').setActiveItem('#home');
58
+ }
59
+ }
60
+ ]
61
+ },
62
+ {
63
+
64
+ xtype: 'list',
65
+ store: 'usermanagement-usersstore',
66
+ itemTpl: '<div class="contact"><strong>{username}</strong></div>',
67
+ grouped: true,
68
+ indexBar: true,
69
+ listeners: {
70
+ itemdoubletap: function (view, index, target, record, e, eOpts) {
71
+ e.stopEvent();
72
+ var carousel = view.up('carousel'),
73
+ details = carousel.down('#details');
74
+ details.setHtml(Compass.ErpApp.Mobile.UserManagement.Templates.userDetails.apply(record.getData()));
75
+ carousel.setActiveItem(details);
76
+ carousel.selectedUser = record;
123
77
  }
124
- });
125
78
  }
126
- });
79
+ },
80
+ {
81
+ itemId: 'details',
82
+ items: [
83
+ {
84
+ xtype: 'toolbar',
85
+ docked: 'top',
86
+ items: [
87
+ {
88
+ text: 'Reset Password',
89
+ handler: function (btn) {
90
+ var carousel = btn.up('carousel');
91
+
92
+ if (Ext.isEmpty(carousel.selectedUser)) {
93
+ Ext.Msg.alert('Error', 'No user selected');
94
+ }
95
+ else {
96
+ carousel.resetPassword();
97
+ }
98
+ }
99
+ }
100
+ ]
101
+ }
102
+ ],
103
+ layout: 'fit',
104
+ autoScroll: true
127
105
  }
128
- }
129
- },
130
- {
131
- itemId:'userDetails',
132
- style:'padding:5px;'
133
- }
134
- ]
135
- };
136
- }
137
106
 
138
- Ext.create("Ext.tab.Panel", {
139
- activeItem:0,
140
- fullscreen: true,
141
- tabBarPosition: 'bottom',
142
- items: [
143
- {
144
- xtype:'toolbar',
145
- ui:'light',
146
- docked:'top',
147
- items:[
148
- {
149
- text:'Home',
150
- ui:'back',
151
- handler:function(btn){
152
- window.location = '/erp_app/mobile';
153
- }
154
- },
155
- {
156
- text:'Logout',
157
- ui:'round',
158
- handler:function(btn){
159
- window.location = '/session/sign_out?login_url=/erp_app/mobile/login';
160
- }
161
- }
162
- ]
163
- },
164
- center
165
- ]
166
- });
167
- }
107
+
108
+ ];
109
+
110
+ this.callParent([config]);
111
+ }
168
112
  });