erp_products 3.1.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/controllers/erp_products/shared/product_types_controller.rb +96 -0
- data/app/models/product_type.rb +15 -0
- data/app/models/product_type_pty_role.rb +5 -0
- data/app/views/erp_products/shared/product_types/show_details.html.erb +8 -0
- data/config/routes.rb +5 -0
- data/db/data_migrations/20140130204915_add_vendor_consumer_product_roles_to_role_type.rb +20 -0
- data/db/migrate/20130131204336_add_type_column_to_product_types.rb +9 -0
- data/db/migrate/20140124185720_add_product_party_roles.rb +17 -0
- data/db/migrate/20140130211433_add_sku_comment_uom_to_product_type.rb +7 -0
- data/lib/erp_products/engine.rb +1 -1
- data/lib/erp_products/extensions/active_record/acts_as_product_instance.rb +17 -5
- data/lib/erp_products/version.rb +7 -3
- metadata +33 -133
- data/app/assets/javascripts/erp_products/application.js +0 -9
- data/app/assets/stylesheets/erp_products/application.css +0 -7
- data/app/controllers/erp_products/erp_app/desktop/product_manager/base_controller.rb +0 -135
- data/app/helpers/erp_products/application_helper.rb +0 -4
- data/db/data_migrations/20110728201730_create_desktop_app_product_manager.rb +0 -25
- data/public/javascripts/erp_app/desktop/applications/product_manager/module.js +0 -374
- data/public/javascripts/erp_app/desktop/applications/product_manager/product_list_panel.js +0 -140
- data/public/stylesheets/erp_app/desktop/applications/product_manager/style.css +0 -71
- data/spec/dummy/db/data_migrations/20101011152441_payment_gateway_actions.erp_commerce.rb +0 -28
- data/spec/dummy/db/data_migrations/20101014142230_financial_txn_types.erp_txns_and_accts.rb +0 -16
- data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb +0 -15
- data/spec/dummy/db/data_migrations/20110324010232_product_role_types.erp_products.rb +0 -24
- data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +0 -12
- data/spec/dummy/db/data_migrations/20110527160807_add_default_prod_avail_types.erp_products.rb +0 -27
- data/spec/dummy/db/data_migrations/20110605231556_create_order_party_roles.erp_orders.rb +0 -24
- data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +0 -19
- data/spec/dummy/db/data_migrations/20110728201729_erp_app_setup.erp_app.rb +0 -252
- data/spec/dummy/db/data_migrations/20110728201730_create_desktop_app_product_manager.erp_products.rb +0 -26
- data/spec/dummy/db/data_migrations/20110728201731_create_desktop_app_order_manager.erp_orders.rb +0 -26
- data/spec/dummy/db/data_migrations/20110728201732_create_organizer_app_order_management.erp_orders.rb +0 -15
- data/spec/dummy/db/data_migrations/20110728201733_update_preferences.erp_app.rb +0 -53
- data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +0 -16
- data/spec/dummy/db/data_migrations/20110816161238_create_desktop_app_audit_log_viewer.erp_app.rb +0 -21
- data/spec/dummy/db/data_migrations/20110817160743_add_file_manager_application.erp_app.rb +0 -32
- data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +0 -12
- data/spec/dummy/db/data_migrations/20111108183739_add_default_capabilities.erp_app.rb +0 -23
- data/spec/dummy/db/data_migrations/20111108183740_add_new_contact_widgets.erp_app.rb +0 -42
- data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +0 -22
- data/spec/dummy/db/data_migrations/20120109173616_create_download_capability_type.erp_tech_svcs.rb +0 -14
- data/spec/dummy/db/data_migrations/20120229160222_add_userinfo_widget.erp_app.rb +0 -29
- data/spec/dummy/db/data_migrations/20120229174343_add_orders_widget.erp_orders.rb +0 -29
- data/spec/dummy/db/data_migrations/20120405193721_create_party_and_role_type_for_communication_events.erp_app.rb +0 -11
- data/spec/dummy/db/data_migrations/20120411180756_create_user_management_mobile_application.erp_app.rb +0 -19
- data/spec/dummy/db/data_migrations/20120418164215_create_configuration_management_desktop_application.erp_app.rb +0 -23
- data/spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb +0 -20
- data/spec/dummy/db/data_migrations/20121130201859_upgrade_remove_system_mgmt_app.erp_app.rb +0 -16
- data/spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb +0 -24
- data/spec/dummy/db/data_migrations/20121218175028_create_security_management_desktop_application.erp_app.rb +0 -23
- data/spec/dummy/db/migrate/20130107214711_base_erp_services.erp_base_erp_svcs.rb +0 -461
- data/spec/dummy/db/migrate/20130107214712_base_products.erp_products.rb +0 -234
- data/spec/dummy/db/migrate/20130107214713_base_products_indexes.erp_products.rb +0 -59
- data/spec/dummy/db/migrate/20130107214714_base_tech_services.erp_tech_svcs.rb +0 -271
- data/spec/dummy/db/migrate/20130107214715_create_has_attribute_tables.erp_tech_svcs.rb +0 -39
- data/spec/dummy/db/migrate/20130107214716_create_groups.erp_tech_svcs.rb +0 -19
- data/spec/dummy/db/migrate/20130107214717_upgrade_security.erp_tech_svcs.rb +0 -54
- data/spec/dummy/db/migrate/20130107214718_upgrade_security2.erp_tech_svcs.rb +0 -270
- data/spec/dummy/db/migrate/20130107214719_base_orders.erp_orders.rb +0 -178
- data/spec/dummy/db/migrate/20130107214720_base_txns_and_accts.erp_txns_and_accts.rb +0 -364
- data/spec/dummy/db/migrate/20130107214721_agreements_services.erp_agreements.rb +0 -160
- data/spec/dummy/db/migrate/20130107214722_agreements_services_indexes.erp_agreements.rb +0 -52
- data/spec/dummy/db/migrate/20130107214723_base_app_framework.erp_app.rb +0 -276
- data/spec/dummy/db/migrate/20130107214724_erp_commerce_base.erp_commerce.rb +0 -442
- data/spec/dummy/db/schema.rb +0 -1821
- data/spec/dummy/db/spec.sqlite3 +0 -0
- data/spec/dummy/log/spec.log +0 -12388
@@ -1,9 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
-
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
-
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
-
// the compiled file.
|
6
|
-
//
|
7
|
-
//= require jquery
|
8
|
-
//= require jquery_ujs
|
9
|
-
//= require_tree .
|
@@ -1,7 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
-
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
-
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
-
*= require_self
|
6
|
-
*= require_tree .
|
7
|
-
*/
|
@@ -1,135 +0,0 @@
|
|
1
|
-
module ErpProducts
|
2
|
-
module ErpApp
|
3
|
-
module Desktop
|
4
|
-
module ProductManager
|
5
|
-
class BaseController < ::ErpApp::Desktop::BaseController
|
6
|
-
|
7
|
-
def index
|
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
|
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
|
41
|
-
render :json => {:products => products}
|
42
|
-
end
|
43
|
-
|
44
|
-
def show
|
45
|
-
ProductType.class_eval do
|
46
|
-
def long_description
|
47
|
-
self.descriptions.find_by_internal_identifier('long_description').description
|
48
|
-
end
|
49
|
-
end
|
50
|
-
product_type = ProductType.find(params[:id])
|
51
|
-
render :json => {:id => product_type.id, :description => product_type.long_description, :title => product_type.description}
|
52
|
-
end
|
53
|
-
|
54
|
-
def update
|
55
|
-
product_type = ProductType.find(params[:id])
|
56
|
-
product_type.description = params[:title]
|
57
|
-
descriptive_asset = product_type.find_description_by_iid('long_description')
|
58
|
-
descriptive_asset.description = params[:description]
|
59
|
-
descriptive_asset.save
|
60
|
-
|
61
|
-
render :json => product_type.save ? {:success => true} : {:success => false}
|
62
|
-
end
|
63
|
-
|
64
|
-
def new
|
65
|
-
title = params[:title]
|
66
|
-
description = params[:description]
|
67
|
-
|
68
|
-
product_type = ProductType.new(
|
69
|
-
:description => title
|
70
|
-
)
|
71
|
-
|
72
|
-
product_type.descriptions << DescriptiveAsset.create(
|
73
|
-
:description => description,
|
74
|
-
:internal_identifier => 'long_description'
|
75
|
-
)
|
76
|
-
|
77
|
-
if product_type.save
|
78
|
-
render :json => {:success => true, :id => product_type.id}
|
79
|
-
else
|
80
|
-
render :json => {:success => false}
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def delete
|
85
|
-
render :json => (ProductType.find(params[:id]).destroy) ? {:success => true} : {:success => false}
|
86
|
-
end
|
87
|
-
|
88
|
-
#
|
89
|
-
#Images
|
90
|
-
#
|
91
|
-
|
92
|
-
def images
|
93
|
-
data = {:images => []}
|
94
|
-
product_type = ProductType.find(params[:id])
|
95
|
-
|
96
|
-
product_type.images.each do |image|
|
97
|
-
data[:images] << {:id => image.id, :name => image.name, :shortName => image.name, :url => image.data.url}
|
98
|
-
end
|
99
|
-
|
100
|
-
render :json => data
|
101
|
-
end
|
102
|
-
|
103
|
-
def new_image
|
104
|
-
result = {}
|
105
|
-
|
106
|
-
begin
|
107
|
-
name = params[:name]
|
108
|
-
data = request.raw_post
|
109
|
-
|
110
|
-
product_type = ProductType.find(params[:product_type_id])
|
111
|
-
#build path
|
112
|
-
path = File.join(product_type.images_path,name)
|
113
|
-
Rails.logger.info "@@@@@@@@ #{path}"
|
114
|
-
product_type.add_file(data, path)
|
115
|
-
result = {:success => true}
|
116
|
-
rescue Exception=>ex
|
117
|
-
Rails.logger.error ex.message
|
118
|
-
Rails.logger.error ex.backtrace.join("\n")
|
119
|
-
result = {:success => false, :error => "Error uploading #{name}"}
|
120
|
-
end
|
121
|
-
|
122
|
-
#file uploader wants this inline
|
123
|
-
render :inline => result.to_json
|
124
|
-
end
|
125
|
-
|
126
|
-
def delete_image
|
127
|
-
render :json => (FileAsset.find(params[:id]).destroy) ? {:success => true} : {:success => false}
|
128
|
-
end
|
129
|
-
|
130
|
-
|
131
|
-
end#BaseController
|
132
|
-
end#ProductManager
|
133
|
-
end#Desktop
|
134
|
-
end#ErpApp
|
135
|
-
end#ErpProducts
|
@@ -1,25 +0,0 @@
|
|
1
|
-
class CreateDesktopAppProductManager
|
2
|
-
def self.up
|
3
|
-
app = DesktopApplication.create(
|
4
|
-
:description => 'Products',
|
5
|
-
:icon => 'icon-product',
|
6
|
-
:javascript_class_name => 'Compass.ErpApp.Desktop.Applications.ProductManager',
|
7
|
-
:internal_identifier => 'product_manager',
|
8
|
-
:shortcut_id => 'product_manager-win'
|
9
|
-
)
|
10
|
-
|
11
|
-
pt1 = PreferenceType.iid('desktop_shortcut')
|
12
|
-
pt1.preferenced_records << app
|
13
|
-
pt1.save
|
14
|
-
|
15
|
-
pt2 = PreferenceType.iid('autoload_application')
|
16
|
-
pt2.preferenced_records << app
|
17
|
-
pt2.save
|
18
|
-
|
19
|
-
app.save
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.down
|
23
|
-
DesktopApplication.destroy_all(:conditions => ['internal_identifier = ?','hello_world'])
|
24
|
-
end
|
25
|
-
end
|
@@ -1,374 +0,0 @@
|
|
1
|
-
//
|
2
|
-
//module
|
3
|
-
//
|
4
|
-
|
5
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager",{
|
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
|
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
|
-
}
|
37
|
-
});
|
38
|
-
|
39
|
-
Compass.ErpApp.Desktop.Applications.ProductManager.widgets = [];
|
40
|
-
Compass.ErpApp.Desktop.Applications.ProductManager.selectedProductTypeId = null;
|
41
|
-
|
42
|
-
//
|
43
|
-
//form to manage description and title
|
44
|
-
//
|
45
|
-
|
46
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.ProductDescriptionForm",{
|
47
|
-
extend:"Ext.form.Panel",
|
48
|
-
alias:'widget.productmanager_productdescriptionform',
|
49
|
-
initComponent: function() {
|
50
|
-
this.callParent(arguments);
|
51
|
-
|
52
|
-
this.addEvents(
|
53
|
-
/**
|
54
|
-
* @event saved
|
55
|
-
* Fired after form is saved.
|
56
|
-
* @param {Compass.ErpApp.Desktop.Applications.ProductManager.ProductDescriptionForm} form this object
|
57
|
-
* @param {integer} Newly create id
|
58
|
-
*/
|
59
|
-
'saved'
|
60
|
-
);
|
61
|
-
},
|
62
|
-
|
63
|
-
constructor : function(config) {
|
64
|
-
var self = this;
|
65
|
-
config = Ext.apply({
|
66
|
-
buttonAlign:'center',
|
67
|
-
bodyStyle:'padding:5px 5px 0',
|
68
|
-
items: [
|
69
|
-
{
|
70
|
-
fieldLabel:'Title',
|
71
|
-
xtype:'textfield',
|
72
|
-
allowBlank:false,
|
73
|
-
width:500,
|
74
|
-
name:'title'
|
75
|
-
|
76
|
-
},
|
77
|
-
{
|
78
|
-
xtype : 'label',
|
79
|
-
html : 'Describe your product:',
|
80
|
-
cls : "x-form-item x-form-item-label card-label"
|
81
|
-
},
|
82
|
-
{
|
83
|
-
xtype: 'ckeditor',
|
84
|
-
allowBlank:false,
|
85
|
-
autoHeight:true,
|
86
|
-
ckEditorConfig:{
|
87
|
-
height:'290px',
|
88
|
-
width:750,
|
89
|
-
extraPlugins:'jwplayer',
|
90
|
-
toolbar:[
|
91
|
-
['Source','-','CompassSave','Preview','Print','-','Templates',
|
92
|
-
'Cut','Copy','Paste','PasteText','PasteFromWord','Undo','Redo'],
|
93
|
-
['Find','Replace','SpellChecker', 'Scayt','-','SelectAll'],
|
94
|
-
['TextColor','BGColor'],
|
95
|
-
['Bold','Italic','Underline','Strike','-','Subscript','Superscript','-','RemoveFormat'],
|
96
|
-
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],
|
97
|
-
'/',
|
98
|
-
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl'],
|
99
|
-
['BidiLtr', 'BidiRtl' ],
|
100
|
-
['Link','Unlink','Anchor'],
|
101
|
-
['jwplayer','Flash','Table','HorizontalRule','SpecialChar','PageBreak',],
|
102
|
-
[ 'Styles','Format','Font','FontSize' ],
|
103
|
-
['Maximize', 'ShowBlocks','-','About']
|
104
|
-
]
|
105
|
-
}
|
106
|
-
},
|
107
|
-
{
|
108
|
-
xtype:'hidden',
|
109
|
-
name:'description'
|
110
|
-
}
|
111
|
-
],
|
112
|
-
buttons:[
|
113
|
-
{
|
114
|
-
text:'Save',
|
115
|
-
handler:function(btn){
|
116
|
-
var formPanel = btn.findParentByType('form');
|
117
|
-
var basicForm = formPanel.getForm();
|
118
|
-
|
119
|
-
//ckeditor does not post. Get the value and set to hidden field
|
120
|
-
var ckeditor = formPanel.query('ckeditor').first();
|
121
|
-
basicForm.findField('description').setValue(ckeditor.getValue());
|
122
|
-
|
123
|
-
basicForm.submit({
|
124
|
-
success:function(form, action){
|
125
|
-
var obj = Ext.decode(action.response.responseText);
|
126
|
-
if(obj.success){
|
127
|
-
self.fireEvent('saved', this, obj.id);
|
128
|
-
}
|
129
|
-
else{
|
130
|
-
Ext.Msg.alert("Error", 'Error creating product');
|
131
|
-
}
|
132
|
-
},
|
133
|
-
failure:function(form, action){
|
134
|
-
Ext.Msg.alert("Error", 'Error creating product');
|
135
|
-
}
|
136
|
-
});
|
137
|
-
}
|
138
|
-
}
|
139
|
-
]
|
140
|
-
}, config);
|
141
|
-
|
142
|
-
this.callParent([config]);
|
143
|
-
}
|
144
|
-
});
|
145
|
-
|
146
|
-
//
|
147
|
-
//Panel for product images
|
148
|
-
//
|
149
|
-
|
150
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.ProductImagesPanel",{
|
151
|
-
extend:"Ext.panel.Panel",
|
152
|
-
alias:'widget.productmanager_productimagespanel',
|
153
|
-
deleteImage : function(id){
|
154
|
-
var self = this;
|
155
|
-
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this image?', function(btn){
|
156
|
-
if(btn == 'no'){
|
157
|
-
return false;
|
158
|
-
}
|
159
|
-
else
|
160
|
-
{
|
161
|
-
Ext.Ajax.request({
|
162
|
-
url: '/erp_products/erp_app/desktop/product_manager/delete_image/'+id,
|
163
|
-
success: function(response) {
|
164
|
-
var obj = Ext.decode(response.responseText);
|
165
|
-
if(obj.success){
|
166
|
-
self.imageAssetsDataView.getStore().load();
|
167
|
-
}
|
168
|
-
else{
|
169
|
-
Ext.Msg.alert('Error', 'Error deleting image.');
|
170
|
-
}
|
171
|
-
},
|
172
|
-
failure: function(response) {
|
173
|
-
Ext.Msg.alert('Error', 'Error deleting image.');
|
174
|
-
}
|
175
|
-
});
|
176
|
-
}
|
177
|
-
});
|
178
|
-
},
|
179
|
-
|
180
|
-
constructor : function(config) {
|
181
|
-
var self = this;
|
182
|
-
var productTypeId = config.productTypeId;
|
183
|
-
var uploadUrl = '/erp_products/erp_app/desktop/product_manager/new_image'
|
184
|
-
|
185
|
-
this.imageAssetsDataView = Ext.create("Ext.view.View",{
|
186
|
-
autoDestroy:true,
|
187
|
-
itemSelector: 'div.thumb-wrap',
|
188
|
-
style:'overflow:auto',
|
189
|
-
store: Ext.create("Ext.data.Store",{
|
190
|
-
autoLoad: true,
|
191
|
-
proxy:{
|
192
|
-
type:'ajax',
|
193
|
-
url: '/erp_products/erp_app/desktop/product_manager/images/'+productTypeId,
|
194
|
-
reader:{
|
195
|
-
root: 'images',
|
196
|
-
type:'json'
|
197
|
-
}
|
198
|
-
},
|
199
|
-
fields:['name', 'url', 'shortName', 'id']
|
200
|
-
}),
|
201
|
-
tpl: new Ext.XTemplate(
|
202
|
-
'<tpl for=".">',
|
203
|
-
'<div class="thumb-wrap" id="{name}">',
|
204
|
-
'<div class="thumb"><img src="{url}" class="thumb-img"></div>',
|
205
|
-
'<span>{shortName}</span></div>',
|
206
|
-
'</tpl>'
|
207
|
-
),
|
208
|
-
listeners:{
|
209
|
-
'itemcontextmenu':function(view, record, htmlitem, index, e, options){
|
210
|
-
e.stopEvent();
|
211
|
-
var contextMenu = Ext.create("Ext.menu.Menu",{
|
212
|
-
items:[
|
213
|
-
{
|
214
|
-
text:'Delete',
|
215
|
-
iconCls:'icon-delete',
|
216
|
-
handler:function(btn){
|
217
|
-
self.deleteImage(self.imageAssetsDataView.getStore().getAt(index).get('id'));
|
218
|
-
}
|
219
|
-
}
|
220
|
-
]
|
221
|
-
});
|
222
|
-
contextMenu.showAt(e.xy);
|
223
|
-
}
|
224
|
-
}
|
225
|
-
});
|
226
|
-
|
227
|
-
config = Ext.apply({
|
228
|
-
id:'product-image-assets',
|
229
|
-
title:'Images',
|
230
|
-
autoDestroy:true,
|
231
|
-
margins: '5 5 5 0',
|
232
|
-
autoHeight:true,
|
233
|
-
layout:'fit',
|
234
|
-
items:[this.imageAssetsDataView],
|
235
|
-
tbar:{
|
236
|
-
items:[
|
237
|
-
{
|
238
|
-
text:'Add Image',
|
239
|
-
iconCls:'icon-upload',
|
240
|
-
handler:function(btn){
|
241
|
-
var uploadWindow = Ext.create("Compass.ErpApp.Shared.UploadWindow",{
|
242
|
-
standardUploadUrl:uploadUrl,
|
243
|
-
extraPostData:{
|
244
|
-
product_type_id:productTypeId
|
245
|
-
},
|
246
|
-
listeners:{
|
247
|
-
'fileuploaded':function(){
|
248
|
-
var dataView = btn.findParentByType('panel').query('dataview')[0];
|
249
|
-
dataView.getStore().load();
|
250
|
-
Ext.getCmp('productListPanel').loadProducts();
|
251
|
-
}
|
252
|
-
}
|
253
|
-
});
|
254
|
-
uploadWindow.show();
|
255
|
-
}
|
256
|
-
}
|
257
|
-
]
|
258
|
-
}
|
259
|
-
}, config);
|
260
|
-
|
261
|
-
this.callParent([config]);
|
262
|
-
}
|
263
|
-
});
|
264
|
-
|
265
|
-
//
|
266
|
-
//Add product window
|
267
|
-
//
|
268
|
-
|
269
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.AddProductWindow",{
|
270
|
-
extend:"Ext.window.Window",
|
271
|
-
alias:'widget.productmanager_addproductwindow',
|
272
|
-
|
273
|
-
constructor : function(config) {
|
274
|
-
var self = this;
|
275
|
-
config = Ext.apply({
|
276
|
-
title:'Add New Product',
|
277
|
-
width:800,
|
278
|
-
layout:'fit',
|
279
|
-
height:600,
|
280
|
-
autoScroll:true,
|
281
|
-
buttonAlign:'center',
|
282
|
-
items:{
|
283
|
-
xtype:'productmanager_productdescriptionform',
|
284
|
-
url:'/erp_products/erp_app/desktop/product_manager/new',
|
285
|
-
listeners:{
|
286
|
-
saved:function(form, newId){
|
287
|
-
self.close();
|
288
|
-
Ext.getCmp('productListPanel').loadProducts();
|
289
|
-
|
290
|
-
var win = Ext.create('Compass.ErpApp.Desktop.Applications.ProductManager.UpdateProductWindow',{
|
291
|
-
productTypeId:newId
|
292
|
-
}).show();
|
293
|
-
}
|
294
|
-
}
|
295
|
-
}
|
296
|
-
}, config);
|
297
|
-
|
298
|
-
this.callParent([config]);
|
299
|
-
}
|
300
|
-
});
|
301
|
-
|
302
|
-
//
|
303
|
-
//Update product window
|
304
|
-
//
|
305
|
-
|
306
|
-
Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.UpdateProductWindow",{
|
307
|
-
extend:"Ext.window.Window",
|
308
|
-
alias:'widget.productmanager_updateproductwindow',
|
309
|
-
constructor : function(config) {
|
310
|
-
var self = this;
|
311
|
-
var activeTab = config['activeTab'] | 0
|
312
|
-
Compass.ErpApp.Desktop.Applications.ProductManager.selectedProductTypeId = config.productTypeId;
|
313
|
-
|
314
|
-
var tabLayout = {
|
315
|
-
xtype:'tabpanel',
|
316
|
-
items:[
|
317
|
-
{
|
318
|
-
title:'Description',
|
319
|
-
xtype:'productmanager_productdescriptionform',
|
320
|
-
url:'/erp_products/erp_app/desktop/product_manager/update/'+config.productTypeId,
|
321
|
-
productTypeId:config.productTypeId,
|
322
|
-
listeners:{
|
323
|
-
'saved':function(form){
|
324
|
-
Ext.getCmp('productListPanel').loadProducts();
|
325
|
-
},
|
326
|
-
'activate':function(panel){
|
327
|
-
if(!Compass.ErpApp.Utility.isBlank(panel.initialConfig['productTypeId'])){
|
328
|
-
var self = this;
|
329
|
-
Ext.Ajax.request({
|
330
|
-
url: '/erp_products/erp_app/desktop/product_manager/show/'+panel.initialConfig['productTypeId'],
|
331
|
-
success: function(response) {
|
332
|
-
var obj = Ext.decode(response.responseText);
|
333
|
-
self.getForm().setValues(obj);
|
334
|
-
self.query('ckeditor')[0].setValue(obj.description);
|
335
|
-
},
|
336
|
-
failure: function(response) {
|
337
|
-
Ext.Msg.alert('Error', 'Error loading product details.');
|
338
|
-
}
|
339
|
-
});
|
340
|
-
}
|
341
|
-
}
|
342
|
-
|
343
|
-
}
|
344
|
-
},
|
345
|
-
{
|
346
|
-
xtype:'productmanager_productimagespanel',
|
347
|
-
productTypeId:config.productTypeId
|
348
|
-
}
|
349
|
-
]
|
350
|
-
}
|
351
|
-
|
352
|
-
config = Ext.apply({
|
353
|
-
title:'Update Product',
|
354
|
-
width:860,
|
355
|
-
layout:'fit',
|
356
|
-
height:620,
|
357
|
-
autoScroll:true,
|
358
|
-
items:[tabLayout],
|
359
|
-
listeners:{
|
360
|
-
show:function(comp){
|
361
|
-
var tabPanel = comp.down('tabpanel');
|
362
|
-
|
363
|
-
Ext.each(Compass.ErpApp.Desktop.Applications.ProductManager.widgets,function(widget){
|
364
|
-
tabPanel.add(widget);
|
365
|
-
});
|
366
|
-
|
367
|
-
tabPanel.setActiveTab(activeTab);
|
368
|
-
}
|
369
|
-
}
|
370
|
-
}, config);
|
371
|
-
|
372
|
-
this.callParent([config]);
|
373
|
-
}
|
374
|
-
});
|