erp_products 3.0.1 → 3.0.2
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 +41 -139
- data/app/models/product_instance.rb +0 -1
- data/app/models/product_type.rb +1 -2
- data/lib/erp_products/version.rb +1 -1
- data/public/javascripts/erp_app/desktop/applications/product_manager/module.js +16 -434
- metadata +87 -99
- data/app/views/layouts/erp_products/application.html.erb +0 -14
@@ -3,19 +3,41 @@ module ErpProducts
|
|
3
3
|
module Desktop
|
4
4
|
module ProductManager
|
5
5
|
class BaseController < ::ErpApp::Desktop::BaseController
|
6
|
+
|
6
7
|
def index
|
7
|
-
products =
|
8
|
-
|
9
|
-
|
10
|
-
:
|
11
|
-
:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
8
|
+
products = []
|
9
|
+
ProductType.all.each do |product_type|
|
10
|
+
product_hash = product_type.to_hash(
|
11
|
+
:only => [:id, :description => :title],
|
12
|
+
:additional_values => {
|
13
|
+
:imageUrl => (product_type.images.empty? ? '/images/img_blank.png' : product_type.images.first.data.url(nil, :escape => false))
|
14
|
+
})
|
15
|
+
|
16
|
+
#I do not like this, need to find a better way
|
17
|
+
if product_type.respond_to?(:get_current_simple_amount_with_currency)
|
18
|
+
product_hash[:price] = product_type.get_current_simple_amount_with_currency.nil? ? 'no price set' : product_type.get_current_simple_amount_with_currency
|
19
|
+
end
|
20
|
+
|
21
|
+
#I do not like this, need to find a better way
|
22
|
+
if product_type.respond_to?(:inventory_entries)
|
23
|
+
inventory_entry = if product_type.inventory_entries.empty?
|
24
|
+
InventoryEntry.create(
|
25
|
+
:product_type => product_type,
|
26
|
+
:number_available => 0,
|
27
|
+
:number_sold => 0,
|
28
|
+
:description => product_type.description
|
29
|
+
)
|
30
|
+
else
|
31
|
+
product_type.inventory_entries.first
|
32
|
+
end
|
18
33
|
|
34
|
+
product_hash[:available] = inventory_entry.number_available
|
35
|
+
product_hash[:sold] = inventory_entry.number_sold
|
36
|
+
product_hash[:sku] = inventory_entry.sku.nil? ? '' : inventory_entry.sku
|
37
|
+
end
|
38
|
+
|
39
|
+
products << product_hash
|
40
|
+
end
|
19
41
|
render :json => {:products => products}
|
20
42
|
end
|
21
43
|
|
@@ -40,8 +62,6 @@ module ErpProducts
|
|
40
62
|
end
|
41
63
|
|
42
64
|
def new
|
43
|
-
result = {}
|
44
|
-
|
45
65
|
title = params[:title]
|
46
66
|
description = params[:description]
|
47
67
|
|
@@ -55,27 +75,10 @@ module ErpProducts
|
|
55
75
|
)
|
56
76
|
|
57
77
|
if product_type.save
|
58
|
-
|
59
|
-
inventory_entry = InventoryEntry.new(
|
60
|
-
:product_type => product_type,
|
61
|
-
:number_available => 0,
|
62
|
-
:number_sold => 0,
|
63
|
-
:description => product_type.description
|
64
|
-
)
|
65
|
-
|
66
|
-
if inventory_entry.save
|
67
|
-
result[:success] = true
|
68
|
-
result[:id] = product_type.id
|
69
|
-
else
|
70
|
-
product_type.destroy
|
71
|
-
result[:success] = false
|
72
|
-
end
|
73
|
-
|
78
|
+
render :json => {:success => true, :id => product_type.id}
|
74
79
|
else
|
75
|
-
|
80
|
+
render :json => {:success => false}
|
76
81
|
end
|
77
|
-
|
78
|
-
render :json => result
|
79
82
|
end
|
80
83
|
|
81
84
|
def delete
|
@@ -101,7 +104,7 @@ module ErpProducts
|
|
101
104
|
result = {}
|
102
105
|
|
103
106
|
begin
|
104
|
-
name = request.env['HTTP_X_FILE_NAME'].blank? ? params[:file_data].original_filename : request.env['HTTP_X_FILE_NAME']
|
107
|
+
name = request.env['HTTP_X_FILE_NAME'].blank? ? params[:file_data].original_filename : request.env['HTTP_X_FILE_NAME']
|
105
108
|
data = request.env['HTTP_X_FILE_NAME'].blank? ? params[:file_data] : request.raw_post
|
106
109
|
|
107
110
|
product_type = ProductType.find(params[:product_type_id])
|
@@ -124,110 +127,9 @@ module ErpProducts
|
|
124
127
|
render :json => (FileAsset.find(params[:id]).destroy) ? {:success => true} : {:success => false}
|
125
128
|
end
|
126
129
|
|
127
|
-
#
|
128
|
-
#Prices
|
129
|
-
#
|
130
|
-
|
131
|
-
def currencies
|
132
|
-
Currency.include_root_in_json = false
|
133
|
-
render :inline => "{currencies:#{Currency.all.to_json(:only => [:id, :internal_identifier])}}"
|
134
|
-
end
|
135
|
-
|
136
|
-
def prices
|
137
|
-
result = {:prices => []}
|
138
|
-
|
139
|
-
product_type = ProductType.find(params[:id])
|
140
|
-
product_type.pricing_plans.each do |pricing_plan|
|
141
|
-
result[:prices] << {
|
142
|
-
:pricing_plan_id => pricing_plan.id,
|
143
|
-
:price => pricing_plan.money_amount,
|
144
|
-
:currency => pricing_plan.currency.id,
|
145
|
-
:currency_display => pricing_plan.currency.internal_identifier,
|
146
|
-
:from_date => pricing_plan.from_date,
|
147
|
-
:thru_date => pricing_plan.thru_date,
|
148
|
-
:description => pricing_plan.description,
|
149
|
-
:comments => pricing_plan.comments
|
150
|
-
}
|
151
|
-
end
|
152
|
-
|
153
|
-
render :json => result
|
154
|
-
end
|
155
|
-
|
156
|
-
|
157
|
-
#pricing uses one form for new models and updates. So we use one action
|
158
|
-
def new_and_update_price
|
159
|
-
result = {}
|
160
|
-
|
161
|
-
if params[:pricing_plan_id].blank?
|
162
|
-
pricing_plan = PricingPlan.new(
|
163
|
-
:money_amount => params[:price],
|
164
|
-
:comments => params[:comments],
|
165
|
-
:currency => Currency.find(params[:currency]),
|
166
|
-
:from_date => Date.strptime(params[:from_date], '%m/%d/%Y').to_date,
|
167
|
-
:thru_date => Date.strptime(params[:thru_date], '%m/%d/%Y').to_date,
|
168
|
-
:description => params[:description],
|
169
|
-
:is_simple_amount => true
|
170
|
-
)
|
171
|
-
|
172
|
-
if pricing_plan.save
|
173
|
-
product_type = ProductType.find(params[:product_type_id])
|
174
|
-
product_type.pricing_plans << pricing_plan
|
175
|
-
if product_type.save
|
176
|
-
result[:success] = true
|
177
|
-
else
|
178
|
-
pricing_plan.destroy
|
179
|
-
result[:success] = false
|
180
|
-
end
|
181
|
-
else
|
182
|
-
result[:success] = false
|
183
|
-
end
|
184
|
-
else
|
185
|
-
pricing_plan = PricingPlan.find(params[:pricing_plan_id])
|
186
|
-
pricing_plan.money_amount = params[:price]
|
187
|
-
pricing_plan.currency = Currency.find(params[:currency])
|
188
|
-
pricing_plan.from_date = Date.strptime(params[:from_date], '%m/%d/%Y').to_date
|
189
|
-
pricing_plan.thru_date = Date.strptime(params[:thru_date], '%m/%d/%Y').to_date
|
190
|
-
pricing_plan.description = params[:description]
|
191
|
-
pricing_plan.comments = params[:comments]
|
192
|
-
|
193
|
-
if pricing_plan.save
|
194
|
-
result[:success] = true
|
195
|
-
else
|
196
|
-
result[:success] = false
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
render :json => result
|
201
|
-
end
|
202
|
-
|
203
|
-
def delete_price
|
204
|
-
render :json => (PricingPlan.find(params[:id]).destroy) ? {:success => true} : {:success => false}
|
205
|
-
end
|
206
|
-
|
207
|
-
#
|
208
|
-
#Inventory
|
209
|
-
#
|
210
|
-
|
211
|
-
def inventory
|
212
|
-
result = {}
|
213
|
-
|
214
|
-
inventory_entry = InventoryEntry.find_by_product_type_id(params[:id])
|
215
|
-
result[:number_available] = inventory_entry.number_available
|
216
|
-
result[:sku] = inventory_entry.sku
|
217
|
-
|
218
|
-
render :json => result
|
219
|
-
end
|
220
|
-
|
221
|
-
def update_inventory
|
222
|
-
inventory_entry = InventoryEntry.find_by_product_type_id(params[:product_type_id])
|
223
|
-
inventory_entry.sku = params[:sku]
|
224
|
-
inventory_entry.number_available = params[:number_available]
|
225
|
-
|
226
|
-
render :json => (inventory_entry.save) ? {:success => true} : {:success => false}
|
227
|
-
end
|
228
130
|
|
229
|
-
end
|
230
|
-
end
|
231
|
-
end
|
232
|
-
end
|
233
|
-
end
|
131
|
+
end#BaseController
|
132
|
+
end#ProductManager
|
133
|
+
end#Desktop
|
134
|
+
end#ErpApp
|
135
|
+
end#ErpProducts
|
data/app/models/product_type.rb
CHANGED
data/lib/erp_products/version.rb
CHANGED
@@ -36,6 +36,9 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager",{
|
|
36
36
|
}
|
37
37
|
});
|
38
38
|
|
39
|
+
Compass.ErpApp.Desktop.Applications.ProductManager.widgets = [];
|
40
|
+
Compass.ErpApp.Desktop.Applications.ProductManager.selectedProductTypeId = null;
|
41
|
+
|
39
42
|
//
|
40
43
|
//form to manage description and title
|
41
44
|
//
|
@@ -44,7 +47,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.ProductDescriptio
|
|
44
47
|
extend:"Ext.form.Panel",
|
45
48
|
alias:'widget.productmanager_productdescriptionform',
|
46
49
|
initComponent: function() {
|
47
|
-
|
50
|
+
this.callParent(arguments);
|
48
51
|
|
49
52
|
this.addEvents(
|
50
53
|
/**
|
@@ -136,338 +139,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.ProductDescriptio
|
|
136
139
|
]
|
137
140
|
}, config);
|
138
141
|
|
139
|
-
|
140
|
-
}
|
141
|
-
});
|
142
|
-
|
143
|
-
//
|
144
|
-
//form to manage pricing
|
145
|
-
//
|
146
|
-
|
147
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.ProductPricingPanel",{
|
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();
|
171
|
-
}
|
172
|
-
else{
|
173
|
-
Ext.Msg.alert('Error', 'Error deleting price.');
|
174
|
-
}
|
175
|
-
},
|
176
|
-
failure: function(response) {
|
177
|
-
Ext.Msg.alert('Error', 'Error deleting price.');
|
178
|
-
}
|
179
|
-
});
|
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();
|
316
|
-
}
|
317
|
-
else{
|
318
|
-
Ext.Msg.alert("Error", 'Error creating price');
|
319
|
-
}
|
320
|
-
},
|
321
|
-
failure:function(form, action){
|
322
|
-
Ext.Msg.alert("Error", 'Error creating price');
|
323
|
-
}
|
324
|
-
});
|
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,
|
375
|
-
layout:'anchor',
|
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);
|
142
|
+
this.callParent([config]);
|
471
143
|
}
|
472
144
|
});
|
473
145
|
|
@@ -588,74 +260,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.ProductImagesPane
|
|
588
260
|
}
|
589
261
|
}, config);
|
590
262
|
|
591
|
-
|
592
|
-
}
|
593
|
-
});
|
594
|
-
|
595
|
-
//
|
596
|
-
//Inventory Management
|
597
|
-
//
|
598
|
-
|
599
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.InventoryFormPanel",{
|
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
|
-
}
|
648
|
-
},
|
649
|
-
failure:function(form, action){
|
650
|
-
Ext.Msg.alert("Error", 'Error creating price');
|
651
|
-
}
|
652
|
-
});
|
653
|
-
}
|
654
|
-
}
|
655
|
-
]
|
656
|
-
}, config);
|
657
|
-
|
658
|
-
Compass.ErpApp.Desktop.Applications.ProductManager.InventoryFormPanel.superclass.constructor.call(this, config);
|
263
|
+
this.callParent([config]);
|
659
264
|
}
|
660
265
|
});
|
661
266
|
|
@@ -666,9 +271,6 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.InventoryFormPane
|
|
666
271
|
Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.AddProductWindow",{
|
667
272
|
extend:"Ext.window.Window",
|
668
273
|
alias:'widget.productmanager_addproductwindow',
|
669
|
-
initComponent: function() {
|
670
|
-
Compass.ErpApp.Desktop.Applications.ProductManager.AddProductWindow.superclass.initComponent.call(this, arguments);
|
671
|
-
},
|
672
274
|
|
673
275
|
constructor : function(config) {
|
674
276
|
var self = this;
|
@@ -695,7 +297,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.AddProductWindow"
|
|
695
297
|
}
|
696
298
|
}, config);
|
697
299
|
|
698
|
-
|
300
|
+
this.callParent([config]);
|
699
301
|
}
|
700
302
|
});
|
701
303
|
|
@@ -706,13 +308,10 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.AddProductWindow"
|
|
706
308
|
Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.UpdateProductWindow",{
|
707
309
|
extend:"Ext.window.Window",
|
708
310
|
alias:'widget.productmanager_updateproductwindow',
|
709
|
-
initComponent: function() {
|
710
|
-
Compass.ErpApp.Desktop.Applications.ProductManager.UpdateProductWindow.superclass.initComponent.call(this, arguments);
|
711
|
-
},
|
712
|
-
|
713
311
|
constructor : function(config) {
|
714
312
|
var self = this;
|
715
313
|
var activeTab = config['activeTab'] | 0
|
314
|
+
Compass.ErpApp.Desktop.Applications.ProductManager.selectedProductTypeId = config.productTypeId;
|
716
315
|
|
717
316
|
var tabLayout = {
|
718
317
|
xtype:'tabpanel',
|
@@ -748,29 +347,6 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.UpdateProductWind
|
|
748
347
|
{
|
749
348
|
xtype:'productmanager_productimagespanel',
|
750
349
|
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
350
|
}
|
775
351
|
]
|
776
352
|
}
|
@@ -784,11 +360,17 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.UpdateProductWind
|
|
784
360
|
items:[tabLayout],
|
785
361
|
listeners:{
|
786
362
|
show:function(comp){
|
787
|
-
comp.
|
363
|
+
var tabPanel = comp.down('tabpanel');
|
364
|
+
|
365
|
+
Ext.each(Compass.ErpApp.Desktop.Applications.ProductManager.widgets,function(widget){
|
366
|
+
tabPanel.add(widget);
|
367
|
+
});
|
368
|
+
|
369
|
+
tabPanel.setActiveTab(activeTab);
|
788
370
|
}
|
789
371
|
}
|
790
372
|
}, config);
|
791
373
|
|
792
|
-
|
374
|
+
this.callParent([config]);
|
793
375
|
}
|
794
376
|
});
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: erp_products
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,41 +9,30 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: erp_app
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153107000 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.0
|
21
|
+
version: '3.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: erp_agreements
|
27
|
-
requirement: &70706130 !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
|
-
requirements:
|
30
|
-
- - =
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 3.0.1
|
33
|
-
type: :runtime
|
34
|
-
prerelease: false
|
35
|
-
version_requirements: *70706130
|
24
|
+
version_requirements: *2153107000
|
36
25
|
- !ruby/object:Gem::Dependency
|
37
26
|
name: erp_dev_svcs
|
38
|
-
requirement: &
|
27
|
+
requirement: &2153106500 !ruby/object:Gem::Requirement
|
39
28
|
none: false
|
40
29
|
requirements:
|
41
|
-
- -
|
30
|
+
- - ~>
|
42
31
|
- !ruby/object:Gem::Version
|
43
|
-
version: 3.0
|
32
|
+
version: '3.0'
|
44
33
|
type: :development
|
45
34
|
prerelease: false
|
46
|
-
version_requirements: *
|
35
|
+
version_requirements: *2153106500
|
47
36
|
description: ! 'The Products Engine implements ProductType and ProductInstance, as
|
48
37
|
well as a number of classes to support product catalog-type functions and search/shopping
|
49
38
|
scenarios. '
|
@@ -53,81 +42,80 @@ executables: []
|
|
53
42
|
extensions: []
|
54
43
|
extra_rdoc_files: []
|
55
44
|
files:
|
56
|
-
- public/stylesheets/erp_app/desktop/applications/product_manager/style.css
|
57
|
-
- public/javascripts/erp_app/desktop/applications/product_manager/product_list_panel.js
|
58
45
|
- public/javascripts/erp_app/desktop/applications/product_manager/module.js
|
59
|
-
-
|
46
|
+
- public/javascripts/erp_app/desktop/applications/product_manager/product_list_panel.js
|
47
|
+
- public/stylesheets/erp_app/desktop/applications/product_manager/style.css
|
60
48
|
- app/assets/javascripts/erp_products/application.js
|
61
|
-
- app/
|
62
|
-
- app/
|
49
|
+
- app/assets/stylesheets/erp_products/application.css
|
50
|
+
- app/controllers/erp_products/erp_app/desktop/product_manager/base_controller.rb
|
51
|
+
- app/helpers/erp_products/application_helper.rb
|
63
52
|
- app/models/prod_availability_status_type.rb
|
53
|
+
- app/models/prod_instance_reln.rb
|
54
|
+
- app/models/prod_instance_reln_type.rb
|
64
55
|
- app/models/prod_instance_role_type.rb
|
65
56
|
- app/models/prod_type_reln.rb
|
66
|
-
- app/models/product_type.rb
|
67
|
-
- app/models/product_offer.rb
|
68
|
-
- app/models/simple_product_offer.rb
|
69
|
-
- app/models/prod_instance_reln_type.rb
|
70
|
-
- app/models/prod_instance_reln.rb
|
71
|
-
- app/models/prod_type_role_type.rb
|
72
57
|
- app/models/prod_type_reln_type.rb
|
58
|
+
- app/models/prod_type_role_type.rb
|
73
59
|
- app/models/product_instance.rb
|
74
|
-
- app/
|
75
|
-
- app/
|
60
|
+
- app/models/product_offer.rb
|
61
|
+
- app/models/product_package.rb
|
62
|
+
- app/models/product_type.rb
|
63
|
+
- app/models/simple_product_offer.rb
|
76
64
|
- config/routes.rb
|
77
|
-
- db/
|
78
|
-
- db/migrate/20080805000041_base_products_indexes.rb
|
65
|
+
- db/data_migrations/20110324010232_product_role_types.rb
|
79
66
|
- db/data_migrations/20110527160807_add_default_prod_avail_types.rb
|
80
67
|
- db/data_migrations/20110728201730_create_desktop_app_product_manager.rb
|
81
|
-
- db/
|
68
|
+
- db/migrate/20080805000040_base_products.rb
|
69
|
+
- db/migrate/20080805000041_base_products_indexes.rb
|
82
70
|
- lib/erp_products/engine.rb
|
83
|
-
- lib/erp_products/extensions.rb
|
84
|
-
- lib/erp_products/extensions/active_record/acts_as_product_type.rb
|
85
|
-
- lib/erp_products/extensions/active_record/acts_as_product_offer.rb
|
86
71
|
- lib/erp_products/extensions/active_record/acts_as_product_instance.rb
|
72
|
+
- lib/erp_products/extensions/active_record/acts_as_product_offer.rb
|
73
|
+
- lib/erp_products/extensions/active_record/acts_as_product_type.rb
|
74
|
+
- lib/erp_products/extensions.rb
|
87
75
|
- lib/erp_products/version.rb
|
88
76
|
- lib/erp_products.rb
|
89
77
|
- lib/tasks/erp_products_tasks.rake
|
90
78
|
- GPL-3-LICENSE
|
91
79
|
- Rakefile
|
92
80
|
- README.rdoc
|
93
|
-
- spec/spec_helper.rb
|
94
|
-
- spec/models/prod_type_role_type_spec.rb
|
95
|
-
- spec/models/prod_type_reln_spec.rb
|
96
|
-
- spec/models/product_package_spec.rb
|
97
|
-
- spec/models/prod_instance_reln_type_spec.rb
|
98
|
-
- spec/models/prod_instance_role_type_spec.rb
|
99
|
-
- spec/models/simple_product_offer_spec.rb
|
100
|
-
- spec/models/prod_type_reln_type_spec.rb
|
101
|
-
- spec/models/product_instance_spec.rb
|
102
|
-
- spec/models/prod_instance_reln_spec.rb
|
103
|
-
- spec/models/prod_availability_status_type_spec.rb
|
104
|
-
- spec/models/product_offer_spec.rb
|
105
|
-
- spec/models/product_type_spec.rb
|
106
|
-
- spec/dummy/public/422.html
|
107
|
-
- spec/dummy/public/404.html
|
108
|
-
- spec/dummy/public/500.html
|
109
|
-
- spec/dummy/public/favicon.ico
|
110
|
-
- spec/dummy/config.ru
|
111
|
-
- spec/dummy/app/assets/stylesheets/application.css
|
112
81
|
- spec/dummy/app/assets/javascripts/application.js
|
113
|
-
- spec/dummy/app/
|
114
|
-
- spec/dummy/app/helpers/application_helper.rb
|
82
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
115
83
|
- spec/dummy/app/controllers/application_controller.rb
|
116
|
-
- spec/dummy/
|
117
|
-
- spec/dummy/
|
118
|
-
- spec/dummy/config/boot.rb
|
84
|
+
- spec/dummy/app/helpers/application_helper.rb
|
85
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
119
86
|
- spec/dummy/config/application.rb
|
87
|
+
- spec/dummy/config/boot.rb
|
88
|
+
- spec/dummy/config/database.yml
|
89
|
+
- spec/dummy/config/environment.rb
|
120
90
|
- spec/dummy/config/environments/spec.rb
|
121
|
-
- spec/dummy/config/initializers/mime_types.rb
|
122
|
-
- spec/dummy/config/initializers/session_store.rb
|
123
91
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
124
|
-
- spec/dummy/config/initializers/wrap_parameters.rb
|
125
92
|
- spec/dummy/config/initializers/inflections.rb
|
93
|
+
- spec/dummy/config/initializers/mime_types.rb
|
126
94
|
- spec/dummy/config/initializers/secret_token.rb
|
127
|
-
- spec/dummy/config/
|
128
|
-
- spec/dummy/config/
|
95
|
+
- spec/dummy/config/initializers/session_store.rb
|
96
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
97
|
+
- spec/dummy/config/locales/en.yml
|
98
|
+
- spec/dummy/config/routes.rb
|
99
|
+
- spec/dummy/config.ru
|
100
|
+
- spec/dummy/public/404.html
|
101
|
+
- spec/dummy/public/422.html
|
102
|
+
- spec/dummy/public/500.html
|
103
|
+
- spec/dummy/public/favicon.ico
|
129
104
|
- spec/dummy/Rakefile
|
130
105
|
- spec/dummy/script/rails
|
106
|
+
- spec/models/prod_availability_status_type_spec.rb
|
107
|
+
- spec/models/prod_instance_reln_spec.rb
|
108
|
+
- spec/models/prod_instance_reln_type_spec.rb
|
109
|
+
- spec/models/prod_instance_role_type_spec.rb
|
110
|
+
- spec/models/prod_type_reln_spec.rb
|
111
|
+
- spec/models/prod_type_reln_type_spec.rb
|
112
|
+
- spec/models/prod_type_role_type_spec.rb
|
113
|
+
- spec/models/product_instance_spec.rb
|
114
|
+
- spec/models/product_offer_spec.rb
|
115
|
+
- spec/models/product_package_spec.rb
|
116
|
+
- spec/models/product_type_spec.rb
|
117
|
+
- spec/models/simple_product_offer_spec.rb
|
118
|
+
- spec/spec_helper.rb
|
131
119
|
homepage: http://development.compassagile.com
|
132
120
|
licenses: []
|
133
121
|
post_install_message:
|
@@ -148,48 +136,48 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
136
|
version: '0'
|
149
137
|
requirements: []
|
150
138
|
rubyforge_project:
|
151
|
-
rubygems_version: 1.8.
|
139
|
+
rubygems_version: 1.8.15
|
152
140
|
signing_key:
|
153
141
|
specification_version: 3
|
154
142
|
summary: The Products Engine implements ProductType and ProductInstance, as well as
|
155
143
|
a number of classes to support product catalog-type functions and search/shopping
|
156
144
|
scenarios.
|
157
145
|
test_files:
|
158
|
-
- spec/spec_helper.rb
|
159
|
-
- spec/models/prod_type_role_type_spec.rb
|
160
|
-
- spec/models/prod_type_reln_spec.rb
|
161
|
-
- spec/models/product_package_spec.rb
|
162
|
-
- spec/models/prod_instance_reln_type_spec.rb
|
163
|
-
- spec/models/prod_instance_role_type_spec.rb
|
164
|
-
- spec/models/simple_product_offer_spec.rb
|
165
|
-
- spec/models/prod_type_reln_type_spec.rb
|
166
|
-
- spec/models/product_instance_spec.rb
|
167
|
-
- spec/models/prod_instance_reln_spec.rb
|
168
|
-
- spec/models/prod_availability_status_type_spec.rb
|
169
|
-
- spec/models/product_offer_spec.rb
|
170
|
-
- spec/models/product_type_spec.rb
|
171
|
-
- spec/dummy/public/422.html
|
172
|
-
- spec/dummy/public/404.html
|
173
|
-
- spec/dummy/public/500.html
|
174
|
-
- spec/dummy/public/favicon.ico
|
175
|
-
- spec/dummy/config.ru
|
176
|
-
- spec/dummy/app/assets/stylesheets/application.css
|
177
146
|
- spec/dummy/app/assets/javascripts/application.js
|
178
|
-
- spec/dummy/app/
|
179
|
-
- spec/dummy/app/helpers/application_helper.rb
|
147
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
180
148
|
- spec/dummy/app/controllers/application_controller.rb
|
181
|
-
- spec/dummy/
|
182
|
-
- spec/dummy/
|
183
|
-
- spec/dummy/config/boot.rb
|
149
|
+
- spec/dummy/app/helpers/application_helper.rb
|
150
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
184
151
|
- spec/dummy/config/application.rb
|
152
|
+
- spec/dummy/config/boot.rb
|
153
|
+
- spec/dummy/config/database.yml
|
154
|
+
- spec/dummy/config/environment.rb
|
185
155
|
- spec/dummy/config/environments/spec.rb
|
186
|
-
- spec/dummy/config/initializers/mime_types.rb
|
187
|
-
- spec/dummy/config/initializers/session_store.rb
|
188
156
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
189
|
-
- spec/dummy/config/initializers/wrap_parameters.rb
|
190
157
|
- spec/dummy/config/initializers/inflections.rb
|
158
|
+
- spec/dummy/config/initializers/mime_types.rb
|
191
159
|
- spec/dummy/config/initializers/secret_token.rb
|
192
|
-
- spec/dummy/config/
|
193
|
-
- spec/dummy/config/
|
160
|
+
- spec/dummy/config/initializers/session_store.rb
|
161
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
162
|
+
- spec/dummy/config/locales/en.yml
|
163
|
+
- spec/dummy/config/routes.rb
|
164
|
+
- spec/dummy/config.ru
|
165
|
+
- spec/dummy/public/404.html
|
166
|
+
- spec/dummy/public/422.html
|
167
|
+
- spec/dummy/public/500.html
|
168
|
+
- spec/dummy/public/favicon.ico
|
194
169
|
- spec/dummy/Rakefile
|
195
170
|
- spec/dummy/script/rails
|
171
|
+
- spec/models/prod_availability_status_type_spec.rb
|
172
|
+
- spec/models/prod_instance_reln_spec.rb
|
173
|
+
- spec/models/prod_instance_reln_type_spec.rb
|
174
|
+
- spec/models/prod_instance_role_type_spec.rb
|
175
|
+
- spec/models/prod_type_reln_spec.rb
|
176
|
+
- spec/models/prod_type_reln_type_spec.rb
|
177
|
+
- spec/models/prod_type_role_type_spec.rb
|
178
|
+
- spec/models/product_instance_spec.rb
|
179
|
+
- spec/models/product_offer_spec.rb
|
180
|
+
- spec/models/product_package_spec.rb
|
181
|
+
- spec/models/product_type_spec.rb
|
182
|
+
- spec/models/simple_product_offer_spec.rb
|
183
|
+
- spec/spec_helper.rb
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>ErpProducts</title>
|
5
|
-
<%= stylesheet_link_tag "erp_products/application" %>
|
6
|
-
<%= javascript_include_tag "erp_products/application" %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<%= yield %>
|
12
|
-
|
13
|
-
</body>
|
14
|
-
</html>
|