erp_forms 2.0.2 → 2.0.3

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 (26) hide show
  1. data/README.rdoc +8 -3
  2. data/app/controllers/erp_forms/erp_app/desktop/dynamic_forms/comments_controller.rb +16 -0
  3. data/app/controllers/erp_forms/erp_app/desktop/dynamic_forms/data_controller.rb +45 -8
  4. data/app/controllers/erp_forms/erp_app/desktop/dynamic_forms/forms_controller.rb +14 -5
  5. data/app/controllers/erp_forms/erp_app/desktop/dynamic_forms/models_controller.rb +2 -2
  6. data/app/models/dynamic_datum.rb +31 -21
  7. data/app/models/dynamic_form.rb +42 -35
  8. data/app/models/ticket.rb +16 -0
  9. data/config/routes.rb +1 -0
  10. data/db/data_migrations/20110608185830_create_default_dynamic_models_and_forms.rb +4 -4
  11. data/db/data_migrations/20120824013449_create_ticket_form.rb +65 -0
  12. data/db/data_migrations/{20110830170240_update_contact_form.rb → 20120904191738_update_contact_form.rb} +5 -6
  13. data/db/migrate/20120824012520_create_tickets.rb +18 -0
  14. data/lib/erp_forms/dynamic_form_field.rb +93 -20
  15. data/lib/erp_forms/dynamic_grid_column.rb +7 -5
  16. data/lib/erp_forms/engine.rb +1 -0
  17. data/lib/erp_forms/extensions/active_record/has_dynamic_forms.rb +5 -5
  18. data/lib/erp_forms/extensions/railties/action_view.rb +6 -3
  19. data/lib/erp_forms/version.rb +1 -1
  20. data/public/javascripts/erp_app/desktop/applications/dynamic_forms/dynamic_data_grid.js +165 -13
  21. data/public/javascripts/erp_app/desktop/applications/dynamic_forms/module.js +1 -2
  22. data/public/javascripts/erp_app/desktop/applications/dynamic_forms/west_region.js +26 -13
  23. data/public/javascripts/erp_app/shared/dynamic_forms/dynamic_form_fields.js +37 -0
  24. data/public/stylesheets/erp_app/desktop/applications/dynamic_forms/comments.css +15 -0
  25. metadata +16 -11
  26. data/db/data_migrations/20110822170240_update_contact_form_validation.rb +0 -22
@@ -5,22 +5,23 @@ class DynamicFormField
5
5
 
6
6
  Field Types TODO
7
7
  special:
8
- password
9
- file upload
10
-
8
+ codemirror
9
+ file upload - use has_file_assets and plupload
10
+ test password field
11
+
11
12
  complex (for future implementation):
12
13
  concatenated
13
14
  calculated
14
- related
15
+ related with search ahead for relations with huge datasets
15
16
  =end
16
17
 
17
18
  # options = {
18
19
  # :fieldLabel => Field label text string
19
20
  # :name => Field variable name string
20
- # :allowblank => required true or false
21
+ # :allowBlank => required true or false
21
22
  # :value => prepopulated default value string
22
- # :readonly => disabled true or false
23
- # :maxlength => maxLength integer
23
+ # :readOnly => disabled true or false
24
+ # :maxLength => maxLength integer
24
25
  # :width => size integer
25
26
  # :validation_regex => regex string
26
27
  # }
@@ -37,6 +38,11 @@ class DynamicFormField
37
38
  DynamicFormField.basic_field('numberfield', options)
38
39
  end
39
40
 
41
+ def self.password(options={})
42
+ options[:inputType] = 'password'
43
+ DynamicFormField.basic_field('textfield', options)
44
+ end
45
+
40
46
  def self.datefield(options={})
41
47
  DynamicFormField.basic_field('datefield', options)
42
48
  end
@@ -47,21 +53,81 @@ class DynamicFormField
47
53
 
48
54
  def self.yesno(selections=[], options={})
49
55
  selections = [['yes', 'Yes'],['no', 'No']]
50
- DynamicFormField.basic_field('combo', options, selections)
56
+ DynamicFormField.basic_field('combobox', options, selections)
57
+ end
58
+
59
+ # a combobox that dynamically pulls options from a related model
60
+ def self.related_combobox(model='', displayField = '', options={})
61
+ options[:forceSelection] = true if options[:forceSelection].nil?
62
+ options[:displayField] = displayField
63
+
64
+ options[:extraParams] = {
65
+ :model => model,
66
+ :displayField => displayField
67
+ }
68
+
69
+ options[:fields] = [
70
+ { :name => 'id' },
71
+ { :name => displayField }
72
+ ]
73
+
74
+ options[:url] = '/erp_forms/erp_app/desktop/dynamic_forms/forms/related_field' if options[:url].blank?
75
+
76
+ DynamicFormField.basic_field('related_combobox', options)
77
+ end
78
+
79
+ def self.ckeditor(options={})
80
+ options[:height] = 300 if options[:height].nil?
81
+ options[:width] = 850 if options[:width].nil?
82
+
83
+ if options[:ckEditorConfig].nil?
84
+ options[:ckEditorConfig] = {
85
+ # :width => options[:width],
86
+ # :height => options[:height],
87
+ :extraPlugins => 'compasssave,jwplayer',
88
+ :toolbar => [
89
+ ['Source','-','CompassSave','Preview','Print'],
90
+ ['Cut','Copy','Paste','PasteText','PasteFromWord'],
91
+ ['Undo','Redo'],
92
+ ['Find','Replace'],
93
+ ['SpellChecker','-','SelectAll'],
94
+ ['TextColor','BGColor'],
95
+ ['Bold','Italic','Underline','Strike'],
96
+ ['Subscript','Superscript','-','jwplayer'],
97
+ ['Table','NumberedList','BulletedList'],
98
+ ['Outdent','Indent','Blockquote'],
99
+ ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
100
+ ['BidiLtr','BidiRtl'],
101
+ ['Link','Unlink','Anchor'],
102
+ ['HorizontalRule','SpecialChar','PageBreak'],
103
+ ['ShowBlocks','RemoveFormat'],
104
+ ['Styles','Format','Font','FontSize' ],
105
+ ['Maximize','-','About']
106
+ ]
107
+ }
108
+ end
109
+
110
+ DynamicFormField.basic_field('ckeditor', options)
51
111
  end
52
112
 
53
113
  ################
54
114
  # BASIC FIELDS #
55
- ################
115
+ ################
116
+ # ComboBox with a static store, if you need a dynamic store use DynamicFormField.related_combobox
56
117
  # selections is an array of tuples, i.e. [['AL', 'Alabama'],['AK', 'Alaska']] - [value, text]
57
118
  def self.combobox(selections=[], options={})
58
- DynamicFormField.basic_field('combo', options, selections)
119
+ options[:forceSelection] = true if options[:forceSelection].nil?
120
+ DynamicFormField.basic_field('combobox', options, selections)
59
121
  end
60
122
 
61
123
  def self.textfield(options={})
62
124
  DynamicFormField.basic_field('textfield', options)
63
125
  end
64
126
 
127
+ def self.displayfield(options={})
128
+ DynamicFormField.basic_field('displayfield', options)
129
+ end
130
+
65
131
  def self.textarea(options={})
66
132
  options[:height] = 100 if options[:height].nil?
67
133
  DynamicFormField.basic_field('textarea', options)
@@ -83,21 +149,27 @@ class DynamicFormField
83
149
  :fieldLabel => options[:fieldLabel],
84
150
  :name => options[:name],
85
151
  :value => options[:value],
86
- :allowBlank => options[:allowblank],
87
- :readOnly => options[:readonly],
152
+ :allowBlank => options[:allowBlank],
153
+ :readOnly => options[:readOnly],
88
154
  :width =>options[:width],
89
155
  :height => options[:height],
90
- :labelWidth => options[:labelwidth]
156
+ :labelWidth => options[:labelWidth],
157
+ :display_in_grid => options[:display_in_grid]
91
158
  }
159
+
160
+ field[:displayField] = options[:displayField] unless options[:displayField].blank?
161
+ field[:extraParams] = options[:extraParams] unless options[:extraParams].blank?
162
+ field[:url] = options[:url] unless options[:url].blank?
163
+ field[:fields] = options[:fields] unless options[:fields].blank?
92
164
 
93
165
  field[:mapping] = options[:mapping] unless options[:mapping].blank?
94
- field[:maxLength] = options[:maxlength] unless options[:maxlength].nil?
166
+ field[:maxLength] = options[:maxLength] unless options[:maxLength].nil?
95
167
 
96
168
  if selections and selections != []
97
- field[:store] = selections.to_json
169
+ field[:store] = selections
98
170
  end
99
171
 
100
- if options[:validation_regex] or options[:validator_function]
172
+ if !options[:validation_regex].blank? or !options[:validator_function].blank?
101
173
  field[:validateOnBlur] = true
102
174
  end
103
175
 
@@ -116,14 +188,15 @@ class DynamicFormField
116
188
 
117
189
  options[:fieldLabel] = '' if options[:fieldLabel].nil?
118
190
  options[:name] = '' if options[:name].nil?
119
- options[:allowblank] = true if options[:allowblank].nil?
191
+ options[:allowBlank] = true if options[:allowBlank].nil?
120
192
  options[:value] = '' if options[:value].nil?
121
- options[:readonly] = false if options[:readonly].nil?
122
- options[:maxlength] = nil if options[:maxlength].nil?
193
+ options[:readOnly] = false if options[:readOnly].nil?
194
+ options[:maxLength] = nil if options[:maxLength].nil?
123
195
  options[:width] = 200 if options[:width].nil?
124
196
  options[:height] = nil if options[:height].nil?
125
197
  options[:validation_regex] = '' if options[:validation_regex].nil?
126
- options[:labelwidth] = 75 if options[:labelwidth].nil?
198
+ options[:labelWidth] = 75 if options[:labelWidth].nil?
199
+ options[:display_in_grid] = true if options[:display_in_grid].nil?
127
200
 
128
201
  options
129
202
  end
@@ -4,7 +4,7 @@ class DynamicGridColumn
4
4
  field_hash.symbolize_keys!
5
5
  header = field_hash[:fieldLabel]
6
6
  type = DynamicGridColumn.convert_xtype_to_column_type(field_hash[:xtype])
7
- data_index = field_hash[:name]
7
+ data_index = (field_hash[:dataIndex] ? field_hash[:dataIndex] : field_hash[:name])
8
8
 
9
9
  if type == 'date'
10
10
  renderer = "Ext.util.Format.dateRenderer('m/d/Y')"
@@ -17,15 +17,17 @@ class DynamicGridColumn
17
17
  \"type\":\"#{type}\",
18
18
  \"dataIndex\":\"#{data_index}\""
19
19
 
20
- if options[:width]
21
- col << ",\"width\":#{options[:width]}"
22
- end
20
+
21
+ col << ",\"width\":#{field_hash[:width]}" if field_hash[:width]
22
+
23
+ sortable = field_hash[:sortable].nil? ? true : field_hash[:sortable]
24
+ col << ",\"sortable\":#{sortable}"
23
25
 
24
26
  col += ",
25
27
  \"renderer\": #{renderer}" if renderer != ''
26
28
 
27
29
  if options[:editor]
28
- readonly = field_hash[:readonly].blank? ? false : field_hash[:readonly]
30
+ readonly = field_hash[:readOnly].blank? ? false : field_hash[:readOnly]
29
31
  col += ",
30
32
  {
31
33
  \"xtype\": \"#{field_hash[:xtype]}\",
@@ -16,6 +16,7 @@ module ErpForms
16
16
  engine = self
17
17
  config.to_prepare do
18
18
  ErpBaseErpSvcs.register_compass_ae_engine(engine)
19
+ ::ErpApp::Widgets::Loader.load_compass_ae_widgets(engine)
19
20
 
20
21
  #dynamic_attributes patch
21
22
  require "erp_forms/dynamic_attributes_patch"
@@ -14,10 +14,10 @@ module ErpForms
14
14
 
15
15
  include HasDynamicForms::InstanceMethods
16
16
 
17
- def set_default(form_id)
18
- DynamicForm.update_all({ :default => false }, conditions={ :model_name => self.class_name.to_s })
19
- DynamicForm.update_all({ :default => true }, conditions={ :id => form_id })
20
- end
17
+ def set_default(form_id)
18
+ DynamicForm.update_all({ :default => false }, conditions={ :model_name => self.class_name.to_s })
19
+ DynamicForm.update_all({ :default => true }, conditions={ :id => form_id })
20
+ end
21
21
  end
22
22
 
23
23
  end
@@ -55,7 +55,7 @@ module ErpForms
55
55
 
56
56
  # get all forms by type
57
57
  def forms
58
- DynamicForm.find_all_by_model_name(self.class_name)
58
+ DynamicForm.find_all_by_model_name(self.class_name)
59
59
  end
60
60
 
61
61
  def set_default(internal_identifier)
@@ -7,14 +7,17 @@ ActionView::Base.class_eval do
7
7
  # :width => 'width of form in pixels'
8
8
  # }
9
9
  def render_dynamic_form(name, options={})
10
-
11
- form = DynamicForm.get_form(name.to_s, options[:internal_identifier]).to_extjs_widget(
10
+ output = raw '&nbsp<script type="text/javascript">'
11
+ output += raw "Compass.ErpApp.Utility.JsLoader.load(['/javascripts/erp_app/shared/dynamic_forms/dynamic_form_fields.js'], function(){"
12
+
13
+ output += raw DynamicForm.get_form(name.to_s, options[:internal_identifier]).to_extjs_widget(
12
14
  { :url => build_widget_url(:new),
13
15
  :widget_result_id => widget_result_id,
14
16
  :width => options[:width]
15
17
  })
16
18
 
17
- form
19
+ output += raw '});</script>'
20
+ output
18
21
  end
19
22
 
20
23
  end
@@ -2,7 +2,7 @@ module ErpForms
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 2
4
4
  MINOR = 0
5
- TINY = 2
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
8
8
  end
@@ -1,6 +1,148 @@
1
1
  Ext.define("Compass.ErpApp.Desktop.Applications.DynamicForms.DynamicDataGridPanel",{
2
2
  extend:"Compass.ErpApp.Shared.DynamicEditableGridLoaderPanel",
3
3
  alias:'widget.dynamic_forms_DynamicDataGridPanel',
4
+
5
+ addCommentWindow : function(record_id, model_name, comment_div_id){
6
+ var commentForm = {
7
+ url: '/erp_forms/erp_app/desktop/dynamic_forms/comments/add',
8
+ xtype: 'form',
9
+ items: [{
10
+ xtype: 'textarea',
11
+ name: 'comment',
12
+ width: 800,
13
+ height: 400
14
+ }],
15
+ buttons:[{
16
+ text:'Submit',
17
+ listeners:{
18
+ 'click':function(button){
19
+ var formPanel = button.findParentByType('form');
20
+ //self.setWindowStatus('Adding Comment ...');
21
+ formPanel.getForm().submit({
22
+ params:{
23
+ id:record_id,
24
+ model_name:model_name
25
+ },
26
+ reset:false,
27
+ success:function(form, action){
28
+ //self.clearWindowStatus();
29
+ var obj = Ext.decode(action.response.responseText);
30
+ if(obj.success){
31
+ var randomnumber=Math.floor(Math.random()*1024)
32
+ var target_div = 'new-comment-'+randomnumber;
33
+ string = '<div id="'+target_div+'" class="comment">';
34
+ string += '<i>by you, just now</i><br />';
35
+ string += formPanel.getForm().findField('comment').getValue();
36
+ string += '</div>';
37
+ document.getElementById(comment_div_id).innerHTML += string;
38
+ Ext.getCmp('commentWindow_'+model_name+record_id).close();
39
+ codemirrorHighlight(target_div);
40
+ }
41
+ else{
42
+ Ext.Msg.alert("Error", obj.msg);
43
+ }
44
+ },
45
+ failure:function(form, action){
46
+ //self.clearWindowStatus();
47
+ var obj = Ext.decode(action.response.responseText);
48
+ if(Compass.ErpApp.Utility.isBlank(obj.message)){
49
+ Ext.Msg.alert("Error", 'Error adding comment.');
50
+ }
51
+ else{
52
+ Ext.Msg.alert("Error", obj.message);
53
+ }
54
+ }
55
+ });
56
+ }
57
+ }
58
+ }]
59
+ }
60
+
61
+ var commentWindow = Ext.create('Ext.window.Window',{
62
+ id: 'commentWindow_'+model_name+record_id,
63
+ title: 'Add Comment',
64
+ items: [commentForm],
65
+ autoDestroy:true
66
+ });
67
+
68
+ commentWindow.show();
69
+
70
+ },
71
+
72
+ viewRecord : function(rec, gridpanel_id){
73
+ var self = this;
74
+ Ext.getCmp('westregionPanel').setWindowStatus('Getting data ...');
75
+ Ext.Ajax.request({
76
+ url: '/erp_forms/erp_app/desktop/dynamic_forms/data/get',
77
+ method: 'POST',
78
+ params:{
79
+ id:rec.get("id"),
80
+ model_name:rec.get("model_name")
81
+ },
82
+ success: function(response) {
83
+ Ext.getCmp('westregionPanel').clearWindowStatus();
84
+ var response_text = Ext.decode(response.responseText);
85
+ var center_region = self.findParentByType('dynamic_forms_centerregion');
86
+
87
+ var ticket_div_id = gridpanel_id+'_ticket';
88
+
89
+ string = '<div id="'+ticket_div_id+'" style="padding: 10px;">';
90
+ string += '<div class="metadata">';
91
+ string += 'Created by '+response_text.metadata.created_username+' at '+response_text.metadata.created_at+'<br/>';
92
+ string += 'Updated';
93
+ if (response_text.metadata.updated_username){
94
+ string += ' by '+response_text.metadata.updated_username;
95
+ }
96
+ if (response_text.metadata.updated_at){
97
+ string += ' at '+response_text.metadata.updated_at;
98
+ }
99
+ string += '</div>';
100
+ for(var index in response_text.data) {
101
+ string += '<b>'+ index + ':</b> ' + response_text.data[index] + '<br />';
102
+ }
103
+ string += '</div>';
104
+
105
+ var comment_div_id = gridpanel_id+'_comments';
106
+
107
+ if (response_text.comments){
108
+ string += '<div id="'+comment_div_id+'" class="comments"><h1>Comments ';
109
+ string += '<a onclick="javascript: Ext.getCmp(\''+gridpanel_id+'\').addCommentWindow('+rec.get("id")+',\''+rec.get("model_name")+'\',\''+comment_div_id+'\');" href="#">Add Comment</a></h1>';
110
+
111
+ Ext.each(response_text.comments, function(comment){
112
+ string += '<div class="comment">';
113
+ string += '<i>by '+comment.commentor_name+ ', '+comment.created_at+'</i><br />';
114
+ string += comment.comment;
115
+ string += '</div>';
116
+ });
117
+
118
+ string += '</div>';
119
+ }
120
+
121
+ var viewPanel = {
122
+ xtype: 'panel',
123
+ title: rec.get("model_name")+' '+rec.get("id"),
124
+ closable: true,
125
+ autoScroll: true,
126
+ record: rec,
127
+ html: string,
128
+ items: [],
129
+ listeners:{
130
+ 'afterrender':function(){
131
+ codemirrorHighlight(ticket_div_id);
132
+ codemirrorHighlight(comment_div_id);
133
+ }
134
+ }
135
+ }
136
+
137
+ center_region.workArea.add(viewPanel);
138
+ center_region.workArea.setActiveTab(center_region.workArea.items.length - 1);
139
+ },
140
+ failure: function(response) {
141
+ Ext.getCmp('westregionPanel').clearWindowStatus();
142
+ Ext.Msg.alert('Error', 'Error getting data');
143
+ }
144
+ });
145
+ },
4
146
 
5
147
  editRecord : function(rec, model_name){
6
148
  var self = this;
@@ -9,23 +151,28 @@ Ext.define("Compass.ErpApp.Desktop.Applications.DynamicForms.DynamicDataGridPane
9
151
  url: '/erp_forms/erp_app/desktop/dynamic_forms/forms/get',
10
152
  method: 'POST',
11
153
  params:{
12
- id:rec.get("id"),
154
+ id:rec.get("form_id"),
155
+ record_id:rec.get("id"),
13
156
  model_name:model_name,
14
157
  form_action: 'update'
15
158
  },
16
159
  success: function(response) {
17
160
  Ext.getCmp('westregionPanel').clearWindowStatus();
18
161
  form_definition = Ext.decode(response.responseText);
19
- var editRecordWindow = Ext.create("Ext.window.Window",{
20
- layout:'fit',
21
- title:'Update Record',
22
- y: 100, // this fixes chrome and safari rendering the window at the bottom of the screen
23
- plain: true,
24
- buttonAlign:'center',
25
- items: form_definition
26
- });
27
- Ext.getCmp('dynamic_form_panel').getForm().loadRecord(rec);
28
- editRecordWindow.show();
162
+ if (form_definition.success == false){
163
+ Ext.Msg.alert('Error', form_definition.error);
164
+ }else{
165
+ var editRecordWindow = Ext.create("Ext.window.Window",{
166
+ layout:'fit',
167
+ title:'Update Record',
168
+ y: 100, // this fixes chrome and safari rendering the window at the bottom of the screen
169
+ plain: true,
170
+ buttonAlign:'center',
171
+ items: form_definition
172
+ });
173
+ Ext.getCmp('dynamic_form_panel_'+model_name).getForm().loadRecord(rec);
174
+ editRecordWindow.show();
175
+ }
29
176
  },
30
177
  failure: function(response) {
31
178
  Ext.getCmp('westregionPanel').clearWindowStatus();
@@ -64,13 +211,18 @@ Ext.define("Compass.ErpApp.Desktop.Applications.DynamicForms.DynamicDataGridPane
64
211
 
65
212
  constructor : function(config) {
66
213
  config = Ext.apply({
67
- id:'DynamicFormDataGridPanel',
214
+ id:config.id,
68
215
  //title:'Dynamic Data',
69
216
  editable:false,
70
217
  page:true,
71
218
  pageSize: 20,
72
219
  displayMsg:'Displaying {0} - {1} of {2}',
73
- emptyMsg:'Empty'
220
+ emptyMsg:'Empty',
221
+ grid_listeners:{
222
+ 'itemdblclick':function(view, record){
223
+ Ext.getCmp(config.id).viewRecord(record, config.id);
224
+ }
225
+ }
74
226
  }, config);
75
227
 
76
228
  this.callParent([config]);
@@ -18,8 +18,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.DynamicForms",{
18
18
  win = desktop.createWindow({
19
19
  id: 'dynamic_forms',
20
20
  title:'Dynamic Forms',
21
- width:1150,
22
- height:550,
21
+ maximized:true,
23
22
  iconCls: 'icon-document',
24
23
  shim:false,
25
24
  animCollapse:false,
@@ -130,7 +130,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.DynamicForms.WestRegion",{
130
130
  sectionId,
131
131
  response.responseText,
132
132
  [{
133
- text: 'Insert Content Area',
133
+ text: 'Insert Content Area1',
134
134
  handler: function(btn){
135
135
  var codeMirror = btn.findParentByType('codemirror');
136
136
  Ext.MessageBox.prompt('New File', 'Please enter content area name:', function(btn, text){
@@ -152,12 +152,20 @@ Ext.define("Compass.ErpApp.Desktop.Applications.DynamicForms.WestRegion",{
152
152
 
153
153
  getDynamicData : function(record, title){
154
154
  var self = this;
155
+ dynamic_data = Ext.getCmp('centerRegionLayout_'+record.data.text);
156
+ if (dynamic_data){
157
+ this.centerRegion.workArea.setActiveTab(dynamic_data);
158
+ return;
159
+ }
160
+
155
161
  var centerRegionLayout = Ext.create("Ext.panel.Panel",{
162
+ id: 'centerRegionLayout_'+record.data.text,
156
163
  layout:'border',
157
164
  title: record.data.text + " Dynamic Data",
158
165
  closable:true,
159
166
  items:[
160
167
  {
168
+ id: record.data.text,
161
169
  xtype:'dynamic_forms_DynamicDataGridPanel',
162
170
  model_name:record.data.text,
163
171
  dataUrl: '/erp_forms/erp_app/desktop/dynamic_forms/data/index/'+record.data.text,
@@ -184,15 +192,19 @@ Ext.define("Compass.ErpApp.Desktop.Applications.DynamicForms.WestRegion",{
184
192
  success: function(response) {
185
193
  self.clearWindowStatus();
186
194
  form_definition = Ext.decode(response.responseText);
187
- var newRecordWindow = Ext.create("Ext.window.Window",{
188
- layout:'fit',
189
- title:'New Record',
190
- y: 100, // this fixes chrome and safari rendering the window at the bottom of the screen
191
- plain: true,
192
- buttonAlign:'center',
193
- items: form_definition
194
- });
195
- newRecordWindow.show();
195
+ if (form_definition.success == false){
196
+ Ext.Msg.alert('Error', form_definition.error);
197
+ }else{
198
+ var newRecordWindow = Ext.create("Ext.window.Window",{
199
+ layout:'fit',
200
+ title:'New Record',
201
+ y: 100, // this fixes chrome and safari rendering the window at the bottom of the screen
202
+ plain: true,
203
+ buttonAlign:'center',
204
+ items: form_definition
205
+ });
206
+ newRecordWindow.show();
207
+ }
196
208
  },
197
209
  failure: function(response) {
198
210
  self.clearWindowStatus();
@@ -290,7 +302,8 @@ Ext.define("Compass.ErpApp.Desktop.Applications.DynamicForms.WestRegion",{
290
302
  }
291
303
  }
292
304
  else if(record.data['isForm']){
293
- self.getDynamicForm(record);
305
+ //self.getDynamicForm(record);
306
+ Ext.Msg.alert('Info', 'Form Builder not yet implemented');
294
307
  }
295
308
  },
296
309
  'itemcontextmenu':function(view, record, htmlItem, index, e){
@@ -383,7 +396,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.DynamicForms.WestRegion",{
383
396
  var layout = new Ext.Panel({
384
397
  layout: 'border',
385
398
  autoDestroy:true,
386
- title:'Dynamic Forms',
399
+ title:'Dynamic Models & Forms',
387
400
  items: [this.sitesTree],
388
401
  tbar:{
389
402
  items:[
@@ -474,7 +487,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.DynamicForms.WestRegion",{
474
487
  id: 'westregionPanel',
475
488
  region:'west',
476
489
  split:true,
477
- width:200,
490
+ width:175,
478
491
  collapsible:false
479
492
  }, config);
480
493
 
@@ -0,0 +1,37 @@
1
+ Ext.define("Compass.ErpApp.Shared.DynamicRelatedComboBox",{
2
+ extend:"Ext.form.field.ComboBox",
3
+ alias:'widget.related_combobox',
4
+ initComponent: function() {
5
+ //var config = this.initialConfig;
6
+ this.callParent(arguments);
7
+ },
8
+
9
+ constructor : function(config) {
10
+
11
+ config = Ext.apply({
12
+ width: config['width'],
13
+ loadingText:'Retrieving Options...',
14
+ displayField: config['displayField'],
15
+ valueField:'id',
16
+ triggerAction: 'all',
17
+ allowBlank: config['allowBlank'],
18
+ store: Ext.create('Ext.data.Store', {
19
+ fields:config['fields'],
20
+ //remoteSort:config['remoteSort'],
21
+ proxy: {
22
+ type:'ajax',
23
+ reader:{
24
+ type:'json',
25
+ root:'data'
26
+ },
27
+ extraParams: config['extraParams'],
28
+ url: config['url']
29
+ },
30
+ //storeId: config['storeId'],
31
+ autoLoad: true
32
+ })
33
+ }, config);
34
+
35
+ this.callParent([config]);
36
+ }
37
+ });
@@ -0,0 +1,15 @@
1
+ .metadata{
2
+ margin-bottom: 5px;
3
+ }
4
+
5
+ .comments{
6
+ padding: 10px;
7
+
8
+ }
9
+
10
+ .comment{
11
+ border: 1px solid black;
12
+ padding: 5px;
13
+ margin-top: 5px;
14
+ }
15
+