erp_products 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/erp_products/erp_app/desktop/product_manager/base_controller.rb +1 -1
- data/app/models/product_type.rb +2 -2
- data/lib/erp_products/engine.rb +7 -1
- data/lib/erp_products/version.rb +7 -1
- data/lib/erp_products.rb +1 -0
- data/public/javascripts/erp_app/desktop/applications/product_manager/module.js +713 -718
- data/public/javascripts/erp_app/desktop/applications/product_manager/product_list_panel.js +127 -128
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config/application.rb +49 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +8 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/spec.rb +27 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/models/prod_availability_status_type_spec.rb +11 -0
- data/spec/models/prod_instance_reln_spec.rb +11 -0
- data/spec/models/prod_instance_reln_type_spec.rb +11 -0
- data/spec/models/prod_instance_role_type_spec.rb +11 -0
- data/spec/models/prod_type_reln_spec.rb +11 -0
- data/spec/models/prod_type_reln_type_spec.rb +12 -0
- data/spec/models/prod_type_role_type_spec.rb +12 -0
- data/spec/models/product_instance_spec.rb +13 -0
- data/spec/models/product_offer_spec.rb +12 -0
- data/spec/models/product_package_spec.rb +12 -0
- data/spec/models/product_type_spec.rb +13 -0
- data/spec/models/simple_product_offer_spec.rb +14 -0
- data/spec/spec_helper.rb +60 -0
- metadata +110 -34
@@ -1,41 +1,39 @@
|
|
1
|
-
Ext.ns("Compass.ErpApp.Desktop.Applications");
|
2
|
-
|
3
1
|
//
|
4
2
|
//module
|
5
3
|
//
|
6
4
|
|
7
5
|
Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager",{
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
}
|
17
|
-
},
|
18
|
-
createWindow : function(){
|
19
|
-
var desktop = this.app.getDesktop();
|
20
|
-
var win = desktop.getWindow('product_manager');
|
21
|
-
if(!win){
|
22
|
-
win = desktop.createWindow({
|
23
|
-
id: 'product_manager',
|
24
|
-
title:'Products',
|
25
|
-
width:1000,
|
26
|
-
height:550,
|
27
|
-
iconCls: 'icon-product',
|
28
|
-
shim:false,
|
29
|
-
animCollapse:false,
|
30
|
-
constrainHeader:true,
|
31
|
-
layout: 'fit',
|
32
|
-
items:[{
|
33
|
-
xtype:'productmanagement_productspanel'
|
34
|
-
}]
|
35
|
-
});
|
36
|
-
}
|
37
|
-
win.show();
|
6
|
+
extend:"Ext.ux.desktop.Module",
|
7
|
+
id:'product_manager-win',
|
8
|
+
init : function(){
|
9
|
+
this.launcher = {
|
10
|
+
text: 'Products',
|
11
|
+
iconCls:'icon-product',
|
12
|
+
handler : this.createWindow,
|
13
|
+
scope: this
|
38
14
|
}
|
15
|
+
},
|
16
|
+
createWindow : function(){
|
17
|
+
var desktop = this.app.getDesktop();
|
18
|
+
var win = desktop.getWindow('product_manager');
|
19
|
+
if(!win){
|
20
|
+
win = desktop.createWindow({
|
21
|
+
id: 'product_manager',
|
22
|
+
title:'Products',
|
23
|
+
width:1000,
|
24
|
+
height:550,
|
25
|
+
iconCls: 'icon-product',
|
26
|
+
shim:false,
|
27
|
+
animCollapse:false,
|
28
|
+
constrainHeader:true,
|
29
|
+
layout: 'fit',
|
30
|
+
items:[{
|
31
|
+
xtype:'productmanagement_productspanel'
|
32
|
+
}]
|
33
|
+
});
|
34
|
+
}
|
35
|
+
win.show();
|
36
|
+
}
|
39
37
|
});
|
40
38
|
|
41
39
|
//
|
@@ -43,102 +41,103 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager",{
|
|
43
41
|
//
|
44
42
|
|
45
43
|
Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.ProductDescriptionForm",{
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
extend:"Ext.form.Panel",
|
45
|
+
alias:'widget.productmanager_productdescriptionform',
|
46
|
+
initComponent: function() {
|
47
|
+
Compass.ErpApp.Desktop.Applications.ProductManager.ProductDescriptionForm.superclass.initComponent.call(this, arguments);
|
50
48
|
|
51
|
-
|
52
|
-
|
49
|
+
this.addEvents(
|
50
|
+
/**
|
53
51
|
* @event saved
|
54
52
|
* Fired after form is saved.
|
55
53
|
* @param {Compass.ErpApp.Desktop.Applications.ProductManager.ProductDescriptionForm} form this object
|
56
54
|
* @param {integer} Newly create id
|
57
55
|
*/
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
56
|
+
'saved'
|
57
|
+
);
|
58
|
+
},
|
59
|
+
|
60
|
+
constructor : function(config) {
|
61
|
+
var self = this;
|
62
|
+
config = Ext.apply({
|
63
|
+
buttonAlign:'center',
|
64
|
+
bodyStyle:'padding:5px 5px 0',
|
65
|
+
items: [
|
66
|
+
{
|
67
|
+
fieldLabel:'Title',
|
68
|
+
xtype:'textfield',
|
69
|
+
allowBlank:false,
|
70
|
+
width:500,
|
71
|
+
name:'title'
|
72
|
+
|
73
|
+
},
|
74
|
+
{
|
75
|
+
xtype : 'label',
|
76
|
+
html : 'Describe your product:',
|
77
|
+
cls : "x-form-item x-form-item-label card-label"
|
78
|
+
},
|
79
|
+
{
|
80
|
+
xtype: 'ckeditor',
|
81
|
+
allowBlank:false,
|
82
|
+
autoHeight:true,
|
83
|
+
ckEditorConfig:{
|
84
|
+
height:'290px',
|
85
|
+
width:750,
|
86
|
+
extraPlugins:'jwplayer',
|
87
|
+
toolbar:[
|
88
|
+
['Source','-','CompassSave','Preview','Print','-','Templates',
|
89
|
+
'Cut','Copy','Paste','PasteText','PasteFromWord','Undo','Redo'],
|
90
|
+
['Find','Replace','SpellChecker', 'Scayt','-','SelectAll'],
|
91
|
+
['TextColor','BGColor'],
|
92
|
+
['Bold','Italic','Underline','Strike','-','Subscript','Superscript','-','RemoveFormat'],
|
93
|
+
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],
|
94
|
+
'/',
|
95
|
+
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl'],
|
96
|
+
['BidiLtr', 'BidiRtl' ],
|
97
|
+
['Link','Unlink','Anchor'],
|
98
|
+
['jwplayer','Flash','Table','HorizontalRule',,'SpecialChar','PageBreak',],
|
99
|
+
[ 'Styles','Format','Font','FontSize' ],
|
100
|
+
['Maximize', 'ShowBlocks','-','About']
|
101
|
+
]
|
102
|
+
}
|
103
|
+
},
|
104
|
+
{
|
105
|
+
xtype:'hidden',
|
106
|
+
name:'description'
|
107
|
+
}
|
108
|
+
],
|
109
|
+
buttons:[
|
110
|
+
{
|
111
|
+
text:'Save',
|
112
|
+
handler:function(btn){
|
113
|
+
var formPanel = btn.findParentByType('form');
|
114
|
+
var basicForm = formPanel.getForm();
|
115
|
+
|
116
|
+
//ckeditor does not post. Get the value and set to hidden field
|
117
|
+
var ckeditor = formPanel.query('ckeditor').first();
|
118
|
+
basicForm.findField('description').setValue(ckeditor.getValue());
|
119
|
+
|
120
|
+
basicForm.submit({
|
121
|
+
success:function(form, action){
|
122
|
+
var obj = Ext.decode(action.response.responseText);
|
123
|
+
if(obj.success){
|
124
|
+
self.fireEvent('saved', this, obj.id);
|
125
|
+
}
|
126
|
+
else{
|
127
|
+
Ext.Msg.alert("Error", 'Error creating product');
|
128
|
+
}
|
104
129
|
},
|
105
|
-
{
|
106
|
-
|
107
|
-
name:'description'
|
108
|
-
}
|
109
|
-
],
|
110
|
-
buttons:[
|
111
|
-
{
|
112
|
-
text:'Save',
|
113
|
-
handler:function(btn){
|
114
|
-
var formPanel = btn.findParentByType('form');
|
115
|
-
var basicForm = formPanel.getForm();
|
116
|
-
|
117
|
-
//ckeditor does not post. Get the value and set to hidden field
|
118
|
-
var ckeditor = formPanel.query('ckeditor')[0];
|
119
|
-
basicForm.findField('description').setValue(ckeditor.getValue());
|
120
|
-
|
121
|
-
basicForm.submit({
|
122
|
-
success:function(form, action){
|
123
|
-
var obj = Ext.decode(action.response.responseText);
|
124
|
-
if(obj.success){
|
125
|
-
self.fireEvent('saved', this, obj.id);
|
126
|
-
}
|
127
|
-
else{
|
128
|
-
Ext.Msg.alert("Error", 'Error creating product');
|
129
|
-
}
|
130
|
-
},
|
131
|
-
failure:function(form, action){
|
132
|
-
Ext.Msg.alert("Error", 'Error creating product');
|
133
|
-
}
|
134
|
-
});
|
135
|
-
}
|
130
|
+
failure:function(form, action){
|
131
|
+
Ext.Msg.alert("Error", 'Error creating product');
|
136
132
|
}
|
137
|
-
|
138
|
-
}
|
133
|
+
});
|
134
|
+
}
|
135
|
+
}
|
136
|
+
]
|
137
|
+
}, config);
|
139
138
|
|
140
|
-
|
141
|
-
|
139
|
+
Compass.ErpApp.Desktop.Applications.ProductManager.ProductDescriptionForm.superclass.constructor.call(this, config);
|
140
|
+
}
|
142
141
|
});
|
143
142
|
|
144
143
|
//
|
@@ -146,331 +145,330 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.ProductDescriptio
|
|
146
145
|
//
|
147
146
|
|
148
147
|
Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.ProductPricingPanel",{
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
148
|
+
extend:"Ext.panel.Panel",
|
149
|
+
alias:'widget.productmanager_productpricingpanel',
|
150
|
+
updatePrice : function(rec){
|
151
|
+
this.addEditPriceBtn.setText('Update Price');
|
152
|
+
this.cancelBtn.show();
|
153
|
+
this.addPriceFormPanel.getForm().setValues(rec.data);
|
154
|
+
},
|
155
|
+
|
156
|
+
deletePrice : function(rec){
|
157
|
+
var self = this;
|
158
|
+
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this price?', function(btn){
|
159
|
+
if(btn == 'no'){
|
160
|
+
return false;
|
161
|
+
}
|
162
|
+
else
|
163
|
+
{
|
164
|
+
Ext.Ajax.request({
|
165
|
+
url: '/erp_products/erp_app/desktop/product_manager/delete_price/'+rec.get('pricing_plan_id'),
|
166
|
+
success: function(response) {
|
167
|
+
var obj = Ext.decode(response.responseText);
|
168
|
+
if(obj.success){
|
169
|
+
Ext.getCmp('productListPanel').loadProducts();
|
170
|
+
self.pricesGridPanel.getStore().load();
|
162
171
|
}
|
163
|
-
else
|
164
|
-
|
165
|
-
var conn = new Ext.data.Connection();
|
166
|
-
conn.request({
|
167
|
-
url: '/erp_products/erp_app/desktop/product_manager/delete_price/'+rec.get('pricing_plan_id'),
|
168
|
-
success: function(response) {
|
169
|
-
var obj = Ext.decode(response.responseText);
|
170
|
-
if(obj.success){
|
171
|
-
Ext.getCmp('productListPanel').loadProducts();
|
172
|
-
self.pricesGridPanel.getStore().load();
|
173
|
-
}
|
174
|
-
else{
|
175
|
-
Ext.Msg.alert('Error', 'Error deleting price.');
|
176
|
-
}
|
177
|
-
},
|
178
|
-
failure: function(response) {
|
179
|
-
Ext.Msg.alert('Error', 'Error deleting price.');
|
180
|
-
}
|
181
|
-
});
|
172
|
+
else{
|
173
|
+
Ext.Msg.alert('Error', 'Error deleting price.');
|
182
174
|
}
|
175
|
+
},
|
176
|
+
failure: function(response) {
|
177
|
+
Ext.Msg.alert('Error', 'Error deleting price.');
|
178
|
+
}
|
183
179
|
});
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
180
|
+
}
|
181
|
+
});
|
182
|
+
},
|
183
|
+
|
184
|
+
initComponent: function() {
|
185
|
+
Compass.ErpApp.Desktop.Applications.ProductManager.ProductPricingPanel.superclass.initComponent.call(this, arguments);
|
186
|
+
},
|
187
|
+
|
188
|
+
constructor : function(config) {
|
189
|
+
var self = this;
|
190
|
+
|
191
|
+
this.pricesGridPanel = Ext.create("Ext.grid.Panel",{
|
192
|
+
layout:'fit',
|
193
|
+
region:'center',
|
194
|
+
split:true,
|
195
|
+
columns: [
|
196
|
+
{
|
197
|
+
header:'Description',
|
198
|
+
width:310,
|
199
|
+
sortable: false,
|
200
|
+
dataIndex: 'description'
|
201
|
+
},
|
202
|
+
{
|
203
|
+
header: 'Price',
|
204
|
+
width: 75,
|
205
|
+
sortable: true,
|
206
|
+
dataIndex: 'price',
|
207
|
+
renderer:function(v){
|
208
|
+
return v.toFixed(2);
|
209
|
+
}
|
210
|
+
},
|
211
|
+
{
|
212
|
+
header: 'Currency',
|
213
|
+
width: 75,
|
214
|
+
sortable: true,
|
215
|
+
dataIndex: 'currency_display'
|
216
|
+
},
|
217
|
+
{
|
218
|
+
header: 'From Date',
|
219
|
+
width: 90,
|
220
|
+
sortable: true,
|
221
|
+
dataIndex: 'from_date',
|
222
|
+
renderer: Ext.util.Format.dateRenderer('m/d/Y')
|
223
|
+
},
|
224
|
+
{
|
225
|
+
header: 'Thru Date',
|
226
|
+
width: 90,
|
227
|
+
sortable: true,
|
228
|
+
dataIndex: 'thru_date',
|
229
|
+
renderer: Ext.util.Format.dateRenderer('m/d/Y')
|
230
|
+
},
|
231
|
+
{
|
232
|
+
menuDisabled:true,
|
233
|
+
resizable:false,
|
234
|
+
xtype:'actioncolumn',
|
235
|
+
header:'Update',
|
236
|
+
align:'center',
|
237
|
+
width:60,
|
238
|
+
items:[{
|
239
|
+
icon:'/images/icons/edit/edit_16x16.png',
|
240
|
+
tooltip:'Update',
|
241
|
+
handler :function(grid, rowIndex, colIndex){
|
242
|
+
var rec = grid.getStore().getAt(rowIndex);
|
243
|
+
self.updatePrice(rec);
|
244
|
+
}
|
245
|
+
}]
|
246
|
+
},
|
247
|
+
{
|
248
|
+
menuDisabled:true,
|
249
|
+
resizable:false,
|
250
|
+
xtype:'actioncolumn',
|
251
|
+
header:'Delete',
|
252
|
+
align:'center',
|
253
|
+
width:60,
|
254
|
+
items:[{
|
255
|
+
icon:'/images/icons/delete/delete_16x16.png',
|
256
|
+
tooltip:'Delete',
|
257
|
+
handler :function(grid, rowIndex, colIndex){
|
258
|
+
var rec = grid.getStore().getAt(rowIndex);
|
259
|
+
self.deletePrice(rec);
|
260
|
+
}
|
261
|
+
}]
|
262
|
+
},
|
263
|
+
{
|
264
|
+
menuDisabled:true,
|
265
|
+
resizable:false,
|
266
|
+
xtype:'actioncolumn',
|
267
|
+
header:'Comment',
|
268
|
+
align:'center',
|
269
|
+
width:60,
|
270
|
+
items:[{
|
271
|
+
getClass: function(v, meta, rec) { // Or return a class from a function
|
272
|
+
this.items[0].tooltip = rec.get('comments');
|
273
|
+
return 'info-col';
|
274
|
+
},
|
275
|
+
handler: function(grid, rowIndex, colIndex) {
|
276
|
+
return false;
|
277
|
+
}
|
278
|
+
}]
|
279
|
+
}
|
280
|
+
],
|
281
|
+
loadMask: true,
|
282
|
+
stripeRows: true,
|
283
|
+
store: Ext.create("Ext.data.Store",{
|
284
|
+
autoLoad: true,
|
285
|
+
proxy:{
|
286
|
+
type:'ajax',
|
287
|
+
url: '/erp_products/erp_app/desktop/product_manager/prices/'+config.productTypeId,
|
288
|
+
reader:{
|
289
|
+
root: 'prices',
|
290
|
+
type:'json'
|
291
|
+
}
|
292
|
+
},
|
293
|
+
fields:[{
|
294
|
+
name:'price',
|
295
|
+
type:'decimal'
|
296
|
+
}, 'currency', 'currency_display', 'from_date', 'thru_date', 'description','comments','pricing_plan_id']
|
297
|
+
})
|
298
|
+
});
|
299
|
+
|
300
|
+
this.addEditPriceBtn = Ext.create("Ext.button.Button",{
|
301
|
+
scope:this,
|
302
|
+
text:'Add Price',
|
303
|
+
handler:function(btn){
|
304
|
+
var formPanel = btn.findParentByType('form');
|
305
|
+
var basicForm = formPanel.getForm();
|
306
|
+
|
307
|
+
basicForm.submit({
|
308
|
+
reset:true,
|
309
|
+
success:function(form, action){
|
310
|
+
var obj = Ext.decode(action.response.responseText);
|
311
|
+
if(obj.success){
|
312
|
+
self.addEditPriceBtn.setText('Add Price');
|
313
|
+
self.cancelBtn.hide();
|
314
|
+
Ext.getCmp('productListPanel').loadProducts();
|
315
|
+
self.pricesGridPanel.getStore().load();
|
281
316
|
}
|
282
|
-
|
283
|
-
|
284
|
-
stripeRows: true,
|
285
|
-
store: Ext.create("Ext.data.Store",{
|
286
|
-
autoLoad: true,
|
287
|
-
proxy:{
|
288
|
-
type:'ajax',
|
289
|
-
url: '/erp_products/erp_app/desktop/product_manager/prices/'+config.productTypeId,
|
290
|
-
reader:{
|
291
|
-
root: 'prices',
|
292
|
-
type:'json'
|
293
|
-
}
|
294
|
-
},
|
295
|
-
fields:[{
|
296
|
-
name:'price',
|
297
|
-
type:'decimal'
|
298
|
-
}, 'currency', 'currency_display', 'from_date', 'thru_date', 'description','comments','pricing_plan_id']
|
299
|
-
})
|
300
|
-
});
|
301
|
-
|
302
|
-
this.addEditPriceBtn = Ext.create("Ext.button.Button",{
|
303
|
-
scope:this,
|
304
|
-
text:'Add Price',
|
305
|
-
handler:function(btn){
|
306
|
-
var formPanel = btn.findParentByType('form');
|
307
|
-
var basicForm = formPanel.getForm();
|
308
|
-
|
309
|
-
basicForm.submit({
|
310
|
-
reset:true,
|
311
|
-
success:function(form, action){
|
312
|
-
var obj = Ext.decode(action.response.responseText);
|
313
|
-
if(obj.success){
|
314
|
-
self.addEditPriceBtn.setText('Add Price');
|
315
|
-
self.cancelBtn.hide();
|
316
|
-
Ext.getCmp('productListPanel').loadProducts();
|
317
|
-
self.pricesGridPanel.getStore().load();
|
318
|
-
}
|
319
|
-
else{
|
320
|
-
Ext.Msg.alert("Error", 'Error creating price');
|
321
|
-
}
|
322
|
-
},
|
323
|
-
failure:function(form, action){
|
324
|
-
Ext.Msg.alert("Error", 'Error creating price');
|
325
|
-
}
|
326
|
-
});
|
317
|
+
else{
|
318
|
+
Ext.Msg.alert("Error", 'Error creating price');
|
327
319
|
}
|
320
|
+
},
|
321
|
+
failure:function(form, action){
|
322
|
+
Ext.Msg.alert("Error", 'Error creating price');
|
323
|
+
}
|
328
324
|
});
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
325
|
+
}
|
326
|
+
});
|
327
|
+
|
328
|
+
this.cancelBtn = Ext.create("Ext.button.Button",{
|
329
|
+
text:'Cancel',
|
330
|
+
hidden:true,
|
331
|
+
handler:function(btn){
|
332
|
+
var formPanel = btn.findParentByType('form');
|
333
|
+
var basicForm = formPanel.getForm();
|
334
|
+
basicForm.reset();
|
335
|
+
self.addEditPriceBtn.setText('Add Price');
|
336
|
+
self.cancelBtn.hide();
|
337
|
+
}
|
338
|
+
});
|
339
|
+
|
340
|
+
this.addPriceFormPanel = Ext.create("Ext.form.Panel",{
|
341
|
+
layout:'anchor',
|
342
|
+
collapsible:true,
|
343
|
+
split:true,
|
344
|
+
height:175,
|
345
|
+
frame:true,
|
346
|
+
region:'south',
|
347
|
+
buttonAlign:'center',
|
348
|
+
bodyStyle:'padding:5px 5px 0',
|
349
|
+
url:'/erp_products/erp_app/desktop/product_manager/new_and_update_price',
|
350
|
+
items: [
|
351
|
+
{
|
352
|
+
xtype:'textfield',
|
353
|
+
width:400,
|
354
|
+
name:'description',
|
355
|
+
fieldLabel:'Description'
|
356
|
+
},
|
357
|
+
{
|
358
|
+
layout:'column',
|
359
|
+
xtype:'container',
|
360
|
+
frame:false,
|
361
|
+
border:false,
|
362
|
+
defaults:{
|
363
|
+
columnWidth:0.25,
|
364
|
+
border:false,
|
365
|
+
frame:false,
|
366
|
+
xtype:'container',
|
367
|
+
bodyStyle:'padding:0 18px 0 0'
|
368
|
+
},
|
369
|
+
items:[{
|
370
|
+
items:[
|
371
|
+
{
|
372
|
+
fieldLabel:'Price',
|
373
|
+
xtype:'numberfield',
|
374
|
+
width:200,
|
343
375
|
layout:'anchor',
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
]
|
441
|
-
}]
|
442
|
-
},
|
443
|
-
{
|
444
|
-
xtype:'textarea',
|
445
|
-
height:50,
|
446
|
-
width:400,
|
447
|
-
name:'comments',
|
448
|
-
fieldLabel:'Comments'
|
449
|
-
},
|
450
|
-
{
|
451
|
-
xtype:'hidden',
|
452
|
-
name:'product_type_id',
|
453
|
-
value:config.productTypeId
|
454
|
-
},
|
455
|
-
{
|
456
|
-
xtype:'hidden',
|
457
|
-
name:'pricing_plan_id'
|
458
|
-
}
|
459
|
-
],
|
460
|
-
buttons:[
|
461
|
-
this.addEditPriceBtn,
|
462
|
-
this.cancelBtn
|
463
|
-
]
|
464
|
-
});
|
465
|
-
|
466
|
-
config = Ext.apply({
|
467
|
-
title:'Pricing',
|
468
|
-
layout:'border',
|
469
|
-
items:[this.pricesGridPanel,this.addPriceFormPanel]
|
470
|
-
}, config);
|
471
|
-
|
472
|
-
Compass.ErpApp.Desktop.Applications.ProductManager.ProductPricingPanel.superclass.constructor.call(this, config);
|
473
|
-
}
|
376
|
+
allowBlank:false,
|
377
|
+
name:'price'
|
378
|
+
}
|
379
|
+
]
|
380
|
+
},
|
381
|
+
{
|
382
|
+
items:[
|
383
|
+
{
|
384
|
+
fieldLabel:'Currency',
|
385
|
+
xtype:'combo',
|
386
|
+
width:200,
|
387
|
+
id : 'call_center_party_country',
|
388
|
+
allowBlank : false,
|
389
|
+
store :Ext.create("Ext.data.Store",{
|
390
|
+
autoLoad: true,
|
391
|
+
proxy:{
|
392
|
+
type:'ajax',
|
393
|
+
url: '/erp_products/erp_app/desktop/product_manager/currencies',
|
394
|
+
reader:{
|
395
|
+
root: 'currencies',
|
396
|
+
type:'json'
|
397
|
+
}
|
398
|
+
},
|
399
|
+
fields: [
|
400
|
+
{
|
401
|
+
name:'internal_identifier'
|
402
|
+
},
|
403
|
+
{
|
404
|
+
name:'id'
|
405
|
+
}
|
406
|
+
]
|
407
|
+
}),
|
408
|
+
hiddenName: 'currency',
|
409
|
+
hiddenField: 'currency',
|
410
|
+
valueField: 'id',
|
411
|
+
displayField: 'internal_identifier',
|
412
|
+
forceSelection : true,
|
413
|
+
triggerAction : 'all',
|
414
|
+
name:'currency'
|
415
|
+
}
|
416
|
+
]
|
417
|
+
},
|
418
|
+
{
|
419
|
+
items:[
|
420
|
+
{
|
421
|
+
fieldLabel:'From Date',
|
422
|
+
xtype:'datefield',
|
423
|
+
width:200,
|
424
|
+
allowBlank:false,
|
425
|
+
name:'from_date'
|
426
|
+
}
|
427
|
+
]
|
428
|
+
},
|
429
|
+
{
|
430
|
+
items:[
|
431
|
+
{
|
432
|
+
fieldLabel:'Thru Date',
|
433
|
+
xtype:'datefield',
|
434
|
+
width:200,
|
435
|
+
allowBlank:false,
|
436
|
+
name:'thru_date'
|
437
|
+
}
|
438
|
+
]
|
439
|
+
}]
|
440
|
+
},
|
441
|
+
{
|
442
|
+
xtype:'textarea',
|
443
|
+
height:50,
|
444
|
+
width:400,
|
445
|
+
name:'comments',
|
446
|
+
fieldLabel:'Comments'
|
447
|
+
},
|
448
|
+
{
|
449
|
+
xtype:'hidden',
|
450
|
+
name:'product_type_id',
|
451
|
+
value:config.productTypeId
|
452
|
+
},
|
453
|
+
{
|
454
|
+
xtype:'hidden',
|
455
|
+
name:'pricing_plan_id'
|
456
|
+
}
|
457
|
+
],
|
458
|
+
buttons:[
|
459
|
+
this.addEditPriceBtn,
|
460
|
+
this.cancelBtn
|
461
|
+
]
|
462
|
+
});
|
463
|
+
|
464
|
+
config = Ext.apply({
|
465
|
+
title:'Pricing',
|
466
|
+
layout:'border',
|
467
|
+
items:[this.pricesGridPanel,this.addPriceFormPanel]
|
468
|
+
}, config);
|
469
|
+
|
470
|
+
Compass.ErpApp.Desktop.Applications.ProductManager.ProductPricingPanel.superclass.constructor.call(this, config);
|
471
|
+
}
|
474
472
|
});
|
475
473
|
|
476
474
|
//
|
@@ -478,121 +476,120 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.ProductPricingPan
|
|
478
476
|
//
|
479
477
|
|
480
478
|
Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.ProductImagesPanel",{
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
479
|
+
extend:"Ext.panel.Panel",
|
480
|
+
alias:'widget.productmanager_productimagespanel',
|
481
|
+
deleteImage : function(id){
|
482
|
+
var self = this;
|
483
|
+
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this image?', function(btn){
|
484
|
+
if(btn == 'no'){
|
485
|
+
return false;
|
486
|
+
}
|
487
|
+
else
|
488
|
+
{
|
489
|
+
Ext.Ajax.request({
|
490
|
+
url: '/erp_products/erp_app/desktop/product_manager/delete_image/'+id,
|
491
|
+
success: function(response) {
|
492
|
+
var obj = Ext.decode(response.responseText);
|
493
|
+
if(obj.success){
|
494
|
+
self.imageAssetsDataView.getStore().load();
|
488
495
|
}
|
489
|
-
else
|
490
|
-
|
491
|
-
var conn = new Ext.data.Connection();
|
492
|
-
conn.request({
|
493
|
-
url: '/erp_products/erp_app/desktop/product_manager/delete_image/'+id,
|
494
|
-
success: function(response) {
|
495
|
-
var obj = Ext.decode(response.responseText);
|
496
|
-
if(obj.success){
|
497
|
-
self.imageAssetsDataView.getStore().load();
|
498
|
-
}
|
499
|
-
else{
|
500
|
-
Ext.Msg.alert('Error', 'Error deleting image.');
|
501
|
-
}
|
502
|
-
},
|
503
|
-
failure: function(response) {
|
504
|
-
Ext.Msg.alert('Error', 'Error deleting image.');
|
505
|
-
}
|
506
|
-
});
|
496
|
+
else{
|
497
|
+
Ext.Msg.alert('Error', 'Error deleting image.');
|
507
498
|
}
|
499
|
+
},
|
500
|
+
failure: function(response) {
|
501
|
+
Ext.Msg.alert('Error', 'Error deleting image.');
|
502
|
+
}
|
508
503
|
});
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
504
|
+
}
|
505
|
+
});
|
506
|
+
},
|
507
|
+
|
508
|
+
constructor : function(config) {
|
509
|
+
var self = this;
|
510
|
+
var productTypeId = config.productTypeId;
|
511
|
+
var uploadUrl = '/erp_products/erp_app/desktop/product_manager/new_image'
|
515
512
|
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
}
|
551
|
-
]
|
552
|
-
});
|
553
|
-
contextMenu.showAt(e.xy);
|
554
|
-
}
|
513
|
+
this.imageAssetsDataView = Ext.create("Ext.view.View",{
|
514
|
+
autoDestroy:true,
|
515
|
+
itemSelector: 'div.thumb-wrap',
|
516
|
+
style:'overflow:auto',
|
517
|
+
store: Ext.create("Ext.data.Store",{
|
518
|
+
autoLoad: true,
|
519
|
+
proxy:{
|
520
|
+
type:'ajax',
|
521
|
+
url: '/erp_products/erp_app/desktop/product_manager/images/'+productTypeId,
|
522
|
+
reader:{
|
523
|
+
root: 'images',
|
524
|
+
type:'json'
|
525
|
+
}
|
526
|
+
},
|
527
|
+
fields:['name', 'url', 'shortName', 'id']
|
528
|
+
}),
|
529
|
+
tpl: new Ext.XTemplate(
|
530
|
+
'<tpl for=".">',
|
531
|
+
'<div class="thumb-wrap" id="{name}">',
|
532
|
+
'<div class="thumb"><img src="{url}" class="thumb-img"></div>',
|
533
|
+
'<span>{shortName}</span></div>',
|
534
|
+
'</tpl>'
|
535
|
+
),
|
536
|
+
listeners:{
|
537
|
+
'itemcontextmenu':function(view, record, htmlitem, index, e, options){
|
538
|
+
e.stopEvent();
|
539
|
+
var contextMenu = Ext.create("Ext.menu.Menu",{
|
540
|
+
items:[
|
541
|
+
{
|
542
|
+
text:'Delete',
|
543
|
+
iconCls:'icon-delete',
|
544
|
+
handler:function(btn){
|
545
|
+
self.deleteImage(self.imageAssetsDataView.getStore().getAt(index).get('id'));
|
546
|
+
}
|
555
547
|
}
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
548
|
+
]
|
549
|
+
});
|
550
|
+
contextMenu.showAt(e.xy);
|
551
|
+
}
|
552
|
+
}
|
553
|
+
});
|
554
|
+
|
555
|
+
config = Ext.apply({
|
556
|
+
id:'product-image-assets',
|
557
|
+
title:'Images',
|
558
|
+
autoDestroy:true,
|
559
|
+
margins: '5 5 5 0',
|
560
|
+
autoHeight:true,
|
561
|
+
layout:'fit',
|
562
|
+
items:[this.imageAssetsDataView],
|
563
|
+
tbar:{
|
564
|
+
items:[
|
565
|
+
{
|
566
|
+
text:'Add Image',
|
567
|
+
iconCls:'icon-upload',
|
568
|
+
handler:function(btn){
|
569
|
+
var uploadWindow = Ext.create("Compass.ErpApp.Shared.UploadWindow",{
|
570
|
+
standardUploadUrl:uploadUrl,
|
571
|
+
flashUploadUrl:uploadUrl,
|
572
|
+
xhrUploadUrl:uploadUrl,
|
573
|
+
extraPostData:{
|
574
|
+
product_type_id:productTypeId
|
575
|
+
},
|
576
|
+
listeners:{
|
577
|
+
'fileuploaded':function(){
|
578
|
+
var dataView = btn.findParentByType('panel').query('dataview')[0];
|
579
|
+
dataView.getStore().load();
|
580
|
+
Ext.getCmp('productListPanel').loadProducts();
|
589
581
|
}
|
590
|
-
|
591
|
-
}
|
592
|
-
|
582
|
+
}
|
583
|
+
});
|
584
|
+
uploadWindow.show();
|
585
|
+
}
|
586
|
+
}
|
587
|
+
]
|
588
|
+
}
|
589
|
+
}, config);
|
593
590
|
|
594
|
-
|
595
|
-
|
591
|
+
Compass.ErpApp.Desktop.Applications.ProductManager.ProductImagesPanel.superclass.constructor.call(this, config);
|
592
|
+
}
|
596
593
|
});
|
597
594
|
|
598
595
|
//
|
@@ -600,66 +597,66 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.ProductImagesPane
|
|
600
597
|
//
|
601
598
|
|
602
599
|
Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.InventoryFormPanel",{
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
600
|
+
extend:"Ext.form.Panel",
|
601
|
+
alias:'widget.productmanager_inventoryformpanel',
|
602
|
+
initComponent: function() {
|
603
|
+
Compass.ErpApp.Desktop.Applications.ProductManager.InventoryFormPanel.superclass.initComponent.call(this, arguments);
|
604
|
+
},
|
605
|
+
|
606
|
+
constructor : function(config) {
|
607
|
+
config = Ext.apply({
|
608
|
+
title:'Inventory',
|
609
|
+
frame:true,
|
610
|
+
buttonAlign:'left',
|
611
|
+
bodyStyle:'padding:5px 5px 0',
|
612
|
+
url:'/erp_products/erp_app/desktop/product_manager/update_inventory',
|
613
|
+
items:[
|
614
|
+
{
|
615
|
+
fieldLabel:'SKU #',
|
616
|
+
xtype:'textfield',
|
617
|
+
allowBlank:true,
|
618
|
+
name:'sku'
|
619
|
+
},{
|
620
|
+
fieldLabel:'# Available',
|
621
|
+
xtype:'numberfield',
|
622
|
+
allowBlank:false,
|
623
|
+
name:'number_available'
|
624
|
+
},
|
625
|
+
{
|
626
|
+
xtype:'hidden',
|
627
|
+
name:'product_type_id',
|
628
|
+
value:config.productTypeId
|
629
|
+
},
|
630
|
+
],
|
631
|
+
buttons:[
|
632
|
+
{
|
633
|
+
text:'Update',
|
634
|
+
handler:function(btn){
|
635
|
+
var formPanel = btn.findParentByType('form');
|
636
|
+
var basicForm = formPanel.getForm();
|
637
|
+
|
638
|
+
basicForm.submit({
|
639
|
+
reset:false,
|
640
|
+
success:function(form, action){
|
641
|
+
var obj = Ext.decode(action.response.responseText);
|
642
|
+
if(obj.success){
|
643
|
+
Ext.getCmp('productListPanel').loadProducts();
|
644
|
+
}
|
645
|
+
else{
|
646
|
+
Ext.Msg.alert("Error", 'Error creating price');
|
647
|
+
}
|
627
648
|
},
|
628
|
-
{
|
629
|
-
|
630
|
-
name:'product_type_id',
|
631
|
-
value:config.productTypeId
|
632
|
-
},
|
633
|
-
],
|
634
|
-
buttons:[
|
635
|
-
{
|
636
|
-
text:'Update',
|
637
|
-
handler:function(btn){
|
638
|
-
var formPanel = btn.findParentByType('form');
|
639
|
-
var basicForm = formPanel.getForm();
|
640
|
-
|
641
|
-
basicForm.submit({
|
642
|
-
reset:false,
|
643
|
-
success:function(form, action){
|
644
|
-
var obj = Ext.decode(action.response.responseText);
|
645
|
-
if(obj.success){
|
646
|
-
Ext.getCmp('productListPanel').loadProducts();
|
647
|
-
}
|
648
|
-
else{
|
649
|
-
Ext.Msg.alert("Error", 'Error creating price');
|
650
|
-
}
|
651
|
-
},
|
652
|
-
failure:function(form, action){
|
653
|
-
Ext.Msg.alert("Error", 'Error creating price');
|
654
|
-
}
|
655
|
-
});
|
656
|
-
}
|
649
|
+
failure:function(form, action){
|
650
|
+
Ext.Msg.alert("Error", 'Error creating price');
|
657
651
|
}
|
658
|
-
|
659
|
-
}
|
652
|
+
});
|
653
|
+
}
|
654
|
+
}
|
655
|
+
]
|
656
|
+
}, config);
|
660
657
|
|
661
|
-
|
662
|
-
|
658
|
+
Compass.ErpApp.Desktop.Applications.ProductManager.InventoryFormPanel.superclass.constructor.call(this, config);
|
659
|
+
}
|
663
660
|
});
|
664
661
|
|
665
662
|
//
|
@@ -667,39 +664,39 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.InventoryFormPane
|
|
667
664
|
//
|
668
665
|
|
669
666
|
Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.AddProductWindow",{
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
667
|
+
extend:"Ext.window.Window",
|
668
|
+
alias:'widget.productmanager_addproductwindow',
|
669
|
+
initComponent: function() {
|
670
|
+
Compass.ErpApp.Desktop.Applications.ProductManager.AddProductWindow.superclass.initComponent.call(this, arguments);
|
671
|
+
},
|
672
|
+
|
673
|
+
constructor : function(config) {
|
674
|
+
var self = this;
|
675
|
+
config = Ext.apply({
|
676
|
+
title:'Add New Product',
|
677
|
+
width:800,
|
678
|
+
layout:'fit',
|
679
|
+
height:600,
|
680
|
+
autoScroll:true,
|
681
|
+
buttonAlign:'center',
|
682
|
+
items:{
|
683
|
+
xtype:'productmanager_productdescriptionform',
|
684
|
+
url:'/erp_products/erp_app/desktop/product_manager/new',
|
685
|
+
listeners:{
|
686
|
+
saved:function(form, newId){
|
687
|
+
Ext.getCmp('productListPanel').loadProducts();
|
688
|
+
var win = new Compass.ErpApp.Desktop.Applications.ProductManager.UpdateProductWindow({
|
689
|
+
productTypeId:newId
|
690
|
+
});
|
691
|
+
win.show();
|
692
|
+
self.close();
|
693
|
+
}
|
694
|
+
}
|
695
|
+
}
|
696
|
+
}, config);
|
700
697
|
|
701
|
-
|
702
|
-
|
698
|
+
Compass.ErpApp.Desktop.Applications.ProductManager.AddProductWindow.superclass.constructor.call(this, config);
|
699
|
+
}
|
703
700
|
});
|
704
701
|
|
705
702
|
//
|
@@ -707,93 +704,91 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.AddProductWindow"
|
|
707
704
|
//
|
708
705
|
|
709
706
|
Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.UpdateProductWindow",{
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
Ext.Msg.alert('Error', 'Error loading product details.');
|
745
|
-
}
|
746
|
-
});
|
747
|
-
}
|
748
|
-
}
|
749
|
-
|
750
|
-
}
|
751
|
-
},
|
752
|
-
{
|
753
|
-
xtype:'productmanager_productimagespanel',
|
754
|
-
productTypeId:config.productTypeId
|
755
|
-
},
|
756
|
-
{
|
757
|
-
xtype:'productmanager_productpricingpanel',
|
758
|
-
productTypeId:config.productTypeId
|
759
|
-
},
|
760
|
-
{
|
761
|
-
xtype:'productmanager_inventoryformpanel',
|
762
|
-
productTypeId:config.productTypeId,
|
763
|
-
listeners:{
|
764
|
-
'activate':function(panel){
|
765
|
-
var self = this;
|
766
|
-
var conn = new Ext.data.Connection();
|
767
|
-
conn.request({
|
768
|
-
url: '/erp_products/erp_app/desktop/product_manager/inventory/'+panel.initialConfig['productTypeId'],
|
769
|
-
success: function(response) {
|
770
|
-
var obj = Ext.decode(response.responseText);
|
771
|
-
self.getForm().setValues(obj);
|
772
|
-
},
|
773
|
-
failure: function(response) {
|
774
|
-
Ext.Msg.alert('Error', 'Error loading inventory.');
|
775
|
-
}
|
776
|
-
});
|
777
|
-
}
|
707
|
+
extend:"Ext.window.Window",
|
708
|
+
alias:'widget.productmanager_updateproductwindow',
|
709
|
+
initComponent: function() {
|
710
|
+
Compass.ErpApp.Desktop.Applications.ProductManager.UpdateProductWindow.superclass.initComponent.call(this, arguments);
|
711
|
+
},
|
712
|
+
|
713
|
+
constructor : function(config) {
|
714
|
+
var self = this;
|
715
|
+
var activeTab = config['activeTab'] | 0
|
716
|
+
|
717
|
+
var tabLayout = {
|
718
|
+
xtype:'tabpanel',
|
719
|
+
items:[
|
720
|
+
{
|
721
|
+
title:'Description',
|
722
|
+
xtype:'productmanager_productdescriptionform',
|
723
|
+
url:'/erp_products/erp_app/desktop/product_manager/update/'+config.productTypeId,
|
724
|
+
productTypeId:config.productTypeId,
|
725
|
+
listeners:{
|
726
|
+
'saved':function(form){
|
727
|
+
Ext.getCmp('productListPanel').loadProducts();
|
728
|
+
},
|
729
|
+
'activate':function(panel){
|
730
|
+
if(!Compass.ErpApp.Utility.isBlank(panel.initialConfig['productTypeId'])){
|
731
|
+
var self = this;
|
732
|
+
Ext.Ajax.request({
|
733
|
+
url: '/erp_products/erp_app/desktop/product_manager/show/'+panel.initialConfig['productTypeId'],
|
734
|
+
success: function(response) {
|
735
|
+
var obj = Ext.decode(response.responseText);
|
736
|
+
self.getForm().setValues(obj);
|
737
|
+
self.query('ckeditor')[0].setValue(obj.description);
|
738
|
+
},
|
739
|
+
failure: function(response) {
|
740
|
+
Ext.Msg.alert('Error', 'Error loading product details.');
|
778
741
|
}
|
742
|
+
});
|
779
743
|
}
|
780
|
-
|
744
|
+
}
|
745
|
+
|
781
746
|
}
|
747
|
+
},
|
748
|
+
{
|
749
|
+
xtype:'productmanager_productimagespanel',
|
750
|
+
productTypeId:config.productTypeId
|
751
|
+
},
|
752
|
+
{
|
753
|
+
xtype:'productmanager_productpricingpanel',
|
754
|
+
productTypeId:config.productTypeId
|
755
|
+
},
|
756
|
+
{
|
757
|
+
xtype:'productmanager_inventoryformpanel',
|
758
|
+
productTypeId:config.productTypeId,
|
759
|
+
listeners:{
|
760
|
+
'activate':function(panel){
|
761
|
+
var self = this;
|
762
|
+
Ext.Ajax.request({
|
763
|
+
url: '/erp_products/erp_app/desktop/product_manager/inventory/'+panel.initialConfig['productTypeId'],
|
764
|
+
success: function(response) {
|
765
|
+
var obj = Ext.decode(response.responseText);
|
766
|
+
self.getForm().setValues(obj);
|
767
|
+
},
|
768
|
+
failure: function(response) {
|
769
|
+
Ext.Msg.alert('Error', 'Error loading inventory.');
|
770
|
+
}
|
771
|
+
});
|
772
|
+
}
|
773
|
+
}
|
774
|
+
}
|
775
|
+
]
|
776
|
+
}
|
782
777
|
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
778
|
+
config = Ext.apply({
|
779
|
+
title:'Update Product',
|
780
|
+
width:860,
|
781
|
+
layout:'fit',
|
782
|
+
height:620,
|
783
|
+
autoScroll:true,
|
784
|
+
items:[tabLayout],
|
785
|
+
listeners:{
|
786
|
+
show:function(comp){
|
787
|
+
comp.query('tabpanel')[0].setActiveTab(activeTab);
|
788
|
+
}
|
789
|
+
}
|
790
|
+
}, config);
|
796
791
|
|
797
|
-
|
798
|
-
|
792
|
+
Compass.ErpApp.Desktop.Applications.ProductManager.UpdateProductWindow.superclass.constructor.call(this, config);
|
793
|
+
}
|
799
794
|
});
|