Commit 885502fc98104a3b68e1422412b03d9af571a510

Authored by Braulio Bhavamitra
1 parent 5faa5da5

shopping_cart: refactor to use orders and delivery plugins

Showing 45 changed files with 1173 additions and 1787 deletions   Show diff stats
plugins/shopping_cart/controllers/shopping_cart_plugin_controller.rb
1 1 require 'base64'
2 2  
3   -class ShoppingCartPluginController < PublicController
  3 +class ShoppingCartPluginController < OrdersPluginController
4 4  
5 5 include ShoppingCartPlugin::CartHelper
6 6 helper ShoppingCartPlugin::CartHelper
7 7  
8   - append_view_path File.join(File.dirname(__FILE__) + '/../views')
9   - before_filter :login_required, :only => []
10   -
11   - before_filter :login_required, :only => []
12   -
13 8 def get
14 9 config =
15 10 if cart.nil?
16   - { :profile_id => nil,
  11 + { :profile_id => params[:profile_id],
17 12 :has_products => false,
18 13 :visible => false,
19 14 :products => []}
20 15 else
21   - { :profile_id => cart[:profile_id],
  16 + {
  17 + :profile_id => cart[:profile_id],
  18 + :profile_short_name => cart_profile.short_name,
22 19 :has_products => (cart[:items].keys.size > 0),
23 20 :visible => visible?,
24   - :products => products}
  21 + :products => products,
  22 + }
25 23 end
  24 + config[:has_previous_orders] = if cart_profile then previous_orders.first.present? else false end
26 25 render :text => config.to_json
27 26 end
28 27  
29 28 def add
30 29 product = find_product(params[:id])
31   - if product && profile = validate_same_profile(product)
32   - self.cart = { :profile_id => profile.id, :items => {} } if self.cart.nil?
33   - self.cart[:items][product.id] = 0 if self.cart[:items][product.id].nil?
34   - self.cart[:items][product.id] += 1
35   - render :text => {
36   - :ok => true,
37   - :error => {:code => 0},
38   - :products => [{
39   - :id => product.id,
40   - :name => product.name,
41   - :price => get_price(product, profile.environment),
42   - :description => product.description,
43   - :picture => product.default_image(:minor),
44   - :quantity => self.cart[:items][product.id]
45   - }]
46   - }.to_json
  30 + if product && (profile = validate_same_profile(product))
  31 + self.cart = { :profile_id => profile.id, :items => {} } if self.cart.nil?
  32 + self.cart[:items][product.id] = 0 if self.cart[:items][product.id].nil?
  33 + self.cart[:items][product.id] += 1
  34 + render :text => {
  35 + :ok => true,
  36 + :error => {:code => 0},
  37 + :products => [{
  38 + :id => product.id,
  39 + :name => product.name,
  40 + :price => get_price(product, profile.environment),
  41 + :description => product.description,
  42 + :picture => product.default_image(:minor),
  43 + :quantity => self.cart[:items][product.id]
  44 + }]
  45 + }.to_json
47 46 end
48 47 end
49 48  
... ... @@ -93,36 +92,56 @@ class ShoppingCartPluginController &lt; PublicController
93 92 }.to_json
94 93 end
95 94  
  95 + # override from OrdersPluginController
  96 + def repeat
  97 + unless params[:id].present?
  98 + @orders = previous_orders.last(5).reverse
  99 + @orders.each{ |o| o.enable_product_diff }
  100 + else
  101 + @order = cart_profile.orders.find params[:id]
  102 + self.cart = { profile_id: cart_profile.id, items: {} }
  103 + @order.items.each do |item|
  104 + next unless item.repeat_product and item.repeat_product.available
  105 + self.cart[:items][item.repeat_product.id] = item.quantity_consumer_ordered.to_i
  106 + end
  107 + self.cart[:repeat_order_id] = @order.id
  108 +
  109 + render json: {
  110 + products: products,
  111 + }
  112 + end
  113 + end
  114 +
96 115 def buy
  116 + @no_design_blocks = true
97 117 @customer = user || Person.new
98   - if validate_cart_presence
99   - @cart = cart
100   - @profile = environment.profiles.find(cart[:profile_id])
101   - @settings = Noosfero::Plugin::Settings.new(@profile, ShoppingCartPlugin)
102   - render :layout => false
  118 + return redirect_to request.referer || environment.top_url if self.cart.nil?
  119 + @settings = cart_profile.shopping_cart_settings
  120 + @cart = cart
  121 + @profile = cart_profile
  122 + @order = profile.sales.build consumer: user
  123 +
  124 + @order.supplier_delivery = profile.delivery_methods.find session[:cart][:last_delivery_option_id] rescue nil
  125 + if repeat_order_id = self.cart[:repeat_order_id]
  126 + repeat_order = cart_profile.orders.where(id: repeat_order_id).first
  127 + @order.consumer_delivery_data = repeat_order.consumer_delivery_data if repeat_order
103 128 end
104 129 end
105 130  
106 131 def send_request
107   - register_order(params[:customer], self.cart[:items])
  132 + order = register_order(params[:customer], self.cart[:items])
108 133 begin
109   - profile = environment.profiles.find(cart[:profile_id])
110   - ShoppingCartPlugin::Mailer.customer_notification(params[:customer], profile, self.cart[:items], params[:delivery_option]).deliver
111   - ShoppingCartPlugin::Mailer.supplier_notification(params[:customer], profile, self.cart[:items], params[:delivery_option]).deliver
  134 + ShoppingCartPlugin::Mailer.customer_notification(order, self.cart[:items]).deliver
  135 + ShoppingCartPlugin::Mailer.supplier_notification(order, self.cart[:items]).deliver
  136 + session[:notice] = _('Your order has been sent successfully! You will receive a confirmation e-mail shortly.')
  137 + @success = true
  138 + @profile = cart_profile
  139 + session[:cart] ||= {}
  140 + session[:cart][:last_delivery_option_id] = order.supplier_delivery_id
112 141 self.cart = nil
113   - render :text => {
114   - :ok => true,
115   - :message => _('Request sent successfully. Check your email.'),
116   - :error => {:code => 0}
117   - }.to_json
118   - rescue ActiveRecord::ActiveRecordError
119   - render :text => {
120   - :ok => false,
121   - :error => {
122   - :code => 6,
123   - :message => exception.message
124   - }
125   - }.to_json
  142 + rescue ActiveRecord::ActiveRecordError => exception
  143 + @success = false
  144 + @error = exception.message
126 145 end
127 146 end
128 147  
... ... @@ -168,35 +187,35 @@ class ShoppingCartPluginController &lt; PublicController
168 187 end
169 188 end
170 189  
171   - def update_delivery_option
172   - profile = environment.profiles.find(cart[:profile_id])
173   - settings = Noosfero::Plugin::Settings.new(profile, ShoppingCartPlugin)
174   - delivery_price = settings.delivery_options[params[:delivery_option]]
175   - delivery = Product.new(:name => params[:delivery_option], :price => delivery_price)
176   - delivery.save(false)
177   - items = self.cart[:items].clone
178   - items[delivery.id] = 1
179   - total_price = get_total_on_currency(items, environment)
180   - delivery.destroy
181   - render :text => {
182   - :ok => true,
183   - :delivery_price => float_to_currency_cart(delivery_price, environment),
184   - :total_price => total_price,
185   - :message => _('Delivery option updated.'),
186   - :error => {:code => 0}
187   - }.to_json
  190 + def update_supplier_delivery
  191 + @profile = cart_profile
  192 + supplier_delivery = @profile.delivery_methods.find params[:order][:supplier_delivery_id]
  193 + order = build_order self.cart[:items], supplier_delivery
  194 + total_price = order.total_price
  195 + render json: {
  196 + ok: true,
  197 + delivery_price: float_to_currency_cart(supplier_delivery.cost(total_price), environment, unit: ''),
  198 + total_price: float_to_currency_cart(total_price, environment, unit: ''),
  199 + message: _('Delivery option updated.'),
  200 + error: {code: 0}
  201 + }
188 202 end
189 203  
190   - private
  204 + # must be public
  205 + def profile
  206 + cart_profile
  207 + end
  208 +
  209 + protected
191 210  
192 211 def validate_same_profile(product)
193 212 if self.cart && self.cart[:profile_id] && product.profile_id != self.cart[:profile_id]
194 213 render :text => {
195 214 :ok => false,
196 215 :error => {
197   - :code => 1,
198   - :message => _("Can't join items from different enterprises.")
199   - }
  216 + :code => 1,
  217 + :message => _("Your basket contains items from '%{profile_name}'. Please empty the basket or checkout before adding items from here.") % {profile_name: cart_profile.short_name}
  218 + }
200 219 }.to_json
201 220 return nil
202 221 end
... ... @@ -262,40 +281,48 @@ class ShoppingCartPluginController &lt; PublicController
262 281 end
263 282  
264 283 def register_order(custumer, items)
265   - new_items = {}
266   - items.each do |id, quantity|
  284 + products_list = {}; items.each do |id, quantity|
267 285 product = Product.find(id)
268 286 price = product.price || 0
269   - new_items[id] = {:quantity => quantity, :price => price, :name => product.name}
  287 + products_list[id] = {:quantity => quantity, :price => price, :name => product.name}
270 288 end
271   - purchase_order = ShoppingCartPlugin::PurchaseOrder.new
272   - purchase_order.seller = environment.profiles.find(cart[:profile_id])
273   - purchase_order.customer = user
274   - purchase_order.status = ShoppingCartPlugin::PurchaseOrder::Status::OPENED
275   - purchase_order.products_list = new_items
276   - purchase_order.customer_delivery_option = params[:delivery_option]
277   - purchase_order.customer_payment = params[:customer][:payment]
278   - purchase_order.customer_change = params[:customer][:change]
279   - purchase_order.customer_name = params[:customer][:name]
280   - purchase_order.customer_email = params[:customer][:email]
281   - purchase_order.customer_contact_phone = params[:customer][:contact_phone]
282   - purchase_order.customer_address = params[:customer][:address]
283   - purchase_order.customer_district = params[:customer][:district]
284   - purchase_order.customer_city = params[:customer][:city]
285   - purchase_order.customer_zip_code = params[:customer][:zip_code]
286   - purchase_order.save!
287   - end
288 289  
289   - protected
  290 + order = OrdersPlugin::Sale.new
  291 + order.profile = environment.profiles.find(cart[:profile_id])
  292 + order.supplier_delivery = profile.delivery_methods.find params[:order][:supplier_delivery_id]
  293 + order.session_id = session_id unless user
  294 + order.consumer = user
  295 + order.source = 'shopping_cart_plugin'
  296 + order.status = 'ordered'
  297 + order.products_list = products_list
  298 + order.consumer_data = params[:order][:consumer_data]
  299 + order.payment_data = params[:order][:payment_data]
  300 + order.consumer_delivery_data = params[:order][:consumer_delivery_data]
  301 + order.save!
  302 +
  303 + order
  304 + end
290 305  
291 306 def cart
292 307 @cart ||=
293 308 begin
294 309 cookies[cookie_key] && YAML.load(Base64.decode64(cookies[cookie_key])) || nil
295 310 end
  311 + # migrate from old attribute
  312 + @cart[:profile_id] ||= @cart.delete(:enterprise_id) if @cart and @cart[:enterprise_id].present?
296 313 @cart
297 314 end
298 315  
  316 + def cart_profile
  317 + profile_id = if params[:profile_id].present? then params[:profile_id] elsif cart then cart[:profile_id] end
  318 + @cart_profile ||= environment.profiles.find profile_id rescue nil
  319 + end
  320 +
  321 + # from OrdersPluginController
  322 + def supplier
  323 + cart_profile
  324 + end
  325 +
299 326 def cart=(data)
300 327 @cart = data
301 328 end
... ...
plugins/shopping_cart/controllers/shopping_cart_plugin_myprofile_controller.rb
1 1 class ShoppingCartPluginMyprofileController < MyProfileController
2   - def edit
3   - params[:settings] = treat_cart_options(params[:settings])
4   -
5   - @settings = Noosfero::Plugin::Settings.new(profile, ShoppingCartPlugin, params[:settings])
6   - if request.post?
7   - begin
8   - @settings.save!
9   - session[:notice] = _('Option updated successfully.')
10   - rescue Exception => exception
11   - session[:notice] = _('Option wasn\'t updated successfully.')
12   - end
13   - redirect_to :action => 'edit'
14   - end
15   - end
16   -
17   - def reports
18   - utc_string = ' 00:00:00 UTC'
19   - @from = params[:from] ? Time.parse(params[:from] + utc_string) : Time.now.utc.at_beginning_of_month
20   - @to = params[:to] ? Time.parse(params[:to] + utc_string) : Time.now.utc
21   - @status = !params[:filter_status].blank? ? params[:filter_status].to_i : nil
22   -
23   - condition = 'created_at >= ? AND created_at <= ?'
24   - condition_parameters = [@from, @to+1.day]
25   - if @status
26   - condition += ' AND status = ?'
27   - condition_parameters << @status
28   - end
29 2  
30   - conditions = [condition] + condition_parameters
31   - @orders = profile.orders.find(:all, :conditions => conditions)
  3 + helper DeliveryPlugin::DisplayHelper
32 4  
33   - @products = {}
34   - @orders.each do |order|
35   - order.products_list.each do |id, qp|
36   - @products[id] ||= ShoppingCartPlugin::LineItem.new(id, qp[:name])
37   - @products[id].quantity += qp[:quantity]
  5 + def edit
  6 + params[:settings] = treat_cart_options(params[:settings])
  7 + @settings = profile.shopping_cart_settings params[:settings] || {}
  8 + respond_to do |format|
  9 + format.js do
  10 + if request.post?
  11 + @success = @settings.save!
  12 + end
38 13 end
  14 + format.html
39 15 end
40 16 end
41 17  
42   - def update_order_status
43   - order = ShoppingCartPlugin::PurchaseOrder.find(params[:order_id].to_i)
44   - order.status = params[:order_status].to_i
45   - order.save!
46   - redirect_to :action => 'reports', :from => params[:context_from], :to => params[:context_to], :filter_status => params[:context_status]
47   - end
48   -
49   - private
  18 + protected
50 19  
51 20 def treat_cart_options(settings)
52 21 return if settings.blank?
53 22 settings[:enabled] = settings[:enabled] == '1'
54   - settings[:delivery] = settings[:delivery] == '1'
55   - settings[:free_delivery_price] = settings[:free_delivery_price].blank? ? nil : settings[:free_delivery_price].to_d
56   - settings[:delivery_options] = treat_delivery_options(settings[:delivery_options])
57 23 settings
58 24 end
59 25  
60   - def treat_delivery_options(params)
61   - result = {}
62   - return result if params.nil? || params[:options].nil?
63   - params[:options].size.times do |counter|
64   - if params[:options][counter].present? && params[:prices][counter].present?
65   - result[params[:options][counter]] = params[:prices][counter]
66   - end
67   - end
68   - result
69   - end
70 26 end
... ...
plugins/shopping_cart/db/migrate/20121022190819_move_fields_included_on_profiles_table_to_settings.rb
1 1 class MoveFieldsIncludedOnProfilesTableToSettings < ActiveRecord::Migration
2 2 def self.up
3 3 Profile.find_each do |profile|
4   - settings = Noosfero::Plugin::Settings.new(profile, ShoppingCartPlugin)
  4 + settings = profile.shopping_cart_settings
5 5 settings.enabled = profile.shopping_cart
6 6 settings.delivery = profile.shopping_cart_delivery
7 7 settings.delivery_price = profile.shopping_cart_delivery_price
... ...
plugins/shopping_cart/db/migrate/20131226125124_move_shopping_cart_purchase_order_to_orders_plugin_order.rb 0 → 100644
... ... @@ -0,0 +1,86 @@
  1 +OrdersPlugin.send :remove_const, :Item if defined? OrdersPlugin::Item
  2 +OrdersPlugin.send :remove_const, :Order if defined? OrdersPlugin::Order
  3 +
  4 +class ShoppingCartPlugin::PurchaseOrder < Noosfero::Plugin::ActiveRecord
  5 + acts_as_having_settings :field => :data
  6 +
  7 + module Status
  8 + OPENED = 0
  9 + CANCELED = 1
  10 + CONFIRMED = 2
  11 + SHIPPED = 3
  12 + end
  13 +end
  14 +
  15 +class Profile
  16 + has_many :orders, :class_name => 'OrdersPlugin::Order'
  17 +end
  18 +
  19 +class OrdersPlugin::Item < Noosfero::Plugin::ActiveRecord
  20 + belongs_to :order, :class_name => 'OrdersPlugin::Order'
  21 +end
  22 +class OrdersPlugin::Order < Noosfero::Plugin::ActiveRecord
  23 + has_many :items, :class_name => 'OrdersPlugin::Item', :foreign_key => :order_id
  24 +
  25 + extend CodeNumbering::ClassMethods
  26 + code_numbering :code, :scope => proc{ self.profile.orders }
  27 +end
  28 +
  29 +StatusTransform = {
  30 + ShoppingCartPlugin::PurchaseOrder::Status::OPENED => 'ordered',
  31 + ShoppingCartPlugin::PurchaseOrder::Status::CONFIRMED => 'accepted',
  32 + ShoppingCartPlugin::PurchaseOrder::Status::CANCELED => 'cancelled',
  33 + ShoppingCartPlugin::PurchaseOrder::Status::SHIPPED => 'delivered',
  34 +}
  35 +
  36 +class MoveShoppingCartPurchaseOrderToOrdersPluginOrder < ActiveRecord::Migration
  37 + def self.up
  38 + OrdersPlugin::Order.record_timestamps = false
  39 +
  40 + ShoppingCartPlugin::PurchaseOrder.all(:order => 'created_at ASC').each do |purchase_order|
  41 + data = purchase_order.data
  42 +
  43 + order = OrdersPlugin::Order.new :profile_id => purchase_order.seller_id, :consumer_id => purchase_order.customer_id
  44 +
  45 + order.consumer_data = {}
  46 + ['contact_phone','name','email'].each do |prop|
  47 + order.consumer_data[prop.to_sym] = data[('customer_'+prop).to_sym]
  48 + end
  49 +
  50 + order.consumer_delivery_data = {
  51 + :name => data[:customer_delivery_option],
  52 + :address_line1 => data[:customer_address],
  53 + :address_line2 => data[:customer_district],
  54 + :postal_code => data[:customer_zip_code],
  55 + :state => data[:customer_state],
  56 + :country => 'Brasil'
  57 + }
  58 + order.supplier_delivery_data = {}
  59 +
  60 + data[:products_list].each do |id, data|
  61 + item = order.items.build :product_id => id, :name => data[:name], :quantity_consumer_ordered => data[:quantity], :price => data[:price]
  62 + item.order = order
  63 + end
  64 +
  65 + order.payment_data = {
  66 + :method => data[:customer_payment],
  67 + :change => data[:customer_change]
  68 + }
  69 +
  70 + order.status = StatusTransform[purchase_order.status]
  71 +
  72 + order.updated_at = purchase_order.updated_at
  73 + order.created_at = purchase_order.created_at
  74 +
  75 + order.save!
  76 + end
  77 +
  78 + # Leave table for registry
  79 + #drop_table :shopping_cart_plugin_purchase_orders
  80 +
  81 + OrdersPlugin::Order.record_timestamps = true
  82 + end
  83 +
  84 + def self.down
  85 + end
  86 +end
... ...
plugins/shopping_cart/db/migrate/20150202122535_move_shopping_delivery_options_to_delivery_plugin.rb 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +class MoveShoppingDeliveryOptionsToDeliveryPlugin < ActiveRecord::Migration
  2 + def up
  3 + Enterprise.find_each batch_size: 20 do |enterprise|
  4 + settings = enterprise.shopping_cart_settings
  5 + next if settings.delivery_options.blank?
  6 +
  7 + free_over_price = settings.free_delivery_price
  8 + settings.delivery_options.each do |name, price|
  9 + enterprise.delivery_methods.create! name: name, fixed_cost: price.to_f, delivery_type: 'deliver', free_over_price: free_over_price
  10 + end
  11 +
  12 + settings.free_delivery_price = nil
  13 + settings.delivery_options = nil
  14 + enterprise.save!
  15 + end
  16 + end
  17 +
  18 + def down
  19 + say "this migration can't be reverted"
  20 + end
  21 +end
... ...
plugins/shopping_cart/lib/ext/enterprise.rb
... ... @@ -1,5 +0,0 @@
1   -require_dependency 'enterprise'
2   -
3   -class Enterprise
4   - has_many :orders, :class_name => "ShoppingCartPlugin::PurchaseOrder", :foreign_key => 'seller_id'
5   -end
plugins/shopping_cart/lib/ext/person.rb
... ... @@ -1,5 +0,0 @@
1   -require_dependency 'person'
2   -
3   -class Person
4   - has_many :purchases, :class_name => "ShoppingCartPlugin::PurchaseOrder", :foreign_key => 'customer_id'
5   -end
plugins/shopping_cart/lib/ext/profile.rb 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +require_dependency 'profile'
  2 +
  3 +class Profile
  4 +
  5 + def shopping_cart_settings attrs = {}
  6 + @shopping_cart_settings ||= Noosfero::Plugin::Settings.new self, ShoppingCartPlugin, attrs
  7 + attrs.each{ |a, v| @shopping_cart_settings.send "#{a}=", v }
  8 + @shopping_cart_settings
  9 + end
  10 +
  11 + def shopping_cart_enabled
  12 + self.shopping_cart_settings.enabled
  13 + end
  14 +
  15 + # may be customized by other profiles
  16 + def cart_order_supplier_notification_recipients
  17 + if self.contact_email.present?
  18 + [self.contact_email]
  19 + else
  20 + self.admins.collect(&:contact_email).select{ |email| email.present? }
  21 + end
  22 + end
  23 +
  24 +end
... ...
plugins/shopping_cart/lib/shopping_cart_plugin.rb
1 1 class ShoppingCartPlugin < Noosfero::Plugin
2 2  
3   - class << self
4   - def plugin_name
  3 + def self.plugin_name
5 4 "Shopping Basket"
6   - end
7   -
8   - def plugin_description
9   - _("A shopping basket feature for enterprises")
10   - end
11   -
12   - def delivery_default_setting
13   - false
14   - end
15   -
16   - def delivery_price_default_setting
17   - 0
18   - end
19   -
20   - def delivery_options_default_setting
21   - {}
22   - end
23 5 end
24 6  
25   - def add_to_cart_button(item)
26   - profile = item.profile
27   - settings = Noosfero::Plugin::Settings.new(profile, ShoppingCartPlugin)
28   - if settings.enabled && item.available
29   - lambda {
30   - link_to(_('Add to basket'), "add:#{item.name}",
31   - :class => 'cart-add-item',
32   - :onclick => "Cart.addItem(#{item.id}, this); return false"
33   - )
34   - }
35   - end
  7 + def self.plugin_description
  8 + _("A shopping basket feature for enterprises")
36 9 end
37 10  
38   - alias :product_info_extras :add_to_cart_button
39   - alias :catalog_item_extras :add_to_cart_button
40   - alias :asset_product_extras :add_to_cart_button
41   -
42 11 def stylesheet?
43 12 true
44 13 end
... ... @@ -48,19 +17,45 @@ class ShoppingCartPlugin &lt; Noosfero::Plugin
48 17 end
49 18  
50 19 def body_beginning
51   - expanded_template('cart.html.erb')
  20 + lambda do
  21 + extend ShoppingCartPlugin::CartHelper
  22 + render 'public/cart' unless cart_minimized
  23 + end
52 24 end
53 25  
54 26 def control_panel_buttons
55   - settings = Noosfero::Plugin::Settings.new(context.profile, ShoppingCartPlugin)
56 27 buttons = []
57 28 if context.profile.enterprise?
58 29 buttons << { :title => _('Shopping basket'), :icon => 'shopping-cart-icon', :url => {:controller => 'shopping_cart_plugin_myprofile', :action => 'edit'} }
59 30 end
60   - if context.profile.enterprise? && settings.enabled
61   - buttons << { :title => _('Purchase reports'), :icon => 'shopping-cart-purchase-report', :url => {:controller => 'shopping_cart_plugin_myprofile', :action => 'reports'} }
62   - end
63 31  
64 32 buttons
65 33 end
  34 +
  35 + def add_to_cart_button item, options = {}
  36 + profile = item.profile
  37 + return unless profile.shopping_cart_enabled and item.available
  38 + lambda do
  39 + extend ShoppingCartPlugin::CartHelper
  40 + add_to_cart_button item, options
  41 + end
  42 + end
  43 +
  44 + alias :product_info_extras :add_to_cart_button
  45 + alias :catalog_item_extras :add_to_cart_button
  46 + alias :asset_product_extras :add_to_cart_button
  47 +
  48 + # We now think that it's not a good idea to have the basket in the same time.
  49 + #def catalog_autocomplete_item_extras product
  50 + # add_to_cart_button product, with_text: false
  51 + #end
  52 +
  53 + def catalog_search_extras_begin
  54 + return unless profile.shopping_cart_enabled
  55 + lambda do
  56 + extend ShoppingCartPlugin::CartHelper
  57 + content_tag 'li', render('public/cart'), :class => 'catalog-cart'
  58 + end
  59 + end
  60 +
66 61 end
... ...
plugins/shopping_cart/lib/shopping_cart_plugin/cart_helper.rb
  1 +require_dependency 'delivery_plugin/display_helper'
  2 +
1 3 module ShoppingCartPlugin::CartHelper
2 4  
3 5 include ActionView::Helpers::NumberHelper
4 6 include ActionView::Helpers::TagHelper
5 7  
  8 + include DeliveryPlugin::DisplayHelper
  9 +
  10 + def add_to_cart_button item, options = {}
  11 + label = if options[:with_text].nil? or options[:with_text] then _('Add to basket') else '' end
  12 + button_to_function 'cart', label, "Cart.addItem(#{item.id}, this)", class: 'cart-add-item', type: 'primary'
  13 + end
  14 +
  15 + def cart_applet
  16 + button_to_function 'cart', '&nbsp;<span class="cart-qtty"></span>', "cart.toggle()", class: 'cart-applet-indicator', type: 'primary'
  17 + end
  18 +
  19 + def cart_minimized
  20 + @catalog_bar
  21 + end
  22 +
  23 + def repeat_checkout_order_button order
  24 + button_to_function :check, t('views.public.repeat.checkout'), 'cart.repeatCheckout(event, this)', 'data-order-id' => order.id, class: 'repeat-checkout-order'
  25 + end
  26 +
  27 + def repeat_choose_order_button order
  28 + button_to_function :edit, t('views.public.repeat.choose'), 'cart.repeatChoose(event, this)', 'data-order-id' => order.id, class: 'repeat-choose-order'
  29 + end
  30 +
6 31 def sell_price(product)
7 32 return 0 if product.price.nil?
8 33 product.discount ? product.price_with_discount : product.price
9 34 end
10 35  
11   - def get_price(product, environment, quantity=1)
12   - float_to_currency_cart(price_with_quantity(product,quantity), environment)
  36 + def get_price product, environment, quantity=1, options = {}
  37 + float_to_currency_cart price_with_quantity(product,quantity), environment, options
13 38 end
14 39  
15 40 def price_with_quantity(product, quantity=1)
... ... @@ -25,68 +50,28 @@ module ShoppingCartPlugin::CartHelper
25 50 float_to_currency_cart(get_total(items), environment)
26 51 end
27 52  
28   - def items_table(items, profile, delivery_option = nil, by_mail = false)
29   - environment = profile.environment
30   - settings = Noosfero::Plugin::Settings.new(profile, ShoppingCartPlugin)
31   - items = items.to_a
32   -
33   - quantity_opts = { :class => 'cart-table-quantity' }
34   - quantity_opts.merge!({:align => 'center'}) if by_mail
35   - price_opts = {:class => 'cart-table-price'}
36   - price_opts.merge!({:align => 'right'}) if by_mail
37   - items.sort! {|a, b| Product.find(a.first).name <=> Product.find(b.first).name}
38   -
39   - if settings.delivery
40   - if settings.free_delivery_price && get_total(items) >= settings.free_delivery_price
41   - delivery = Product.new(:name => _('Free delivery'), :price => 0)
42   - else
43   - delivery = Product.new(:name => delivery_option || _('Delivery'), :price => settings.delivery_options[delivery_option])
44   - end
45   - delivery.save(false)
46   - items << [delivery.id, '']
  53 + def build_order items, delivery_method = nil
  54 + @order = @profile.sales.build
  55 + items.each do |product_id, quantity|
  56 + @order.items.build product_id: product_id, quantity_consumer_ordered: quantity
47 57 end
  58 + @order.supplier_delivery = delivery_method
  59 + @order
  60 + end
48 61  
49   - table = '<table id="cart-items-table" cellpadding="2" cellspacing="0"
50   - border="'+(by_mail ? '1' : '0')+'"
51   - style="'+(by_mail ? 'border-collapse:collapse' : '')+'">' +
52   - content_tag('tr',
53   - content_tag('th', _('Item name')) +
54   - content_tag('th', by_mail ? '&nbsp;#&nbsp;' : '#') +
55   - content_tag('th', c_('Price'))
56   - ) +
57   - items.map do |id, quantity|
58   - product = Product.find(id)
59   - name_opts = {}
60   - is_delivery = quantity.kind_of?(String)
61   - if is_delivery
62   - price_opts.merge!({:id => 'delivery-price'})
63   - name_opts.merge!({:id => 'delivery-name'})
64   - end
65   - content_tag('tr',
66   - content_tag('td', product.name, name_opts) +
67   - content_tag('td', quantity, quantity_opts ) +
68   - content_tag('td', get_price(product, environment, quantity), price_opts)
69   - )
70   - end.join("\n")
71   -
72   - total = get_total_on_currency(items, environment)
73   - delivery.destroy if settings.delivery
74   -
75   - table +
76   - content_tag('th', _('Total:'), :colspan => 2, :class => 'cart-table-total-label') +
77   - content_tag('th', total, :class => 'cart-table-total-value') +
78   - '</table>'
  62 + def items_table(items, profile, delivery_method = nil, by_mail = false)
  63 + # partial key needed in mailer context
  64 + render partial: 'shopping_cart_plugin/items', locals: {order: build_order(items, delivery_method), by_mail: by_mail}
79 65 end
80 66  
81   - def float_to_currency_cart(value, environment)
82   - number_to_currency(value, :unit => environment.currency_unit, :separator => environment.currency_separator, :delimiter => environment.currency_delimiter, :precision => 2, :format => "%u%n")
  67 + def float_to_currency_cart value, environment, _options = {}
  68 + options = {:unit => environment.currency_unit, :separator => environment.currency_separator, :delimiter => environment.currency_delimiter, :precision => 2, :format => "%u%n"}
  69 + options.merge! _options
  70 + number_to_currency value, options
83 71 end
84 72  
85   - def select_delivery_options(options, environment)
86   - result = options.map do |option, price|
87   - ["#{option} (#{float_to_currency_cart(price, environment)})", option]
88   - end
89   - result << ["#{_('Delivery')} (#{float_to_currency_cart(0, environment)})", 'delivery'] if result.empty?
90   - result
  73 + def options_for_payment
  74 + options_for_select OrdersPlugin::Order::PaymentMethods.map{ |key, text| [text.call, key] }
91 75 end
  76 +
92 77 end
... ...
plugins/shopping_cart/lib/shopping_cart_plugin/mailer.rb
... ... @@ -2,38 +2,38 @@ class ShoppingCartPlugin::Mailer &lt; Noosfero::Plugin::MailerBase
2 2  
3 3 include ShoppingCartPlugin::CartHelper
4 4  
5   - def customer_notification(customer, supplier, items, delivery_option)
6   - domain = supplier.hostname || supplier.environment.default_hostname
7   - @customer = customer
8   - @supplier = supplier
  5 + helper ShoppingCartPlugin::CartHelper
  6 +
  7 + attr_accessor :environment, :profile
  8 +
  9 + def customer_notification order, items
  10 + domain = order.profile.hostname || order.profile.environment.default_hostname
  11 + self.profile = order.profile
  12 + self.environment = order.profile.environment
  13 + @order = order
9 14 @items = items
10   - @environment = supplier.environment
11   - @helper = self
12   - @delivery_option = delivery_option
13 15  
14 16 mail(
15   - to: customer[:email],
  17 + to: @order.consumer_data[:email],
16 18 from: 'no-reply@' + domain,
17   - reply_to: supplier.contact_email,
18   - subject: _("[%s] Your buy request was performed successfully.") % supplier[:name],
  19 + reply_to: @order.profile.cart_order_supplier_notification_recipients,
  20 + subject: _("[%s] Your buy request was performed successfully.") % @order.profile.short_name(nil),
19 21 content_type: 'text/html'
20 22 )
21 23 end
22 24  
23   - def supplier_notification(customer, supplier, items, delivery_option)
24   - domain = supplier.environment.default_hostname
25   - @customer = customer
26   - @supplier = supplier
  25 + def supplier_notification order, items
  26 + domain = order.profile.environment.default_hostname
  27 + self.profile = order.profile
  28 + self.environment = order.profile.environment
  29 + @order = order
27 30 @items = items
28   - @environment = supplier.environment
29   - @helper = self
30   - @delivery_option = delivery_option
31 31  
32 32 mail(
33   - to: supplier.contact_email,
  33 + to: @order.profile.cart_order_supplier_notification_recipients,
34 34 from: 'no-reply@' + domain,
35   - reply_to: customer[:email],
36   - subject: _("[%s] You have a new buy request from %s.") % [supplier.environment.name, customer[:name]],
  35 + reply_to: @order.consumer_data[:email],
  36 + subject: _("[%s] You have a new buy request from %s.") % [order.profile.environment.name, @order.consumer_data[:name]],
37 37 content_type: 'text/html'
38 38 )
39 39 end
... ...
plugins/shopping_cart/lib/shopping_cart_plugin/purchase_order.rb
... ... @@ -1,43 +0,0 @@
1   -class ShoppingCartPlugin::PurchaseOrder < Noosfero::Plugin::ActiveRecord
2   -
3   - belongs_to :customer, :class_name => "Profile"
4   - belongs_to :seller, :class_name => "Profile"
5   -
6   - validates_presence_of :status, :seller
7   -
8   - attr_accessible :seller, :status, :products_list
9   -
10   - acts_as_having_settings :field => :data
11   -
12   - settings_items :products_list, :type => Array, :default => {}
13   - settings_items :customer_name, :type => String
14   - settings_items :customer_email, :type => String
15   - settings_items :customer_contact_phone, :type => String
16   - settings_items :customer_address, :type => String
17   - settings_items :customer_district, :type => String
18   - settings_items :customer_city, :type => String
19   - settings_items :customer_zip_code, :type => String
20   - settings_items :customer_delivery_option, :type => String
21   - settings_items :customer_payment, :type => String
22   - settings_items :customer_change, :type => String
23   -
24   - before_create do |order|
25   - order.created_at = Time.now.utc
26   - order.updated_at = Time.now.utc
27   - end
28   -
29   - before_update do |order|
30   - order.updated_at = Time.now.utc
31   - end
32   -
33   - module Status
34   - OPENED = 0
35   - CANCELED = 1
36   - CONFIRMED = 2
37   - SHIPPED = 3
38   -
39   - def self.name
40   - [_('Opened'), _('Canceled'), _('Confirmed'), _('Shipped')]
41   - end
42   - end
43   -end
plugins/shopping_cart/plugin.yml 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +name: shopping_cart
  2 +dependencies:
  3 + - orders
... ...
plugins/shopping_cart/po/de/shopping_cart.po
... ... @@ -6,8 +6,8 @@
6 6 #
7 7 msgid ""
8 8 msgstr ""
9   -"Project-Id-Version: 1.1-166-gaf47713\n"
10   -"POT-Creation-Date: 2015-06-01 17:26-0300\n"
  9 +"Project-Id-Version: 1.0-690-gcb6e853\n"
  10 +"POT-Creation-Date: 2015-03-05 12:09-0300\n"
11 11 "PO-Revision-Date: 2015-02-23 11:36+0200\n"
12 12 "Last-Translator: Michal Čihař <michal@cihar.com>\n"
13 13 "Language-Team: German <https://hosted.weblate.org/projects/noosfero/plugin-"
... ...
plugins/shopping_cart/po/es/shopping_cart.po
... ... @@ -5,8 +5,8 @@
5 5 #
6 6 msgid ""
7 7 msgstr ""
8   -"Project-Id-Version: 1.1-166-gaf47713\n"
9   -"POT-Creation-Date: 2015-06-01 17:26-0300\n"
  8 +"Project-Id-Version: 1.0-690-gcb6e853\n"
  9 +"POT-Creation-Date: 2015-03-05 12:09-0300\n"
10 10 "PO-Revision-Date: 2015-02-23 11:35+0200\n"
11 11 "Last-Translator: Michal Čihař <michal@cihar.com>\n"
12 12 "Language-Team: Spanish <https://hosted.weblate.org/projects/noosfero/plugin-"
... ...
plugins/shopping_cart/po/fr/shopping_cart.po
... ... @@ -4,9 +4,9 @@
4 4 # , 2009.
5 5 msgid ""
6 6 msgstr ""
7   -"Project-Id-Version: 1.1-166-gaf47713\n"
  7 +"Project-Id-Version: 1.0-690-gcb6e853\n"
8 8 "Report-Msgid-Bugs-To: \n"
9   -"POT-Creation-Date: 2015-06-01 17:26-0300\n"
  9 +"POT-Creation-Date: 2015-03-05 12:09-0300\n"
10 10 "PO-Revision-Date: 2015-03-07 10:49+0200\n"
11 11 "Last-Translator: Tuux <tuxa@galaxie.eu.org>\n"
12 12 "Language-Team: French <https://hosted.weblate.org/projects/noosfero/plugin-"
... ...
plugins/shopping_cart/po/hy/shopping_cart.po
... ... @@ -5,8 +5,8 @@
5 5 #
6 6 msgid ""
7 7 msgstr ""
8   -"Project-Id-Version: 1.1-166-gaf47713\n"
9   -"POT-Creation-Date: 2015-06-01 17:26-0300\n"
  8 +"Project-Id-Version: 1.0-690-gcb6e853\n"
  9 +"POT-Creation-Date: 2015-03-05 12:09-0300\n"
10 10 "PO-Revision-Date: 2015-02-23 11:37+0200\n"
11 11 "Last-Translator: Michal Čihař <michal@cihar.com>\n"
12 12 "Language-Team: Armenian <https://hosted.weblate.org/projects/noosfero/plugin-"
... ...
plugins/shopping_cart/po/pt/shopping_cart.po
... ... @@ -11,12 +11,12 @@
11 11 #
12 12 msgid ""
13 13 msgstr ""
14   -"Project-Id-Version: 1.1-166-gaf47713\n"
15   -"POT-Creation-Date: 2015-06-01 17:26-0300\n"
16   -"PO-Revision-Date: 2015-02-23 11:36+0200\n"
  14 +"Project-Id-Version: 1.0-690-gcb6e853\n"
  15 +"POT-Creation-Date: 2015-03-05 12:09-0300\n"
  16 +"PO-Revision-Date: 2015-06-12 11:29-0300\n"
17 17 "Last-Translator: Michal Čihař <michal@cihar.com>\n"
18   -"Language-Team: Portuguese <https://hosted.weblate.org/projects/noosfero/"
19   -"plugin-shopping-cart/pt/>\n"
  18 +"Language-Team: Portuguese <https://hosted.weblate.org/projects/noosfero"
  19 +"/plugin-shopping-cart/pt/>\n"
20 20 "Language: pt\n"
21 21 "MIME-Version: 1.0\n"
22 22 "Content-Type: text/plain; charset=UTF-8\n"
... ... @@ -65,6 +65,18 @@ msgstr &quot;Frete grátis&quot;
65 65 msgid "Delivery"
66 66 msgstr "Entrega"
67 67  
  68 +#: plugins/shopping_cart/views/shopping_cart_plugin_myprofile/edit.html.erb:7
  69 +msgid "Delivery or pickup"
  70 +msgstr "Forma de retirada ou entrega"
  71 +
  72 +#: plugins/shopping_cart/views/shopping_cart_plugin_myprofile/edit.html.erb:7
  73 +msgid "Deliveries or pickups"
  74 +msgstr "Formas de retirada ou entrega"
  75 +
  76 +#: plugins/delivery/views/delivery_plugin/_order_select.html.slim
  77 +msgid "Instructions"
  78 +msgstr "Instruções"
  79 +
68 80 #: plugins/shopping_cart/lib/shopping_cart_plugin/cart_helper.rb:53
69 81 msgid "Item name"
70 82 msgstr "Nome do item"
... ... @@ -86,6 +98,10 @@ msgstr &quot;[%s] Você tem um novo pedido de compra de %s.&quot;
86 98 msgid "Request sent successfully. Check your email."
87 99 msgstr "Requisição enviada com sucesso. Cheque seu email."
88 100  
  101 +#: plugins/shopping_cart/controllers/shopping_cart_plugin_controller.rb:115
  102 +msgid "Your order has been sent successfully! You will receive a confirmation e-mail shortly."
  103 +msgstr "Seu pedido foi enviado com sucesso! Você receberá uma confirmação em breve."
  104 +
89 105 #: plugins/shopping_cart/controllers/shopping_cart_plugin_controller.rb:138
90 106 msgid "Basket displayed."
91 107 msgstr "Cesto exibido."
... ... @@ -134,18 +150,15 @@ msgstr &quot;Opção foi atualizada com sucesso.&quot;
134 150 msgid "Option wasn't updated successfully."
135 151 msgstr "Opção não foi atualizada com sucesso."
136 152  
137   -#: plugins/shopping_cart/views/shopping_cart_plugin_profile/buy.html.erb:6
138 153 #: plugins/shopping_cart/views/shopping_cart_plugin_myprofile/_orders_list.html.erb:35
139 154 #: plugins/shopping_cart/views/shopping_cart_plugin/buy.html.erb:5
140 155 msgid "Name"
141 156 msgstr "Nome"
142 157  
143   -#: plugins/shopping_cart/views/shopping_cart_plugin_profile/buy.html.erb:10
144 158 #: plugins/shopping_cart/views/shopping_cart_plugin/buy.html.erb:13
145   -msgid "Delivery Address"
146   -msgstr "Endereço de Entrega"
  159 +msgid "Delivery or pickup method"
  160 +msgstr "Forma de entrega ou retirada"
147 161  
148   -#: plugins/shopping_cart/views/shopping_cart_plugin_profile/buy.html.erb:16
149 162 #: plugins/shopping_cart/views/shopping_cart_plugin/buy.html.erb:22
150 163 msgid "Send buy request"
151 164 msgstr "Enviar pedido de compra"
... ... @@ -176,10 +189,9 @@ msgstr &quot;Estado&quot;
176 189 msgid "E-mail"
177 190 msgstr "E-mail"
178 191  
179   -#: plugins/shopping_cart/views/shopping_cart_plugin_myprofile/_orders_list.html.erb:35
180   -#: plugins/shopping_cart/views/shopping_cart_plugin/buy.html.erb:8
181   -msgid "Delivery option"
182   -msgstr "Opção de entrega"
  192 +#: plugins/shopping_cart/views/shopping_cart_plugin/buy.html.erb:9
  193 +msgid "Personal identification"
  194 +msgstr "Identificação pessoal"
183 195  
184 196 #: plugins/shopping_cart/views/shopping_cart_plugin_myprofile/_orders_list.html.erb:35
185 197 #: plugins/shopping_cart/views/shopping_cart_plugin/mailer/customer_notification.html.erb:20
... ... @@ -188,12 +200,20 @@ msgstr &quot;Opção de entrega&quot;
188 200 msgid "Payment"
189 201 msgstr "Pagamento"
190 202  
  203 +#: plugins/shopping_cart/views/shopping_cart_plugin/buy.html.erb:9
  204 +msgid "Payment's method"
  205 +msgstr "Forma de pagamento"
  206 +
191 207 #: plugins/shopping_cart/views/shopping_cart_plugin_myprofile/_orders_list.html.erb:35
192 208 #: plugins/shopping_cart/views/shopping_cart_plugin/mailer/customer_notification.html.erb:22
193 209 #: plugins/shopping_cart/views/shopping_cart_plugin/mailer/supplier_notification.html.erb:20
194 210 #: plugins/shopping_cart/views/shopping_cart_plugin/buy.html.erb:10
195 211 msgid "shopping_cart|Change"
196   -msgstr "Troco"
  212 +msgstr "Troco para"
  213 +
  214 +#: plugins/shopping_cart/views/shopping_cart_plugin/buy.html.erb:10
  215 +msgid "Your Order"
  216 +msgstr "Seu Pedido"
197 217  
198 218 #: plugins/shopping_cart/views/shopping_cart_plugin_myprofile/_products_list.html.erb:7
199 219 msgid "Quantity"
... ... @@ -303,42 +323,30 @@ msgid &quot;Hi %s!&quot;
303 323 msgstr "Olá %s!"
304 324  
305 325 #: plugins/shopping_cart/views/shopping_cart_plugin/mailer/customer_notification.html.erb:10
306   -msgid "This is a notification e-mail about your buy request on %s."
307   -msgstr "Esse é um email de notificação sobre o seu pedido de compra em %s."
  326 +msgid "This is a notification e-mail about your buy request on the enterprise %s."
  327 +msgstr "Esse é um email de notificação sobre o seu pedido de compra no empreendimento %s."
308 328  
309 329 #: plugins/shopping_cart/views/shopping_cart_plugin/mailer/customer_notification.html.erb:11
310 330 msgid ""
311   -"The supplier already received your buy request and may contact you for "
  331 +"The enterprise already received your buy request and will contact you for "
312 332 "confirmation."
313 333 msgstr ""
314   -"O fornecedor já recebeu o seu pedido de compra e deve te contactar para "
  334 +"O empreendimento já recebeu o seu pedido de compra e entrará em contato para "
315 335 "confirmação."
316 336  
317 337 #: plugins/shopping_cart/views/shopping_cart_plugin/mailer/customer_notification.html.erb:12
318   -msgid "If you have any doubts, contact us at: %s"
319   -msgstr "Se você tem alguma dúvida, nos contacte em: %s"
  338 +msgid "If you have any doubts about your order, write to us at: %s."
  339 +msgstr "Se você tem alguma dúvida sobre o seu pedido, nos escreva: %s."
320 340  
321 341 #: plugins/shopping_cart/views/shopping_cart_plugin/mailer/customer_notification.html.erb:13
322   -msgid "Please check if your information below is correct:"
323   -msgstr "Por favor cheque se suas informações abaixo estão corretas:"
  342 +msgid "Review below the informations of your order:"
  343 +msgstr "Abaixo, revise as informações do seu pedido:"
324 344  
325 345 #: plugins/shopping_cart/views/shopping_cart_plugin/mailer/customer_notification.html.erb:19
326 346 #: plugins/shopping_cart/views/shopping_cart_plugin/mailer/supplier_notification.html.erb:17
327 347 msgid "Phone number"
328 348 msgstr "Telefone"
329 349  
330   -#: plugins/shopping_cart/views/shopping_cart_plugin/mailer/customer_notification.html.erb:20
331   -#: plugins/shopping_cart/views/shopping_cart_plugin/mailer/supplier_notification.html.erb:18
332   -#: plugins/shopping_cart/views/shopping_cart_plugin/buy.html.erb:9
333   -msgid "Money"
334   -msgstr "Dinheiro"
335   -
336   -#: plugins/shopping_cart/views/shopping_cart_plugin/mailer/customer_notification.html.erb:20
337   -#: plugins/shopping_cart/views/shopping_cart_plugin/mailer/supplier_notification.html.erb:18
338   -#: plugins/shopping_cart/views/shopping_cart_plugin/buy.html.erb:9
339   -msgid "shopping_cart|Check"
340   -msgstr "Cheque"
341   -
342 350 #: plugins/shopping_cart/views/shopping_cart_plugin/mailer/customer_notification.html.erb:47
343 351 msgid "Here are the products you bought:"
344 352 msgstr "Aqui estão os produtos que você pediu:"
... ... @@ -368,3 +376,17 @@ msgstr &quot;E aqui estão os itens pedidos por esse consumidor:&quot;
368 376 msgid "If there are any problems with this email contact the admin of %s."
369 377 msgstr ""
370 378 "Se houver algum problema com esse email contacte o administrador de %s."
  379 +
  380 +#: plugins/shopping_cart/views/shopping_cart_plugin/buy.html.erb:15
  381 +msgid "Address completion"
  382 +msgstr "Complemento (p.ex. apto)"
  383 +
  384 +#:
  385 +msgid "repeat order"
  386 +msgstr "repetir pedido"
  387 +
  388 +#: plugins/shopping_cart/views/shopping_cart_plugin/buy.html.erb
  389 +msgid "haven't finished yet: back to shopping"
  390 +msgstr "ainda não concluí: voltar às compras"
  391 +
  392 +
... ...
plugins/shopping_cart/po/ru/shopping_cart.po
... ... @@ -5,8 +5,8 @@
5 5 #
6 6 msgid ""
7 7 msgstr ""
8   -"Project-Id-Version: 1.1-166-gaf47713\n"
9   -"POT-Creation-Date: 2015-06-01 17:26-0300\n"
  8 +"Project-Id-Version: 1.0-690-gcb6e853\n"
  9 +"POT-Creation-Date: 2015-03-05 12:09-0300\n"
10 10 "PO-Revision-Date: 2015-02-23 11:36+0200\n"
11 11 "Last-Translator: Michal Čihař <michal@cihar.com>\n"
12 12 "Language-Team: Russian <https://hosted.weblate.org/projects/noosfero/plugin-"
... ... @@ -15,8 +15,8 @@ msgstr &quot;&quot;
15 15 "MIME-Version: 1.0\n"
16 16 "Content-Type: text/plain; charset=UTF-8\n"
17 17 "Content-Transfer-Encoding: 8bit\n"
18   -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
19   -"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
  18 +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<="
  19 +"4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
20 20 "X-Generator: Weblate 2.3-dev\n"
21 21  
22 22 #: plugins/shopping_cart/lib/shopping_cart_plugin.rb:9
... ...
plugins/shopping_cart/public/buy.js
1   -jQuery(document).ready(function(){
2   - jQuery("#cart-request-form").validate({
3   - submitHandler: function(form) {
4   - jQuery(form).find('input.submit').attr('disabled', true);
5   - jQuery('#cboxLoadingOverlay').show().addClass('loading');
6   - jQuery('#cboxLoadingGraphic').show().addClass('loading');
7   - }
8   - });
9   -});
  1 +shopping_cart.buy = {
10 2  
11   -jQuery('#delivery_option').change(function(){
12   - jQuery('#cboxLoadingGraphic').show();
13   - me = this;
14   - profile = jQuery(me).attr('data-profile-identifier');
15   - option = jQuery(me).val();
16   - jQuery.ajax({
17   - url: '/plugin/shopping_cart/update_delivery_option',
18   - dataType: "json",
19   - data: 'delivery_option='+option,
20   - success: function(data, st, ajax) {
21   - jQuery('#delivery-price').text(data.delivery_price);
22   - jQuery('.cart-table-total-value').text(data.total_price);
23   - jQuery('#delivery-name').text(option);
24   - jQuery('#cboxLoadingGraphic').hide();
25   - },
26   - error: function(ajax, st, errorThrown) {
27   - alert('Update delivery option - HTTP '+st+': '+errorThrown);
28   - },
29   - });
30   -});
  3 + validate: function() {
  4 + $("#cart-request-form").validate({
  5 + submitHandler: function(form) {
  6 + $(form).find('input.submit').attr('disabled', true);
  7 + $('#cboxLoadingOverlay').show().addClass('loading');
  8 + $('#cboxLoadingGraphic').show().addClass('loading');
  9 + }
  10 + });
  11 + },
  12 +
  13 + update_delivery: function () {
  14 + $('#cboxLoadingGraphic').show();
  15 + var me = $(this);
  16 + var profile = me.attr('data-profile-identifier');
  17 + var id = me.val();
  18 + var name = me.find('option:selected').attr('data-label');
  19 + $.ajax({
  20 + url: '/plugin/shopping_cart/update_supplier_delivery',
  21 + dataType: "json",
  22 + data: 'order[supplier_delivery_id]='+id,
  23 + success: function(data, st, ajax) {
  24 + $('#delivery-price').text(data.delivery_price);
  25 + $('.cart-table-total-value').text(data.total_price);
  26 + $('#delivery-name').text(name);
  27 + $('#cboxLoadingGraphic').hide();
  28 + display_notice(data.message)
  29 + },
  30 + error: function(ajax, st, errorThrown) {
  31 + alert('Update delivery option - HTTP '+st+': '+errorThrown);
  32 + },
  33 + });
  34 + },
  35 +
  36 + update_payment: function() {
  37 + var payment = $(this)
  38 + var form = $(payment.get(0).form)
  39 + var changeField = form.find('#order_payment_data_change').parents('.form-group');
  40 + var method = payment.val() == 'money' ? 'slideDown' : 'slideUp';
  41 + changeField[method]('fast');
  42 + },
  43 +}
  44 +
  45 +$(document).ready(shopping_cart.buy.validate)
  46 +$('#order_supplier_delivery_id').on('change keyup', shopping_cart.buy.update_delivery)
  47 +$('#order_payment_data_method').on('change keyup', shopping_cart.buy.update_payment)
31 48  
32   -jQuery('#customer_payment').change(function(){
33   - jQuery(this).closest('.formfieldline').next().slideToggle('fast');
34   -});
... ...
plugins/shopping_cart/public/cart.js
  1 +shopping_cart = {
  2 +}
  3 +
1 4 function Cart(config) {
2 5 var $ = jQuery;
  6 + config.minimized = Cart.minimized;
3 7 Cart.instance = this; // this may be a list on the future;
4   - this.cartElem = $("#cart1")[0];
  8 + this.cartElem = $("#cart1");
5 9 this.cartElem.cartObj = this;
6   - this.contentBox = $("#cart1 .cart-content");
  10 + this.contentBox = (config.minimized) ? $("#cart1 .cart-inner") : $("#cart1 .cart-inner .cart-content");
7 11 this.itemsBox = $("#cart1 .cart-items");
  12 + this.profileId = config.profile_id;
8 13 this.items = {};
  14 + this.products = config.products;
9 15 this.empty = !config.has_products;
  16 + this.minimized = config.minimized;
  17 + this.hasPreviousOrders = config.has_previous_orders;
10 18 this.visible = false;
  19 + this.itemTemplate = _.template(jQuery('#cart-item-template').html());
  20 + $("#cart-profile-name").text(config.profile_short_name);
11 21 $(".cart-buy", this.cartElem).button({ icons: { primary: 'ui-icon-cart'} });
12   - if (!this.empty) {
13   - $(this.cartElem).show();
14   - this.visible = config.visible;
15   - this.addToList(config.products, true)
16   - }
  22 + this.load()
17 23 }
18 24  
19 25 (function($){
20   -
21 26 // Forbidding the user to request more the one action on the cart
22   - // simultaneously because the cart in the cookie doesn't supports it.
  27 + // simultaneously because the cart in the cookie doesn't support it.
23 28 Cart.prototype.ajax = function(config){
24 29 var me = this;
25 30 this.disabled = true;
... ... @@ -31,6 +36,17 @@ function Cart(config) {
31 36 $.ajax(config);
32 37 }
33 38  
  39 + Cart.prototype.load = function(){
  40 + if (!this.empty) {
  41 + if (!this.minimized) {
  42 + $(this.cartElem).show();
  43 + }
  44 + this.addToList(this.products, true)
  45 + } else if (this.minimized) {
  46 + this.setQuantity(0)
  47 + }
  48 + }
  49 +
34 50 Cart.prototype.addToList = function(products, clear) {
35 51 if( clear ) this.itemsBox.empty();
36 52 var me = this;
... ... @@ -38,17 +54,12 @@ function Cart(config) {
38 54 for( var item,i=0; item=products[i]; i++ ) {
39 55 this.items[item.id] = { price:item.price, quantity:item.quantity };
40 56 this.updateTotal();
41   - var liId = "cart-item-"+item.id;
42   - var li = $("#"+liId);
43   - if( !li[0] ) li = $('<li id="'+liId+'"></li>\n').appendTo(this.itemsBox);
44   - li.empty();
45   - $('<div class="picture" style="background-image:url('+item.picture+')"></div>' +
46   - '<span class="item-name">'+ item.name +'</span>' +
47   - '<div class="item-price">' +
48   - '<input size="1" value="'+item.quantity+'" />'+ (item.price ? '&times; '+ item.price : '') +'</div>' +
49   - ' <a href="remove:'+item.name+'" onclick="Cart.removeItem('+item.id+'); return false"' +
50   - ' class="button icon-remove"><span>remove</span></a>'
51   - ).appendTo(li);
  57 + item.priceTxt = (item.price) ? '&times;' + item.price : '';
  58 +
  59 + jQuery('#cart-item-'+item.id).remove()
  60 + var li = jQuery(this.itemTemplate({item: item}))
  61 + li.appendTo(this.itemsBox);
  62 +
52 63 var input = $("input", li)[0];
53 64 input.lastValue = input.value;
54 65 input.productId = item.id;
... ... @@ -67,16 +78,24 @@ function Cart(config) {
67 78 li.animate({ backgroundColor: liBg }, 1000);
68 79 }
69 80  
70   - if (!clear && this.empty) $(this.cartElem).show();
71   - if((!clear && this.empty) || (this.visible && clear)) {
72   - this.contentBox.hide();
73   - this.show(!clear);
  81 + if (!Cart.minimized) {
  82 + if (!clear && this.empty) $(this.cartElem).show();
  83 + if((!clear && this.empty) || (this.visible && clear)) {
  84 + this.contentBox.hide();
  85 + }
  86 + } else {
  87 + if (!clear) {
  88 + $( ".cart-applet .cart-applet-indicator" ).addClass( 'cart-highlight' );
  89 + $( ".cart-applet" ).effect('bounce', 300, function(){
  90 + $( ".cart-applet .cart-applet-indicator" ).removeClass( 'cart-highlight' );
  91 + });
  92 + }
74 93 }
75 94 this.empty = false;
76 95 }
77 96  
78 97 Cart.prototype.updateQuantity = function(input, itemId, quantity) {
79   - if(this.disabled) return alert(shoppingCartPluginL10n.waitLastRequest);
  98 + if(this.disabled) return alert(Cart.l10n.waitLastRequest);
80 99 quantity = parseInt(quantity);
81 100 input.disabled = true;
82 101 var originalBg = input.style.backgroundImage;
... ... @@ -117,24 +136,16 @@ function Cart(config) {
117 136 }
118 137  
119 138 Cart.addItem = function(itemId, link) {
120   - if(this.instance.disabled) return alert(shoppingCartPluginL10n.waitLastRequest);
  139 + if(this.instance.disabled) return alert(Cart.l10n.waitLastRequest);
121 140 if ( this.productsLength > 100 ) {
122 141 // This limit protect the user from losing data on cookie limit.
123 142 // This is NOT limiting to 100 products, is limiting to 100 kinds of products.
124   - alert(shoppingCartPluginL10n.maxNumberOfItens);
  143 + alert(Cart.l10n.maxNumberOfItens);
125 144 return false;
126 145 }
127   - link.intervalId = setInterval(function() {
128   - $(link).addClass('loading');
129   - steps = ['w', 'n', 'e', 's'];
130   - if( !link.step || link.step==3 ) link.step = 0;
131   - link.step++;
132   - $(link).button({ icons: { primary: 'ui-icon-arrowrefresh-1-'+steps[link.step]}})
133   - }, 100);
  146 + $(link).addClass('small-loading');
134 147 var stopBtLoading = function() {
135   - clearInterval(link.intervalId);
136   - $(link).removeClass('loading');
137   - $(link).button({ icons: { primary: 'ui-icon-cart'}});
  148 + $(link).removeClass('small-loading');
138 149 };
139 150 this.instance.addItem(itemId, stopBtLoading);
140 151 }
... ... @@ -145,7 +156,12 @@ function Cart(config) {
145 156 url: '/plugin/shopping_cart/add/'+ itemId,
146 157 dataType: 'json',
147 158 success: function(data, status, ajax){
148   - if ( !data.ok ) log.error('Shopping cart data failure', data.error);
  159 + if ( !data.ok ) {
  160 + if (typeof data.error.message != "undefined")
  161 + alert(data.error.message)
  162 + else
  163 + log.error('Shopping cart data failure', data.error);
  164 + }
149 165 else me.addToList(data.products);
150 166 },
151 167 cache: false,
... ... @@ -157,8 +173,8 @@ function Cart(config) {
157 173 }
158 174  
159 175 Cart.removeItem = function(itemId) {
160   - if(this.instance.disabled) return alert(shoppingCartPluginL10n.waitLastRequest);
161   - if( confirm(shoppingCartPluginL10n.removeItem) ) this.instance.removeItem(itemId);
  176 + if(this.instance.disabled) return alert(Cart.l10n.waitLastRequest);
  177 + if( confirm(Cart.l10n.removeItem) ) this.instance.removeItem(itemId);
162 178 }
163 179  
164 180 Cart.prototype.removeItem = function(itemId) {
... ... @@ -179,11 +195,51 @@ function Cart(config) {
179 195 }
180 196  
181 197 Cart.toggle = function(link) {
182   - if(this.instance.disabled) return alert(shoppingCartPluginL10n.waitLastRequest);
  198 + if(this.instance.disabled) return alert(Cart.l10n.waitLastRequest);
183 199 link.parentNode.parentNode.cartObj.toggle();
184 200 }
185 201 Cart.prototype.toggle = function() {
186   - this.visible ? this.hide(true) : this.show(true);
  202 + if (this.empty && this.hasPreviousOrders)
  203 + noosfero.modal.url('/plugin/shopping_cart/repeat?profile_id='+cart.profileId)
  204 + else
  205 + this.visible ? this.hide(true) : this.show(true)
  206 + }
  207 +
  208 + Cart.prototype.repeat = function(order_id, callback) {
  209 + this.ajax({
  210 + url: '/plugin/shopping_cart/repeat/'+order_id+'?profile_id='+cart.profileId,
  211 + success: function(data) {
  212 + cart.addToList(data.products, true)
  213 + callback(data)
  214 + },
  215 + // can't do POST because of firefox cookie reset bug
  216 + type: 'GET', dataType: 'json', cache: false
  217 + })
  218 + }
  219 +
  220 + Cart.prototype.repeatCheckout = function(event, button) {
  221 + var order_id = jQuery(button).attr('data-order-id')
  222 + this.repeat(order_id, function(data) {
  223 + window.location.href = '/plugin/shopping_cart/buy'
  224 + })
  225 + event.stopPropagation()
  226 + return false;
  227 + }
  228 +
  229 + Cart.prototype.repeatChoose = function(event, button) {
  230 + var order_id = jQuery(button).attr('data-order-id')
  231 + this.repeat(order_id, function(data) {
  232 + noosfero.modal.close()
  233 + cart.show(true);
  234 + })
  235 + event.stopPropagation()
  236 + return false;
  237 + }
  238 +
  239 + Cart.prototype.clearOrdersSession = function() {
  240 + noosfero.modal.close()
  241 + cart.hasPreviousOrders = false;
  242 + cart.setQuantity(0)
187 243 }
188 244  
189 245 Cart.prototype.show = function(register) {
... ... @@ -221,7 +277,7 @@ function Cart(config) {
221 277 }
222 278  
223 279 Cart.prototype.updateTotal = function() {
224   - var total = 0;
  280 + var total = qtty = 0;
225 281 var currency, sep = "";
226 282 for( var itemId in this.items ) {
227 283 var item = this.items[itemId];
... ... @@ -230,15 +286,27 @@ function Cart(config) {
230 286 sep = item.price.charAt(item.price.length-3);
231 287 var price = item.price.replace(/[^0-9]/g,"");
232 288 total += item.quantity * parseFloat(price);
  289 + qtty += item.quantity;
233 290 }
234 291 }
235 292 total = Math.round(total).toString().replace(/(..)$/, sep+"$1")
236 293 $(".cart-total b", this.cartElem).text( ( (total!=0) ? currency+" "+total : "---" ) );
  294 + this.setQuantity(qtty)
  295 + }
  296 +
  297 + Cart.prototype.setQuantity = function(qtty) {
  298 + this.cartElem.find('.cart-applet-checkout').toggle(qtty > 0)
  299 + this.cartElem.find('.cart-applet-checkout-disabled').toggle(qtty === 0)
  300 +
  301 + if (qtty === 0 && this.hasPreviousOrders)
  302 + $(".cart-qtty", this.cartElem).text( Cart.l10n.repeatOrder )
  303 + else
  304 + $(".cart-qtty", this.cartElem).text( qtty )
237 305 }
238 306  
239 307 Cart.clean = function(link) {
240   - if(this.instance.disabled) return alert(shoppingCartPluginL10n.waitLastRequest);
241   - if( confirm(shoppingCartPluginL10n.cleanCart) ) link.parentNode.parentNode.parentNode.cartObj.clean();
  308 + if(this.instance.disabled) return alert(Cart.l10n.waitLastRequest);
  309 + if( confirm(Cart.l10n.cleanCart) ) link.parentNode.parentNode.parentNode.cartObj.clean();
242 310 }
243 311  
244 312 Cart.prototype.clean = function() {
... ... @@ -250,9 +318,9 @@ function Cart(config) {
250 318 if ( !data.ok ) log.error(data.error);
251 319 else{
252 320 me.items = {};
253   - $(me.cartElem).slideUp(500, function() {
  321 + $(me.contentBox).slideUp(500, function() {
254 322 $(me.itemsBox).empty();
255   - me.hide();
  323 + //me.hide();
256 324 me.updateTotal();
257 325 me.empty = true;
258 326 });
... ... @@ -277,21 +345,8 @@ function Cart(config) {
277 345 type: 'POST',
278 346 url: '/plugin/shopping_cart/send_request',
279 347 data: params,
280   - dataType: 'json',
281   - success: function(data, status, ajax){
282   - if ( !data.ok ) display_notice(data.error.message);
283   - else {
284   - me.clean();
285   - display_notice(data.message);
286   - }
287   - },
  348 + dataType: 'script',
288 349 cache: false,
289   - error: function(ajax, status, errorThrown) {
290   - log.error('Send request - HTTP '+status, errorThrown);
291   - },
292   - complete: function() {
293   - noosfero.modal.close();
294   - }
295 350 });
296 351 }
297 352  
... ... @@ -301,31 +356,4 @@ function Cart(config) {
301 356 Cart.unloadingPage = true;
302 357 });
303 358  
304   - $(function(){
305   -
306   - $.ajax({
307   - url: "/plugin/shopping_cart/get",
308   - dataType: 'json',
309   - success: function(data) {
310   - new Cart(data);
311   - $('.cart-add-item').button({ icons: { primary: 'ui-icon-cart'} })
312   - },
313   - cache: false,
314   - error: function(ajax, status, errorThrown) {
315   - // Give some time to register page unload.
316   - setTimeout(function() {
317   - // page unload is not our problem.
318   - if (Cart.unloadingPage) {
319   - log('Page unload before cart load.');
320   - } else {
321   - log.error('Error getting shopping cart - HTTP '+status, errorThrown);
322   - if ( confirm(shoppingCartPluginL10n.getProblemConfirmReload) ) {
323   - document.location.reload();
324   - }
325   - }
326   - }, 100);
327   - }
328   - });
329   - });
330   -
331 359 })(jQuery);
... ...
plugins/shopping_cart/public/edit.js
1   -jQuery('#settings_delivery').click(function(){
2   - jQuery('#delivery_settings').toggle('fast');
  1 +$('#settings_enabled').click(function(){
  2 + $('#delivery-settings').toggle('fast');
3 3 });
  4 +$('#delivery-settings').toggle($('#settings_enabled').prop('checked'))
4 5  
5   -jQuery('#add-new-option').click(function(){
6   - new_option = jQuery('#empty-option').clone();
  6 +$('#add-new-option').click(function(){
  7 + new_option = $('#empty-option').clone();
7 8 new_option.removeAttr('id');
8   - jQuery('#add-new-option-row').before(new_option);
  9 + $('#add-new-option-row').before(new_option);
9 10 new_option.show();
10 11 return false;
11 12 });
12 13  
13   -jQuery('.remove-option').live('click', function(){
14   - jQuery(this).closest('tr').remove();
  14 +$('.remove-option').live('click', function(){
  15 + $(this).closest('tr').remove();
15 16 return false;
16 17 });
  18 +
... ...
plugins/shopping_cart/public/images/control-panel/purchase-report.gif

1.6 KB

plugins/shopping_cart/public/images/control-panel/purchase-report.png

3.13 KB

plugins/shopping_cart/public/images/control-panel/purchase-report.svg
... ... @@ -1,742 +0,0 @@
1   -<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2   -<!-- Created with Inkscape (http://www.inkscape.org/) -->
3   -
4   -<svg
5   - xmlns:dc="http://purl.org/dc/elements/1.1/"
6   - xmlns:cc="http://creativecommons.org/ns#"
7   - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8   - xmlns:svg="http://www.w3.org/2000/svg"
9   - xmlns="http://www.w3.org/2000/svg"
10   - xmlns:xlink="http://www.w3.org/1999/xlink"
11   - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
12   - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
13   - width="48"
14   - height="48"
15   - id="svg2"
16   - version="1.1"
17   - inkscape:version="0.48.2 r9819"
18   - sodipodi:docname="purchase-report.svg"
19   - inkscape:export-filename="/home/aurium/purchase-report.png"
20   - inkscape:export-xdpi="90"
21   - inkscape:export-ydpi="90">
22   - <defs
23   - id="defs4">
24   - <linearGradient
25   - inkscape:collect="always"
26   - id="linearGradient4980">
27   - <stop
28   - style="stop-color:#2e3436;stop-opacity:1;"
29   - offset="0"
30   - id="stop4982" />
31   - <stop
32   - style="stop-color:#babdb6;stop-opacity:0"
33   - offset="1"
34   - id="stop4984" />
35   - </linearGradient>
36   - <linearGradient
37   - id="linearGradient4962"
38   - inkscape:collect="always">
39   - <stop
40   - id="stop4964"
41   - offset="0"
42   - style="stop-color:#ffffff;stop-opacity:0" />
43   - <stop
44   - id="stop4966"
45   - offset="1"
46   - style="stop-color:#ffffff;stop-opacity:1" />
47   - </linearGradient>
48   - <linearGradient
49   - inkscape:collect="always"
50   - id="linearGradient4952">
51   - <stop
52   - style="stop-color:#555753;stop-opacity:1;"
53   - offset="0"
54   - id="stop4954" />
55   - <stop
56   - style="stop-color:#888a85;stop-opacity:1"
57   - offset="1"
58   - id="stop4956" />
59   - </linearGradient>
60   - <linearGradient
61   - inkscape:collect="always"
62   - id="linearGradient4944">
63   - <stop
64   - style="stop-color:#888a85;stop-opacity:1;"
65   - offset="0"
66   - id="stop4946" />
67   - <stop
68   - style="stop-color:#555753;stop-opacity:1"
69   - offset="1"
70   - id="stop4948" />
71   - </linearGradient>
72   - <linearGradient
73   - inkscape:collect="always"
74   - id="linearGradient4914">
75   - <stop
76   - style="stop-color:#cccccc;stop-opacity:1"
77   - offset="0"
78   - id="stop4916" />
79   - <stop
80   - style="stop-color:#4d4d4d;stop-opacity:1"
81   - offset="1"
82   - id="stop4918" />
83   - </linearGradient>
84   - <linearGradient
85   - inkscape:collect="always"
86   - id="linearGradient4853">
87   - <stop
88   - style="stop-color:#000000;stop-opacity:1;"
89   - offset="0"
90   - id="stop4855" />
91   - <stop
92   - style="stop-color:#000000;stop-opacity:0;"
93   - offset="1"
94   - id="stop4857" />
95   - </linearGradient>
96   - <inkscape:perspective
97   - sodipodi:type="inkscape:persp3d"
98   - inkscape:vp_x="0 : 526.18109 : 1"
99   - inkscape:vp_y="0 : 1000 : 0"
100   - inkscape:vp_z="744.09448 : 526.18109 : 1"
101   - inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
102   - id="perspective10" />
103   - <inkscape:perspective
104   - id="perspective3634"
105   - inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
106   - inkscape:vp_z="1 : 0.5 : 1"
107   - inkscape:vp_y="0 : 1000 : 0"
108   - inkscape:vp_x="0 : 0.5 : 1"
109   - sodipodi:type="inkscape:persp3d" />
110   - <inkscape:perspective
111   - id="perspective3659"
112   - inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
113   - inkscape:vp_z="1 : 0.5 : 1"
114   - inkscape:vp_y="0 : 1000 : 0"
115   - inkscape:vp_x="0 : 0.5 : 1"
116   - sodipodi:type="inkscape:persp3d" />
117   - <inkscape:perspective
118   - id="perspective4618"
119   - inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
120   - inkscape:vp_z="1 : 0.5 : 1"
121   - inkscape:vp_y="0 : 1000 : 0"
122   - inkscape:vp_x="0 : 0.5 : 1"
123   - sodipodi:type="inkscape:persp3d" />
124   - <linearGradient
125   - id="linearGradient2251">
126   - <stop
127   - style="stop-color:#ffffff;stop-opacity:1;"
128   - offset="0"
129   - id="stop2253" />
130   - <stop
131   - style="stop-color:#ffffff;stop-opacity:0;"
132   - offset="1"
133   - id="stop2255" />
134   - </linearGradient>
135   - <linearGradient
136   - inkscape:collect="always"
137   - xlink:href="#linearGradient2224"
138   - id="linearGradient4602"
139   - gradientUnits="userSpaceOnUse"
140   - gradientTransform="translate(3.2628514,1006.5776)"
141   - x1="36.237148"
142   - y1="41.284599"
143   - x2="33.664921"
144   - y2="37.770721" />
145   - <linearGradient
146   - id="linearGradient2224">
147   - <stop
148   - style="stop-color:#7c7c7c;stop-opacity:1;"
149   - offset="0"
150   - id="stop2226" />
151   - <stop
152   - style="stop-color:#b8b8b8;stop-opacity:1;"
153   - offset="1"
154   - id="stop2228" />
155   - </linearGradient>
156   - <linearGradient
157   - inkscape:collect="always"
158   - xlink:href="#linearGradient2259"
159   - id="linearGradient4605"
160   - gradientUnits="userSpaceOnUse"
161   - gradientTransform="matrix(0.999421,0,0,1,-5.0089689,998.39565)"
162   - x1="26.076092"
163   - y1="26.696676"
164   - x2="30.811172"
165   - y2="42.007351" />
166   - <linearGradient
167   - inkscape:collect="always"
168   - id="linearGradient2259">
169   - <stop
170   - style="stop-color:#ffffff;stop-opacity:1;"
171   - offset="0"
172   - id="stop2261" />
173   - <stop
174   - style="stop-color:#ffffff;stop-opacity:0;"
175   - offset="1"
176   - id="stop2263" />
177   - </linearGradient>
178   - <linearGradient
179   - inkscape:collect="always"
180   - xlink:href="#linearGradient15218"
181   - id="linearGradient4608"
182   - gradientUnits="userSpaceOnUse"
183   - gradientTransform="matrix(1.067236,0,0,0.989276,4.391684,4.035227)"
184   - x1="22.308331"
185   - y1="18.99214"
186   - x2="35.785294"
187   - y2="39.498238" />
188   - <linearGradient
189   - id="linearGradient15218">
190   - <stop
191   - style="stop-color:#f0f0ef;stop-opacity:1.0000000;"
192   - offset="0.0000000"
193   - id="stop15220" />
194   - <stop
195   - id="stop2269"
196   - offset="0.59928656"
197   - style="stop-color:#e8e8e8;stop-opacity:1;" />
198   - <stop
199   - id="stop2267"
200   - offset="0.82758623"
201   - style="stop-color:#ffffff;stop-opacity:1;" />
202   - <stop
203   - style="stop-color:#d8d8d3;stop-opacity:1.0000000;"
204   - offset="1.0000000"
205   - id="stop15222" />
206   - </linearGradient>
207   - <inkscape:perspective
208   - id="perspective4722"
209   - inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
210   - inkscape:vp_z="1 : 0.5 : 1"
211   - inkscape:vp_y="0 : 1000 : 0"
212   - inkscape:vp_x="0 : 0.5 : 1"
213   - sodipodi:type="inkscape:persp3d" />
214   - <linearGradient
215   - y2="-968.28137"
216   - x2="46.01725"
217   - y1="-987.48724"
218   - x1="31.962252"
219   - gradientTransform="matrix(1.067236,0,0,0.989276,-9.611267,2002.7597)"
220   - gradientUnits="userSpaceOnUse"
221   - id="linearGradient4644-0"
222   - xlink:href="#linearGradient15218-5"
223   - inkscape:collect="always" />
224   - <linearGradient
225   - id="linearGradient15218-5">
226   - <stop
227   - style="stop-color:#f0f0ef;stop-opacity:1.0000000;"
228   - offset="0.0000000"
229   - id="stop15220-1" />
230   - <stop
231   - id="stop2269-8"
232   - offset="0.59928656"
233   - style="stop-color:#e8e8e8;stop-opacity:1;" />
234   - <stop
235   - id="stop2267-9"
236   - offset="0.82758623"
237   - style="stop-color:#ffffff;stop-opacity:1;" />
238   - <stop
239   - style="stop-color:#d8d8d3;stop-opacity:1.0000000;"
240   - offset="1.0000000"
241   - id="stop15222-1" />
242   - </linearGradient>
243   - <linearGradient
244   - y2="39.498238"
245   - x2="35.785294"
246   - y1="18.99214"
247   - x1="22.308331"
248   - gradientTransform="matrix(1.067236,0,0,0.989276,-11.611266,-5.9647499)"
249   - gradientUnits="userSpaceOnUse"
250   - id="linearGradient4733"
251   - xlink:href="#linearGradient15218-5"
252   - inkscape:collect="always" />
253   - <linearGradient
254   - inkscape:collect="always"
255   - xlink:href="#linearGradient4853"
256   - id="linearGradient4870"
257   - gradientUnits="userSpaceOnUse"
258   - x1="32.5"
259   - y1="1026.8622"
260   - x2="36.5"
261   - y2="1026.8622"
262   - gradientTransform="translate(0,15)" />
263   - <linearGradient
264   - inkscape:collect="always"
265   - xlink:href="#linearGradient4914"
266   - id="linearGradient4926"
267   - gradientUnits="userSpaceOnUse"
268   - x1="21.5"
269   - y1="16.5"
270   - x2="32.5"
271   - y2="38.5"
272   - gradientTransform="translate(0,1004.3622)" />
273   - <mask
274   - maskUnits="userSpaceOnUse"
275   - id="mask4922">
276   - <rect
277   - style="color:#000000;fill:url(#linearGradient4926);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
278   - id="rect4924"
279   - width="34"
280   - height="41"
281   - x="7.5"
282   - y="1006.8622" />
283   - </mask>
284   - <filter
285   - inkscape:collect="always"
286   - id="filter4938"
287   - x="-0.063571429"
288   - width="1.1271429"
289   - y="-1.0679999"
290   - height="3.1359998">
291   - <feGaussianBlur
292   - inkscape:collect="always"
293   - stdDeviation="1.1124999"
294   - id="feGaussianBlur4940" />
295   - </filter>
296   - <linearGradient
297   - inkscape:collect="always"
298   - xlink:href="#linearGradient4944"
299   - id="linearGradient4950"
300   - x1="5.5"
301   - y1="1015.8622"
302   - x2="11.5"
303   - y2="1049.8622"
304   - gradientUnits="userSpaceOnUse" />
305   - <linearGradient
306   - inkscape:collect="always"
307   - xlink:href="#linearGradient4962"
308   - id="linearGradient4958"
309   - x1="36.5"
310   - y1="1047.8622"
311   - x2="31.5"
312   - y2="1038.8622"
313   - gradientUnits="userSpaceOnUse" />
314   - <linearGradient
315   - inkscape:collect="always"
316   - xlink:href="#linearGradient4952"
317   - id="linearGradient4960"
318   - gradientUnits="userSpaceOnUse"
319   - x1="34.5"
320   - y1="1046.8622"
321   - x2="29.5"
322   - y2="1039.8622" />
323   - <linearGradient
324   - inkscape:collect="always"
325   - xlink:href="#linearGradient4962"
326   - id="linearGradient4968"
327   - gradientUnits="userSpaceOnUse"
328   - x1="37.420265"
329   - y1="1044.8622"
330   - x2="36.5"
331   - y2="1043.8622" />
332   - <linearGradient
333   - inkscape:collect="always"
334   - xlink:href="#linearGradient4980"
335   - id="linearGradient4986"
336   - x1="38.5"
337   - y1="41.5"
338   - x2="41.5"
339   - y2="44.5"
340   - gradientUnits="userSpaceOnUse" />
341   - </defs>
342   - <sodipodi:namedview
343   - id="base"
344   - pagecolor="#ffffff"
345   - bordercolor="#666666"
346   - borderopacity="1.0"
347   - inkscape:pageopacity="0.0"
348   - inkscape:pageshadow="2"
349   - inkscape:zoom="12.541667"
350   - inkscape:cx="24"
351   - inkscape:cy="24"
352   - inkscape:document-units="px"
353   - inkscape:current-layer="layer1"
354   - showgrid="true"
355   - inkscape:window-width="1366"
356   - inkscape:window-height="721"
357   - inkscape:window-x="-3"
358   - inkscape:window-y="-3"
359   - inkscape:window-maximized="1">
360   - <inkscape:grid
361   - type="xygrid"
362   - id="grid2816"
363   - empspacing="5"
364   - visible="true"
365   - enabled="true"
366   - snapvisiblegridlinesonly="true"
367   - spacingx="1px"
368   - originx="0.5px"
369   - originy="0.5px" />
370   - </sodipodi:namedview>
371   - <metadata
372   - id="metadata7">
373   - <rdf:RDF>
374   - <cc:Work
375   - rdf:about="">
376   - <dc:format>image/svg+xml</dc:format>
377   - <dc:type
378   - rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
379   - <dc:title></dc:title>
380   - </cc:Work>
381   - </rdf:RDF>
382   - </metadata>
383   - <g
384   - inkscape:label="Camada 1"
385   - inkscape:groupmode="layer"
386   - id="layer1"
387   - transform="translate(0,-1004.3622)">
388   - <rect
389   - style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;filter:url(#filter4938);opacity:0.7"
390   - id="rect4928"
391   - width="41.999996"
392   - height="2.5"
393   - x="3.5"
394   - y="43.5"
395   - transform="translate(0,1004.3622)"
396   - ry="1" />
397   - <rect
398   - style="color:#000000;fill:url(#linearGradient4644-0);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient4950);stroke-width:1.00000024000000010;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
399   - id="rect4699"
400   - width="38"
401   - height="45"
402   - x="5.5"
403   - y="1004.8622"
404   - ry="1" />
405   - <path
406   - style="fill:url(#linearGradient4986);stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1;opacity:0.59999999999999998"
407   - d="M 33.5,45 43,36.5 43,45 33.5,45 z"
408   - id="path4970"
409   - transform="translate(0,1004.3622)"
410   - sodipodi:nodetypes="cccc" />
411   - <rect
412   - style="fill:none;stroke:url(#linearGradient4605);stroke-width:1.00000083;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
413   - id="rect15244"
414   - width="35.997337"
415   - height="43.000019"
416   - x="6.5026627"
417   - y="1005.8622"
418   - rx="0"
419   - ry="0" />
420   - <g
421   - id="g4873"
422   - mask="url(#mask4922)"
423   - transform="translate(0,1.7382813e-5)">
424   - <path
425   - sodipodi:nodetypes="cccccc"
426   - d="m 29.5,1015.8622 11,0 m -11,-3 11,0 m -11,-3 11,0"
427   - style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
428   - id="path4802"
429   - inkscape:connector-curvature="0" />
430   - <path
431   - transform="translate(0,1004.3622)"
432   - d="m 27.5,5.5 c 0,0.5522847 -0.447715,1 -1,1 -0.552285,0 -1,-0.4477153 -1,-1 0,-0.5522847 0.447715,-1 1,-1 0.552285,0 1,0.4477153 1,1 z"
433   - sodipodi:ry="1"
434   - sodipodi:rx="1"
435   - sodipodi:cy="5.5"
436   - sodipodi:cx="26.5"
437   - id="path4804"
438   - style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
439   - sodipodi:type="arc" />
440   - <path
441   - sodipodi:type="arc"
442   - style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
443   - id="path4806"
444   - sodipodi:cx="26.5"
445   - sodipodi:cy="5.5"
446   - sodipodi:rx="1"
447   - sodipodi:ry="1"
448   - d="m 27.5,5.5 c 0,0.5522847 -0.447715,1 -1,1 -0.552285,0 -1,-0.4477153 -1,-1 0,-0.5522847 0.447715,-1 1,-1 0.552285,0 1,0.4477153 1,1 z"
449   - transform="translate(0,1007.3622)" />
450   - <path
451   - transform="translate(0,1010.3622)"
452   - d="m 27.5,5.5 c 0,0.5522847 -0.447715,1 -1,1 -0.552285,0 -1,-0.4477153 -1,-1 0,-0.5522847 0.447715,-1 1,-1 0.552285,0 1,0.4477153 1,1 z"
453   - sodipodi:ry="1"
454   - sodipodi:rx="1"
455   - sodipodi:cy="5.5"
456   - sodipodi:cx="26.5"
457   - id="path4808"
458   - style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
459   - sodipodi:type="arc" />
460   - <path
461   - id="path4811"
462   - style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
463   - d="m 29.5,1029.8622 11,0 m -11,-3 11,0 m -11,-3 11,0"
464   - sodipodi:nodetypes="cccccc"
465   - inkscape:connector-curvature="0" />
466   - <path
467   - sodipodi:type="arc"
468   - style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
469   - id="path4813"
470   - sodipodi:cx="26.5"
471   - sodipodi:cy="5.5"
472   - sodipodi:rx="1"
473   - sodipodi:ry="1"
474   - d="m 27.5,5.5 c 0,0.5522847 -0.447715,1 -1,1 -0.552285,0 -1,-0.4477153 -1,-1 0,-0.5522847 0.447715,-1 1,-1 0.552285,0 1,0.4477153 1,1 z"
475   - transform="translate(0,1018.3622)" />
476   - <path
477   - transform="translate(0,1021.3622)"
478   - d="m 27.5,5.5 c 0,0.5522847 -0.447715,1 -1,1 -0.552285,0 -1,-0.4477153 -1,-1 0,-0.5522847 0.447715,-1 1,-1 0.552285,0 1,0.4477153 1,1 z"
479   - sodipodi:ry="1"
480   - sodipodi:rx="1"
481   - sodipodi:cy="5.5"
482   - sodipodi:cx="26.5"
483   - id="path4815"
484   - style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
485   - sodipodi:type="arc" />
486   - <path
487   - sodipodi:type="arc"
488   - style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
489   - id="path4817"
490   - sodipodi:cx="26.5"
491   - sodipodi:cy="5.5"
492   - sodipodi:rx="1"
493   - sodipodi:ry="1"
494   - d="m 27.5,5.5 c 0,0.5522847 -0.447715,1 -1,1 -0.552285,0 -1,-0.4477153 -1,-1 0,-0.5522847 0.447715,-1 1,-1 0.552285,0 1,0.4477153 1,1 z"
495   - transform="translate(0,1024.3622)" />
496   - <path
497   - id="path4827"
498   - style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
499   - d="m 29.5,1038.8622 11,0 m -11,3 11,0 m -11,3 9,0"
500   - inkscape:connector-curvature="0" />
501   - <path
502   - transform="translate(0,1033.3622)"
503   - d="m 27.5,5.5 c 0,0.5522847 -0.447715,1 -1,1 -0.552285,0 -1,-0.4477153 -1,-1 0,-0.5522847 0.447715,-1 1,-1 0.552285,0 1,0.4477153 1,1 z"
504   - sodipodi:ry="1"
505   - sodipodi:rx="1"
506   - sodipodi:cy="5.5"
507   - sodipodi:cx="26.5"
508   - id="path4829"
509   - style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
510   - sodipodi:type="arc" />
511   - <path
512   - sodipodi:type="arc"
513   - style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
514   - id="path4831"
515   - sodipodi:cx="26.5"
516   - sodipodi:cy="5.5"
517   - sodipodi:rx="1"
518   - sodipodi:ry="1"
519   - d="m 27.5,5.5 c 0,0.5522847 -0.447715,1 -1,1 -0.552285,0 -1,-0.4477153 -1,-1 0,-0.5522847 0.447715,-1 1,-1 0.552285,0 1,0.4477153 1,1 z"
520   - transform="translate(0,1036.3622)" />
521   - <path
522   - transform="translate(0,1039.3622)"
523   - d="m 27.5,5.5 c 0,0.5522847 -0.447715,1 -1,1 -0.552285,0 -1,-0.4477153 -1,-1 0,-0.5522847 0.447715,-1 1,-1 0.552285,0 1,0.4477153 1,1 z"
524   - sodipodi:ry="1"
525   - sodipodi:rx="1"
526   - sodipodi:cy="5.5"
527   - sodipodi:cx="26.5"
528   - id="path4833"
529   - style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
530   - sodipodi:type="arc" />
531   - <g
532   - id="g5575-7"
533   - transform="matrix(0.01545762,0,0,0.01545762,-84.564216,932.96399)"
534   - style="fill:#d38d5f">
535   - <path
536   - inkscape:connector-curvature="0"
537   - id="rect5245-9-6"
538   - d="m 6408.0436,5064.9271 c -11.726,-11.2912 -32.3679,-9.6218 -42.4594,3.1418 -19.6123,19.9856 -39.9641,39.4417 -59.1428,59.74 -9.518,12.5005 -6.3676,31.3823 5.826,40.9329 19.6892,19.3981 38.735,39.51 58.8119,58.4787 12.3484,9.5947 31.3846,6.505 40.8262,-5.7528 19.4803,-19.979 39.9713,-39.2016 58.856,-59.6292 9.0558,-12.4283 5.7503,-30.9531 -6.2232,-40.3134 -18.839,-18.8581 -37.6197,-37.7778 -56.4947,-56.598 z"
539   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
540   - <path
541   - inkscape:connector-curvature="0"
542   - id="rect5245-3-6-2"
543   - d="m 6271.4191,5203.1033 c -11.659,-11.815 -32.7156,-10.3098 -42.9669,2.6329 -19.7244,20.2091 -40.4303,39.6819 -59.5621,60.3374 -9.0337,12.4807 -5.8043,30.8944 6.2011,40.2912 19.927,19.5313 39.0995,40.0758 59.474,59.0098 12.4653,9.0761 30.8739,5.764 40.2082,-6.2396 19.3801,-19.7478 39.4876,-38.9701 58.4368,-59.0318 9.4652,-12.3353 6.4045,-31.4347 -5.8482,-40.9551 -18.655,-18.6738 -37.2518,-37.4088 -55.9429,-56.0448 z"
544   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
545   - <path
546   - inkscape:connector-curvature="0"
547   - id="rect5245-8-6-2"
548   - d="m 6545.5287,5202.6829 c -11.7363,-11.3217 -32.3801,-9.5656 -42.4593,3.1418 -19.5937,19.9946 -39.9139,39.3349 -59.0767,59.7178 -9.5513,12.3449 -6.4556,31.438 5.7819,40.9772 19.6941,19.3922 38.7293,39.519 58.8119,58.4788 12.4118,9.6084 31.3584,6.4621 40.8704,-5.797 19.3229,-19.7402 39.4821,-38.8781 58.3264,-58.9655 9.5617,-12.3467 6.4938,-31.475 -5.7378,-40.933 -18.8464,-18.8655 -37.6344,-37.7925 -56.5168,-56.6201 z"
549   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
550   - <path
551   - inkscape:connector-curvature="0"
552   - id="rect5245-7-4-7"
553   - d="m 6683.1903,5065.7678 c -11.6727,-11.8214 -32.6711,-10.2704 -42.9667,2.6331 -19.5831,19.9842 -39.9685,39.3886 -59.0767,59.7177 -9.5608,12.3477 -6.4907,31.4696 5.7376,40.9329 19.6964,19.4311 38.8692,39.5905 58.8782,58.5894 12.4019,9.5309 31.358,6.4013 40.8042,-5.8192 19.3581,-19.7586 39.4434,-38.8626 58.3704,-59.0098 9.5628,-12.3863 6.44,-31.439 -5.7818,-40.977 -18.6625,-18.6812 -37.2665,-37.4235 -55.9652,-56.0671 z"
554   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
555   - <path
556   - inkscape:connector-curvature="0"
557   - id="rect5245-5-2-8"
558   - d="m 6820.3665,5203.4794 c -11.6211,-11.8358 -32.7205,-10.3463 -42.9888,2.6109 -19.6161,19.9836 -39.9579,39.4428 -59.1429,59.7399 -9.5091,12.4948 -6.4432,31.3232 5.7819,40.8887 19.7364,19.4377 38.8215,39.6072 58.9443,58.6115 12.2819,9.5014 31.2571,6.4201 40.7379,-5.8413 19.38,-19.7479 39.4876,-38.9702 58.4367,-59.0319 9.212,-12.1115 6.6473,-30.6982 -5.1419,-40.247 -18.8831,-18.9025 -37.708,-37.8662 -56.6272,-56.7308 z"
559   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
560   - <path
561   - inkscape:connector-curvature="0"
562   - id="rect5245-5-4-1-9"
563   - d="m 6662,5332.625 c -15.2378,0.1612 -24.0529,14.157 -34.1146,23.4276 -15.476,15.9413 -31.8697,31.086 -46.7916,47.5099 -2.9405,4.2478 -4.8192,9.3664 -5.1563,14.4687 58.2812,-0.042 116.7292,0.083 174.9063,-0.062 -0.7632,-15.4178 -15.3649,-24.1142 -24.7148,-34.6559 -15.4837,-15.0104 -30.156,-31.1956 -46.0978,-45.5317 -5.23,-3.6558 -11.6538,-5.4746 -18.0312,-5.1562 z"
564   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
565   - <path
566   - inkscape:connector-curvature="0"
567   - id="rect5245-5-4-4-4-1"
568   - d="m 6387.75,5331.1875 c -12.8167,-0.2843 -21.9125,9.8823 -29.9201,18.4726 -16.9981,17.3803 -34.8059,34.2122 -51.3299,51.9024 -3.1649,4.3908 -5.2116,9.685 -5.5625,15.0313 58.2812,-0.042 116.7292,0.083 174.9063,-0.063 -0.723,-15.0722 -14.844,-23.7682 -24.0397,-33.9792 -15.7089,-15.2187 -30.5296,-31.6073 -46.7416,-46.1458 -5.0231,-3.5423 -11.1737,-5.3579 -17.3125,-5.2187 z"
569   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
570   - <path
571   - inkscape:connector-curvature="0"
572   - id="rect5245-5-4-7-7-7"
573   - d="m 6438.0625,5011.4375 c 0.8844,15.3847 15.3961,24.0874 24.746,34.5934 15.4791,14.996 30.0891,31.1552 46.0665,45.4691 12.3222,9.0732 30.8351,5.8023 40.1691,-6.1752 19.3539,-19.7366 39.5157,-38.9385 58.3934,-58.981 3.1742,-4.3805 5.1726,-9.6672 5.5625,-15.0313 -58.2707,0.083 -116.8752,-0.1665 -174.9375,0.125 z"
574   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
575   - <path
576   - inkscape:connector-curvature="0"
577   - id="rect5245-5-4-7-4-6-5"
578   - d="m 6701.375,5008.75 c 27.4204,26.9864 54.2733,54.7791 81.9688,81.3438 12.312,9.5662 31.425,6.3692 40.8246,-5.801 59.1737,-59.3365 118.4716,-118.5488 177.7691,-177.7616 -100.1875,34.073 -200.375,68.1459 -300.5625,102.2188 z"
579   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
580   - <path
581   - inkscape:connector-curvature="0"
582   - id="rect5245-5-4-7-4-3-3-0"
583   - d="m 6998.8438,4984.5938 c -47.3943,47.7404 -95.4006,94.9567 -142.5626,142.875 -10.1297,12.3088 -7.0115,31.8296 5.3324,41.3869 25.2451,25.1714 50.3907,50.4424 75.5426,75.7068 34.073,-100.1875 68.1459,-200.375 102.2188,-300.5625 -13.5104,13.5313 -27.0208,27.0625 -40.5312,40.5938 z"
584   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
585   - <path
586   - inkscape:connector-curvature="0"
587   - id="rect5245-5-4-7-4-2-3-8"
588   - d="m 6114.2812,5244.9062 c 26.8771,-27.2005 54.2641,-54.0149 80.875,-81.4062 10.0644,-12.3049 7.0844,-31.7597 -5.3634,-41.3871 -59.3365,-59.1737 -118.5488,-118.4717 -177.7616,-177.7691 34.0834,100.1874 68.1667,200.375 102.25,300.5624 z"
589   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
590   - <path
591   - inkscape:connector-curvature="0"
592   - id="rect5245-5-4-7-4-3-5-8-2"
593   - d="m 6090.125,4947.4375 c 47.677,47.4093 94.9671,95.3478 142.7812,142.5313 12.3096,10.0651 31.7648,7.1628 41.4222,-5.2972 25.2023,-25.2247 50.4579,-50.3961 75.7341,-75.5466 -100.1875,-34.0729 -200.375,-68.1458 -300.5625,-102.2188 13.5417,13.5105 27.0833,27.0209 40.625,40.5313 z"
594   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
595   - </g>
596   - <g
597   - id="g5575-7-8"
598   - transform="matrix(0.01545762,0,0,0.01545762,-84.486184,947.26528)"
599   - style="fill:#d38d5f">
600   - <path
601   - inkscape:connector-curvature="0"
602   - id="rect5245-9-6-5"
603   - d="m 6408.0436,5064.9271 c -11.726,-11.2912 -32.3679,-9.6218 -42.4594,3.1418 -19.6123,19.9856 -39.9641,39.4417 -59.1428,59.74 -9.518,12.5005 -6.3676,31.3823 5.826,40.9329 19.6892,19.3981 38.735,39.51 58.8119,58.4787 12.3484,9.5947 31.3846,6.505 40.8262,-5.7528 19.4803,-19.979 39.9713,-39.2016 58.856,-59.6292 9.0558,-12.4283 5.7503,-30.9531 -6.2232,-40.3134 -18.839,-18.8581 -37.6197,-37.7778 -56.4947,-56.598 z"
604   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
605   - <path
606   - inkscape:connector-curvature="0"
607   - id="rect5245-3-6-2-0"
608   - d="m 6271.4191,5203.1033 c -11.659,-11.815 -32.7156,-10.3098 -42.9669,2.6329 -19.7244,20.2091 -40.4303,39.6819 -59.5621,60.3374 -9.0337,12.4807 -5.8043,30.8944 6.2011,40.2912 19.927,19.5313 39.0995,40.0758 59.474,59.0098 12.4653,9.0761 30.8739,5.764 40.2082,-6.2396 19.3801,-19.7478 39.4876,-38.9701 58.4368,-59.0318 9.4652,-12.3353 6.4045,-31.4347 -5.8482,-40.9551 -18.655,-18.6738 -37.2518,-37.4088 -55.9429,-56.0448 z"
609   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
610   - <path
611   - inkscape:connector-curvature="0"
612   - id="rect5245-8-6-2-9"
613   - d="m 6545.5287,5202.6829 c -11.7363,-11.3217 -32.3801,-9.5656 -42.4593,3.1418 -19.5937,19.9946 -39.9139,39.3349 -59.0767,59.7178 -9.5513,12.3449 -6.4556,31.438 5.7819,40.9772 19.6941,19.3922 38.7293,39.519 58.8119,58.4788 12.4118,9.6084 31.3584,6.4621 40.8704,-5.797 19.3229,-19.7402 39.4821,-38.8781 58.3264,-58.9655 9.5617,-12.3467 6.4938,-31.475 -5.7378,-40.933 -18.8464,-18.8655 -37.6344,-37.7925 -56.5168,-56.6201 z"
614   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
615   - <path
616   - inkscape:connector-curvature="0"
617   - id="rect5245-7-4-7-6"
618   - d="m 6683.1903,5065.7678 c -11.6727,-11.8214 -32.6711,-10.2704 -42.9667,2.6331 -19.5831,19.9842 -39.9685,39.3886 -59.0767,59.7177 -9.5608,12.3477 -6.4907,31.4696 5.7376,40.9329 19.6964,19.4311 38.8692,39.5905 58.8782,58.5894 12.4019,9.5309 31.358,6.4013 40.8042,-5.8192 19.3581,-19.7586 39.4434,-38.8626 58.3704,-59.0098 9.5628,-12.3863 6.44,-31.439 -5.7818,-40.977 -18.6625,-18.6812 -37.2665,-37.4235 -55.9652,-56.0671 z"
619   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
620   - <path
621   - inkscape:connector-curvature="0"
622   - id="rect5245-5-2-8-3"
623   - d="m 6820.3665,5203.4794 c -11.6211,-11.8358 -32.7205,-10.3463 -42.9888,2.6109 -19.6161,19.9836 -39.9579,39.4428 -59.1429,59.7399 -9.5091,12.4948 -6.4432,31.3232 5.7819,40.8887 19.7364,19.4377 38.8215,39.6072 58.9443,58.6115 12.2819,9.5014 31.2571,6.4201 40.7379,-5.8413 19.38,-19.7479 39.4876,-38.9702 58.4367,-59.0319 9.212,-12.1115 6.6473,-30.6982 -5.1419,-40.247 -18.8831,-18.9025 -37.708,-37.8662 -56.6272,-56.7308 z"
624   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
625   - <path
626   - inkscape:connector-curvature="0"
627   - id="rect5245-5-4-1-9-8"
628   - d="m 6662,5332.625 c -15.2378,0.1612 -24.0529,14.157 -34.1146,23.4276 -15.476,15.9413 -31.8697,31.086 -46.7916,47.5099 -2.9405,4.2478 -4.8192,9.3664 -5.1563,14.4687 58.2812,-0.042 116.7292,0.083 174.9063,-0.062 -0.7632,-15.4178 -15.3649,-24.1142 -24.7148,-34.6559 -15.4837,-15.0104 -30.156,-31.1956 -46.0978,-45.5317 -5.23,-3.6558 -11.6538,-5.4746 -18.0312,-5.1562 z"
629   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
630   - <path
631   - inkscape:connector-curvature="0"
632   - id="rect5245-5-4-4-4-1-5"
633   - d="m 6387.75,5331.1875 c -12.8167,-0.2843 -21.9125,9.8823 -29.9201,18.4726 -16.9981,17.3803 -34.8059,34.2122 -51.3299,51.9024 -3.1649,4.3908 -5.2116,9.685 -5.5625,15.0313 58.2812,-0.042 116.7292,0.083 174.9063,-0.063 -0.723,-15.0722 -14.844,-23.7682 -24.0397,-33.9792 -15.7089,-15.2187 -30.5296,-31.6073 -46.7416,-46.1458 -5.0231,-3.5423 -11.1737,-5.3579 -17.3125,-5.2187 z"
634   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
635   - <path
636   - inkscape:connector-curvature="0"
637   - id="rect5245-5-4-7-7-7-6"
638   - d="m 6438.0625,5011.4375 c 0.8844,15.3847 15.3961,24.0874 24.746,34.5934 15.4791,14.996 30.0891,31.1552 46.0665,45.4691 12.3222,9.0732 30.8351,5.8023 40.1691,-6.1752 19.3539,-19.7366 39.5157,-38.9385 58.3934,-58.981 3.1742,-4.3805 5.1726,-9.6672 5.5625,-15.0313 -58.2707,0.083 -116.8752,-0.1665 -174.9375,0.125 z"
639   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
640   - <path
641   - inkscape:connector-curvature="0"
642   - id="rect5245-5-4-7-4-6-5-1"
643   - d="m 6701.375,5008.75 c 27.4204,26.9864 54.2733,54.7791 81.9688,81.3438 12.312,9.5662 31.425,6.3692 40.8246,-5.801 59.1737,-59.3365 118.4716,-118.5488 177.7691,-177.7616 -100.1875,34.073 -200.375,68.1459 -300.5625,102.2188 z"
644   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
645   - <path
646   - inkscape:connector-curvature="0"
647   - id="rect5245-5-4-7-4-3-3-0-1"
648   - d="m 6998.8438,4984.5938 c -47.3943,47.7404 -95.4006,94.9567 -142.5626,142.875 -10.1297,12.3088 -7.0115,31.8296 5.3324,41.3869 25.2451,25.1714 50.3907,50.4424 75.5426,75.7068 34.073,-100.1875 68.1459,-200.375 102.2188,-300.5625 -13.5104,13.5313 -27.0208,27.0625 -40.5312,40.5938 z"
649   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
650   - <path
651   - inkscape:connector-curvature="0"
652   - id="rect5245-5-4-7-4-2-3-8-5"
653   - d="m 6114.2812,5244.9062 c 26.8771,-27.2005 54.2641,-54.0149 80.875,-81.4062 10.0644,-12.3049 7.0844,-31.7597 -5.3634,-41.3871 -59.3365,-59.1737 -118.5488,-118.4717 -177.7616,-177.7691 34.0834,100.1874 68.1667,200.375 102.25,300.5624 z"
654   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
655   - <path
656   - inkscape:connector-curvature="0"
657   - id="rect5245-5-4-7-4-3-5-8-2-9"
658   - d="m 6090.125,4947.4375 c 47.677,47.4093 94.9671,95.3478 142.7812,142.5313 12.3096,10.0651 31.7648,7.1628 41.4222,-5.2972 25.2023,-25.2247 50.4579,-50.3961 75.7341,-75.5466 -100.1875,-34.0729 -200.375,-68.1458 -300.5625,-102.2188 13.5417,13.5105 27.0833,27.0209 40.625,40.5313 z"
659   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
660   - </g>
661   - <g
662   - id="g5575-7-8-8"
663   - transform="matrix(0.01545762,0,0,0.01545762,-84.564216,961.96398)"
664   - style="fill:#d38d5f">
665   - <path
666   - inkscape:connector-curvature="0"
667   - id="rect5245-9-6-5-4"
668   - d="m 6408.0436,5064.9271 c -11.726,-11.2912 -32.3679,-9.6218 -42.4594,3.1418 -19.6123,19.9856 -39.9641,39.4417 -59.1428,59.74 -9.518,12.5005 -6.3676,31.3823 5.826,40.9329 19.6892,19.3981 38.735,39.51 58.8119,58.4787 12.3484,9.5947 31.3846,6.505 40.8262,-5.7528 19.4803,-19.979 39.9713,-39.2016 58.856,-59.6292 9.0558,-12.4283 5.7503,-30.9531 -6.2232,-40.3134 -18.839,-18.8581 -37.6197,-37.7778 -56.4947,-56.598 z"
669   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
670   - <path
671   - inkscape:connector-curvature="0"
672   - id="rect5245-3-6-2-0-8"
673   - d="m 6271.4191,5203.1033 c -11.659,-11.815 -32.7156,-10.3098 -42.9669,2.6329 -19.7244,20.2091 -40.4303,39.6819 -59.5621,60.3374 -9.0337,12.4807 -5.8043,30.8944 6.2011,40.2912 19.927,19.5313 39.0995,40.0758 59.474,59.0098 12.4653,9.0761 30.8739,5.764 40.2082,-6.2396 19.3801,-19.7478 39.4876,-38.9701 58.4368,-59.0318 9.4652,-12.3353 6.4045,-31.4347 -5.8482,-40.9551 -18.655,-18.6738 -37.2518,-37.4088 -55.9429,-56.0448 z"
674   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
675   - <path
676   - inkscape:connector-curvature="0"
677   - id="rect5245-8-6-2-9-1"
678   - d="m 6545.5287,5202.6829 c -11.7363,-11.3217 -32.3801,-9.5656 -42.4593,3.1418 -19.5937,19.9946 -39.9139,39.3349 -59.0767,59.7178 -9.5513,12.3449 -6.4556,31.438 5.7819,40.9772 19.6941,19.3922 38.7293,39.519 58.8119,58.4788 12.4118,9.6084 31.3584,6.4621 40.8704,-5.797 19.3229,-19.7402 39.4821,-38.8781 58.3264,-58.9655 9.5617,-12.3467 6.4938,-31.475 -5.7378,-40.933 -18.8464,-18.8655 -37.6344,-37.7925 -56.5168,-56.6201 z"
679   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
680   - <path
681   - inkscape:connector-curvature="0"
682   - id="rect5245-7-4-7-6-0"
683   - d="m 6683.1903,5065.7678 c -11.6727,-11.8214 -32.6711,-10.2704 -42.9667,2.6331 -19.5831,19.9842 -39.9685,39.3886 -59.0767,59.7177 -9.5608,12.3477 -6.4907,31.4696 5.7376,40.9329 19.6964,19.4311 38.8692,39.5905 58.8782,58.5894 12.4019,9.5309 31.358,6.4013 40.8042,-5.8192 19.3581,-19.7586 39.4434,-38.8626 58.3704,-59.0098 9.5628,-12.3863 6.44,-31.439 -5.7818,-40.977 -18.6625,-18.6812 -37.2665,-37.4235 -55.9652,-56.0671 z"
684   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
685   - <path
686   - inkscape:connector-curvature="0"
687   - id="rect5245-5-2-8-3-3"
688   - d="m 6820.3665,5203.4794 c -11.6211,-11.8358 -32.7205,-10.3463 -42.9888,2.6109 -19.6161,19.9836 -39.9579,39.4428 -59.1429,59.7399 -9.5091,12.4948 -6.4432,31.3232 5.7819,40.8887 19.7364,19.4377 38.8215,39.6072 58.9443,58.6115 12.2819,9.5014 31.2571,6.4201 40.7379,-5.8413 19.38,-19.7479 39.4876,-38.9702 58.4367,-59.0319 9.212,-12.1115 6.6473,-30.6982 -5.1419,-40.247 -18.8831,-18.9025 -37.708,-37.8662 -56.6272,-56.7308 z"
689   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
690   - <path
691   - inkscape:connector-curvature="0"
692   - id="rect5245-5-4-1-9-8-0"
693   - d="m 6662,5332.625 c -15.2378,0.1612 -24.0529,14.157 -34.1146,23.4276 -15.476,15.9413 -31.8697,31.086 -46.7916,47.5099 -2.9405,4.2478 -4.8192,9.3664 -5.1563,14.4687 58.2812,-0.042 116.7292,0.083 174.9063,-0.062 -0.7632,-15.4178 -15.3649,-24.1142 -24.7148,-34.6559 -15.4837,-15.0104 -30.156,-31.1956 -46.0978,-45.5317 -5.23,-3.6558 -11.6538,-5.4746 -18.0312,-5.1562 z"
694   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
695   - <path
696   - inkscape:connector-curvature="0"
697   - id="rect5245-5-4-4-4-1-5-4"
698   - d="m 6387.75,5331.1875 c -12.8167,-0.2843 -21.9125,9.8823 -29.9201,18.4726 -16.9981,17.3803 -34.8059,34.2122 -51.3299,51.9024 -3.1649,4.3908 -5.2116,9.685 -5.5625,15.0313 58.2812,-0.042 116.7292,0.083 174.9063,-0.063 -0.723,-15.0722 -14.844,-23.7682 -24.0397,-33.9792 -15.7089,-15.2187 -30.5296,-31.6073 -46.7416,-46.1458 -5.0231,-3.5423 -11.1737,-5.3579 -17.3125,-5.2187 z"
699   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
700   - <path
701   - inkscape:connector-curvature="0"
702   - id="rect5245-5-4-7-7-7-6-4"
703   - d="m 6438.0625,5011.4375 c 0.8844,15.3847 15.3961,24.0874 24.746,34.5934 15.4791,14.996 30.0891,31.1552 46.0665,45.4691 12.3222,9.0732 30.8351,5.8023 40.1691,-6.1752 19.3539,-19.7366 39.5157,-38.9385 58.3934,-58.981 3.1742,-4.3805 5.1726,-9.6672 5.5625,-15.0313 -58.2707,0.083 -116.8752,-0.1665 -174.9375,0.125 z"
704   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
705   - <path
706   - inkscape:connector-curvature="0"
707   - id="rect5245-5-4-7-4-6-5-1-4"
708   - d="m 6701.375,5008.75 c 27.4204,26.9864 54.2733,54.7791 81.9688,81.3438 12.312,9.5662 31.425,6.3692 40.8246,-5.801 59.1737,-59.3365 118.4716,-118.5488 177.7691,-177.7616 -100.1875,34.073 -200.375,68.1459 -300.5625,102.2188 z"
709   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
710   - <path
711   - inkscape:connector-curvature="0"
712   - id="rect5245-5-4-7-4-3-3-0-1-4"
713   - d="m 6998.8438,4984.5938 c -47.3943,47.7404 -95.4006,94.9567 -142.5626,142.875 -10.1297,12.3088 -7.0115,31.8296 5.3324,41.3869 25.2451,25.1714 50.3907,50.4424 75.5426,75.7068 34.073,-100.1875 68.1459,-200.375 102.2188,-300.5625 -13.5104,13.5313 -27.0208,27.0625 -40.5312,40.5938 z"
714   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
715   - <path
716   - inkscape:connector-curvature="0"
717   - id="rect5245-5-4-7-4-2-3-8-5-7"
718   - d="m 6114.2812,5244.9062 c 26.8771,-27.2005 54.2641,-54.0149 80.875,-81.4062 10.0644,-12.3049 7.0844,-31.7597 -5.3634,-41.3871 -59.3365,-59.1737 -118.5488,-118.4717 -177.7616,-177.7691 34.0834,100.1874 68.1667,200.375 102.25,300.5624 z"
719   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
720   - <path
721   - inkscape:connector-curvature="0"
722   - id="rect5245-5-4-7-4-3-5-8-2-9-6"
723   - d="m 6090.125,4947.4375 c 47.677,47.4093 94.9671,95.3478 142.7812,142.5313 12.3096,10.0651 31.7648,7.1628 41.4222,-5.2972 25.2023,-25.2247 50.4579,-50.3961 75.7341,-75.5466 -100.1875,-34.0729 -200.375,-68.1458 -300.5625,-102.2188 13.5417,13.5105 27.0833,27.0209 40.625,40.5313 z"
724   - style="fill:#d38d5f;fill-opacity:1;stroke:none" />
725   - </g>
726   - </g>
727   - <g
728   - id="g4835"
729   - style="stroke:url(#linearGradient4958)">
730   - <path
731   - sodipodi:nodetypes="csccc"
732   - id="path2210"
733   - d="m 30.5,1049.8622 c 3,0 4.031657,-1.3115 7,-4 2.357963,-2.1356 6,-4 6,-8 0,5 -5,4 -10,4 0,4 1,8 -3,8 z"
734   - style="color:#000000;fill:url(#linearGradient4602);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient4960);stroke-width:1.00000024000000010;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" />
735   - <path
736   - style="opacity:0.50000000000000000;color:#000000;fill:none;stroke:url(#linearGradient4968);stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible"
737   - d="m 39.5,1042.8622 -5,0 0,4"
738   - id="path2247"
739   - sodipodi:nodetypes="ccc" />
740   - </g>
741   - </g>
742   -</svg>
plugins/shopping_cart/public/style.css
... ... @@ -1,226 +0,0 @@
1   -.cart-add-item .ui-icon-cart {
2   - background: url("/plugins/shopping_cart/images/button-icon.png") no-repeat scroll left center transparent;
3   - width: 22px;
4   -}
5   -.cart-buy .ui-icon-cart {
6   - background: url("/plugins/shopping_cart/images/button-icon.png") no-repeat scroll left center transparent;
7   - width: 22px;
8   -}
9   -.cart-add-item .ui-button-text {
10   - padding-left: 2.6em;
11   -}
12   -
13   -.product-item .cart-add-item {
14   - top: 0px;
15   -}
16   -
17   -.cart {
18   - position: fixed;
19   - right: 20px;
20   - top: 0px;
21   - width: 200px;
22   - z-index: 1000;
23   - border: 1px solid #777;
24   - background: rgba(100,100,100,0.8);
25   -}
26   -
27   -.cart h3 {
28   - color: #000;
29   - margin: 0px 0px 0px 5px;
30   -}
31   -
32   -.cart-clean {
33   - color: #AAA;
34   - position: absolute;
35   - top: 1px;
36   - right: 5px;
37   - text-decoration: none;
38   -}
39   -.cart-clean:hover {
40   - color: #888;
41   -}
42   -
43   -.cart-content {
44   - display: none;
45   -}
46   -
47   -.cart-items {
48   - margin: 0px;
49   - padding: 0px;
50   - max-height: 328px;
51   - overflow: auto;
52   -}
53   -
54   -.cart-items li {
55   - height: 50px;
56   - padding: 5px;
57   - margin: 3px;
58   - border: 1px solid #999;
59   - list-style: none;
60   - background: #FFF;
61   - position: relative;
62   -}
63   -
64   -.cart-items .picture {
65   - float: left;
66   - width: 50px;
67   - height: 50px;
68   - margin-right: 10px;
69   - background-repeat: no-repeat;
70   - background-position: 50% 50%;
71   -}
72   -
73   -.cart .item-name {
74   - margin-right: 20px;
75   -}
76   -
77   -.cart .button {
78   - position: absolute;
79   - top: 2px;
80   - right: 2px;
81   -}
82   -
83   -.cart input {
84   - border: 1px solid transparent;
85   - background: transparent 50% 50% no-repeat;
86   - text-align: center;
87   - padding: 0px;
88   - font-family: monospace;
89   - width: 2em;
90   -}
91   -.cart:hover input, .cart input:focus {
92   - border: 1px solid #CCC;
93   -}
94   -
95   -.cart-buy {
96   - display: block;
97   - margin: 2px 4px;
98   -}
99   -
100   -.cart-total {
101   - position: absolute;
102   - left: 5px;
103   - bottom: 0px;
104   -}
105   -
106   -.cart-toggle {
107   - display: block;
108   - color: #AAA;
109   - text-decoration: none;
110   - float: right;
111   - padding: 0px 5px;
112   -}
113   -.cart-toggle:hover {
114   - color: #fff;
115   -}
116   -
117   -#cart-request-box {
118   - width: 690px;
119   -}
120   -
121   -#cart-request-form {
122   - width: 274px;
123   - float: left;
124   -}
125   -
126   -#cart-request-box .cart-box-close {
127   - position: absolute;
128   - right: 10px;
129   - bottom: 10px;
130   - width: 16px;
131   - height: 16px;
132   - background-repeat: no-repeat;
133   -}
134   -
135   -#cart-form-main {
136   - border: 2px solid #FFF;
137   - padding: 0px 10px;
138   -}
139   -
140   -#cart-request-form fieldset {
141   - clear: left;
142   - color: #999;
143   - border: 1px solid #BBB;
144   - margin-top: 5px;
145   -}
146   -
147   -#cart-request-form input,
148   -#cart-request-form select {
149   - width: 250px;
150   -}
151   -
152   -#cart-form-actions {
153   - clear: both;
154   - padding-top: 15px;
155   - text-align: center;
156   -}
157   -
158   -#cart-form-actions .submit {
159   - cursor: pointer;
160   -}
161   -
162   -#cart-items-table {
163   - margin-left: 285px;
164   - width: 400px
165   -}
166   -
167   -.cart-table-quantity {
168   - text-align: center;
169   -}
170   -
171   -.cart-table-price,
172   -.cart-table-total-label,
173   -.cart-table-total-value {
174   - text-align: right;
175   -}
176   -
177   -label.error {
178   - float: none;
179   - color: red;
180   - padding-left: .5em;
181   - vertical-align: top;
182   -}
183   -
184   -.controller-profile_editor a.control-panel-shopping-cart-purchase-report {background-image: url("/plugins/shopping_cart/images/control-panel/purchase-report.png")}
185   -.controller-profile_editor .msie6 a.control-panel-shopping-cart-purchase-report {background-image: url("/plugins/shopping_cart/images/control-panel/purchase-report.gif")}
186   -.controller-profile_editor a.control-panel-shopping-cart-icon {background-image: url("/plugins/shopping_cart/images/control-panel/icon.png")}
187   -.controller-profile_editor .msie6 a.control-panel-shopping-cart-icon {background-image: url("/plugins/shopping_cart/images/control-panel/icon.gif")}
188   -
189   -.action-shopping_cart_plugin_myprofile-reports td.order-info {
190   - padding: 0px;
191   - height: auto;
192   -}
193   -
194   -.action-shopping_cart_plugin_myprofile-reports .customer-details,
195   -.action-shopping_cart_plugin_myprofile-reports .order-products {
196   - list-style-position: inside;
197   - float: left;
198   - width: 49%;
199   - margin: 0px;
200   - padding: 10px 0px;
201   -}
202   -
203   -.action-shopping_cart_plugin_myprofile-reports .order-products {
204   - float: right;
205   -}
206   -
207   -.action-shopping_cart_plugin_myprofile-reports .customer-details li,
208   -.action-shopping_cart_plugin_myprofile-reports .order-products li {
209   - padding-left: 5px;
210   -}
211   -
212   -#cart-order-filter {
213   - background-color: #ccc;
214   - border: 1px solid #aaa;
215   - border-radius: 5px;
216   - padding: 3px 8px;
217   - margin-bottom: 10px;
218   -}
219   -
220   -th {
221   - text-align: center;
222   -}
223   -
224   -td {
225   - text-align: left;
226   -}
plugins/shopping_cart/public/style.scss 0 → 100644
... ... @@ -0,0 +1,289 @@
  1 +.cart-add-item .ui-icon-cart,
  2 +.cart-buy .ui-icon-cart,
  3 +.icon-cart, .btn.icon-cart {
  4 + background-image: url("/plugins/shopping_cart/images/button-icon.png");
  5 + background-repeat: no-repeat;
  6 + background-position: 5px center;
  7 +}
  8 +.cart-add-item.small-loading {
  9 + background-image: url(/images/loading-small.gif);
  10 +}
  11 +
  12 +a.button.with-text.icon-cart,
  13 +a.button.with-text.icon-cart:visited,
  14 +body.noosfero a.button.with-text.icon-cart,
  15 +body.noosfero a.button.with-text.icon-cart:visited,
  16 +input.button.with-text.icon-cart,
  17 +.icon-cart, .btn.icon-cart {
  18 + padding-left: 30px;
  19 +}
  20 +.catalog-autocomplete .cart-add-item {
  21 + display: block;
  22 + float: right;
  23 +}
  24 +.cart-add-item .ui-button-text {
  25 + padding-left: 2.6em;
  26 +}
  27 +.product-item .cart-add-item {
  28 + top: 0px;
  29 +}
  30 +
  31 +
  32 +.action-shopping_cart_plugin-buy .cart {
  33 + display: none !important;
  34 +}
  35 +.cart {
  36 + display: none;
  37 + position: fixed;
  38 + right: 20px;
  39 + top: 0px;
  40 + z-index: 100;
  41 +}
  42 +.cart-minimized {
  43 + float: right;
  44 + position: relative;
  45 +}
  46 +#catalog-options ul .catalog-cart {
  47 + float: right;
  48 + margin: 0;
  49 +}
  50 +#cart1 .cart-inner {
  51 + width: 200px;
  52 + z-index: 1000;
  53 + border: 1px solid #777;
  54 + border-radius: 10px;
  55 + box-shadow: #000 2px 2px 8px;
  56 + background: rgba(130,130,130,0.9);
  57 +}
  58 +.cart .cart-inner {
  59 + position: relative;
  60 + top: 2px;
  61 + padding-bottom: 20px;
  62 +}
  63 +.cart .cart-inner .cart-content {
  64 + display: none;
  65 +}
  66 +.cart-minimized .cart-inner {
  67 + display: none;
  68 + position: absolute;
  69 + top: 24px;
  70 + left: -150px;
  71 +}
  72 +.cart-minimized .cart-applet {
  73 + float: right;
  74 + text-align: center;
  75 +}
  76 +#content .cart-minimized .cart-applet .cart-highlight {
  77 + background-color: yellow;
  78 +}
  79 +.cart-minimized .cart-applet-checkout, .cart-minimized .cart-applet-checkout-disabled {
  80 + display: block;
  81 + font-size: 80%;
  82 + margin-top: 3px;
  83 +}
  84 +.cart-minimized .cart-applet-checkout-disabled {
  85 + pointer-events: none;
  86 + cursor: default;
  87 + color: #CCC;
  88 + text-decoration: none;
  89 +}
  90 +.cart-qtty {
  91 + font-weight: bold;
  92 +}
  93 +#cart1 h3 {
  94 + color: #036276;
  95 + margin: 0px 0px 0px 5px;
  96 + font-weight: lighter;
  97 +}
  98 +#cart-profile-name {
  99 + white-space: nowrap;
  100 + text-overflow: ellipsis;
  101 + overflow: hidden;
  102 + margin: 0px 5px;
  103 + color: #000;
  104 +}
  105 +.cart-clean {
  106 + color: #AAA;
  107 + position: absolute;
  108 + top: 1px;
  109 + right: 5px;
  110 + text-decoration: none;
  111 +}
  112 +.cart-clean:hover {
  113 + color: #888;
  114 +}
  115 +.cart-items {
  116 + margin: 0px;
  117 + padding: 0px;
  118 + max-height: 328px;
  119 + overflow-y: auto;
  120 + overflow-x: hidden;
  121 +}
  122 +#catalog-options .cart-items {
  123 + padding: 0;
  124 + margin: 0;
  125 +}
  126 +#catalog-options .cart-items li {
  127 + margin-right: 0;
  128 +}
  129 +.cart-items li {
  130 + padding: 0;
  131 + border: 2px solid #999;
  132 + width: 98%;
  133 + list-style: none;
  134 + background: #FFF;
  135 + position: relative;
  136 + border-radius: 5px;
  137 + font-size: 85%;
  138 + min-height: 50px;
  139 +}
  140 +.cart-items .picture {
  141 + float: left;
  142 + width: 50px;
  143 + height: 50px;
  144 + margin-right: 10px;
  145 + background-repeat: no-repeat;
  146 + background-position: 50% 50%;
  147 +}
  148 +#cart1 .item-name {
  149 + margin-right: 0;
  150 +}
  151 +.cart-items .cart-remove-item {
  152 + float: right;
  153 +}
  154 +
  155 +#cart1 input {
  156 + border: 1px solid transparent;
  157 + background: transparent 50% 50% no-repeat;
  158 + text-align: center;
  159 + padding: 0px;
  160 + font-family: monospace;
  161 + width: 2em;
  162 +}
  163 +#cart1:hover input, #cart1 input:focus {
  164 + border: 1px solid #CCC;
  165 +}
  166 +.cart-buy {
  167 + display: block;
  168 + margin: 2px 4px;
  169 +}
  170 +.cart-total {
  171 + float: left;
  172 +}
  173 +.cart-toggle, .cart-toggle:visited {
  174 + display: block;
  175 + color: #036276;
  176 + text-decoration: none;
  177 + float: right;
  178 + padding: 0px 5px;
  179 +}
  180 +.cart-toggle:hover {
  181 + color: #fff;
  182 +}
  183 +.str-hide {
  184 + display: none;
  185 +}
  186 +
  187 +#cart-request-box {
  188 + overflow: hidden;
  189 +}
  190 +#cart-request-box a {
  191 + font-size: smaller;
  192 +}
  193 +#cart-request-form {
  194 +}
  195 +#cart-request-box .cart-box-close {
  196 + position: absolute;
  197 + right: 10px;
  198 + bottom: 10px;
  199 + width: 16px;
  200 + height: 16px;
  201 + background-repeat: no-repeat;
  202 +}
  203 +#cart-request-box .cart-go-back {
  204 + float: right;
  205 + text-transform: none;
  206 + font-variant: normal;
  207 +}
  208 +
  209 +#cart-request-form fieldset {
  210 + clear: left;
  211 + color: #999;
  212 + margin-top: 5px;
  213 +}
  214 +
  215 +#cart-request-form input,
  216 +#cart-request-form select {
  217 +}
  218 +
  219 +#cart-form-actions {
  220 + clear: both;
  221 + padding-top: 15px;
  222 + text-align: center;
  223 +}
  224 +
  225 +#cart-form-actions .submit {
  226 + cursor: pointer;
  227 +}
  228 +
  229 +#cart-items-table {
  230 +}
  231 +
  232 +.cart-table-quantity {
  233 + text-align: center;
  234 +}
  235 +
  236 +.cart-table-price,
  237 +.cart-table-total-label,
  238 +.cart-table-total-value {
  239 + text-align: right;
  240 +}
  241 +label.error {
  242 + float: none;
  243 + color: red;
  244 + padding-left: .5em;
  245 + vertical-align: top;
  246 +}
  247 +
  248 +.controller-profile_editor a.control-panel-shopping-cart-icon {background-image: url("/plugins/shopping_cart/images/control-panel/icon.png")}
  249 +.controller-profile_editor .msie6 a.control-panel-shopping-cart-icon {background-image: url("/plugins/shopping_cart/images/control-panel/icon.gif")}
  250 +
  251 +.action-shopping_cart_plugin_myprofile-reports td.order-info {
  252 + padding: 0px;
  253 + height: auto;
  254 +}
  255 +.action-shopping_cart_plugin_myprofile-reports .customer-details,
  256 +.action-shopping_cart_plugin_myprofile-reports .order-products {
  257 + list-style-position: inside;
  258 + float: left;
  259 + width: 49%;
  260 + margin: 0px;
  261 + padding: 10px 0px;
  262 +}
  263 +.action-shopping_cart_plugin_myprofile-reports .order-products {
  264 + float: right;
  265 +}
  266 +.action-shopping_cart_plugin_myprofile-reports .customer-details li,
  267 +.action-shopping_cart_plugin_myprofile-reports .order-products li {
  268 + padding-left: 5px;
  269 +}
  270 +#cart-order-filter {
  271 + background-color: #ccc;
  272 + border: 1px solid #aaa;
  273 + border-radius: 5px;
  274 + padding: 3px 8px;
  275 + margin-bottom: 10px;
  276 +}
  277 +th {
  278 + text-align: center;
  279 +}
  280 +td {
  281 + text-align: left;
  282 +}
  283 +/* Repeat orders */
  284 +a.button.repeat-checkout-order, a.button.repeat-choose-order {
  285 + display: block;
  286 + margin: 0 5px 5px 40px;
  287 + font-size: 80%;
  288 + background-color: #ffc64c;
  289 +}
... ...
plugins/shopping_cart/test/functional/shopping_cart_plugin_controller_test.rb
... ... @@ -154,29 +154,29 @@ class ShoppingCartPluginControllerTest &lt; ActionController::TestCase
154 154 product1 = fast_create(Product, :profile_id => profile.id, :price => 1.99)
155 155 product2 = fast_create(Product, :profile_id => profile.id, :price => 2.23)
156 156 @controller.stubs(:cart).returns({ :profile_id => profile.id, :items => {product1.id => 1, product2.id => 2}})
157   - assert_difference 'ShoppingCartPlugin::PurchaseOrder.count', 1 do
  157 + assert_difference 'OrdersPlugin::Order.count', 1 do
158 158 post :send_request,
159 159 :customer => {:name => "Manuel", :email => "manuel@ceu.com"}
160 160 end
161 161  
162   - order = ShoppingCartPlugin::PurchaseOrder.last
  162 + order = OrdersPlugin::Order.last
163 163  
164 164 assert_equal 1.99, order.products_list[product1.id][:price]
165 165 assert_equal 1, order.products_list[product1.id][:quantity]
166 166 assert_equal 2.23, order.products_list[product2.id][:price]
167 167 assert_equal 2, order.products_list[product2.id][:quantity]
168   - assert_equal ShoppingCartPlugin::PurchaseOrder::Status::OPENED, order.status
  168 + assert_equal 'confirmed', order.status
169 169 end
170 170  
171 171 should 'register order on send request and not crash if product is not defined' do
172 172 product1 = fast_create(Product, :profile_id => profile.id)
173 173 @controller.stubs(:cart).returns({ :profile_id => profile.id, :items => {product1.id => 1}})
174   - assert_difference 'ShoppingCartPlugin::PurchaseOrder.count', 1 do
  174 + assert_difference 'OrdersPlugin::Order.count', 1 do
175 175 post :send_request,
176 176 :customer => {:name => "Manuel", :email => "manuel@ceu.com"}
177 177 end
178 178  
179   - order = ShoppingCartPlugin::PurchaseOrder.last
  179 + order = OrdersPlugin::Order.last
180 180  
181 181 assert_equal 0, order.products_list[product1.id][:price]
182 182 end
... ...
plugins/shopping_cart/test/functional/shopping_cart_plugin_myprofile_controller_test.rb
... ... @@ -51,6 +51,7 @@ class ShoppingCartPluginMyprofileControllerTest &lt; ActionController::TestCase
51 51 assert settings.delivery_price == price.to_s
52 52 end
53 53  
  54 + # FIXME
54 55 should 'be able to choose delivery_options' do
55 56 delivery_options = {:options => ['car', 'bike'], :prices => ['20', '5']}
56 57 post :edit, :profile => profile.identifier, :settings => {:delivery_options => delivery_options}
... ... @@ -61,18 +62,18 @@ class ShoppingCartPluginMyprofileControllerTest &lt; ActionController::TestCase
61 62  
62 63 should 'filter the reports correctly' do
63 64 another_profile = fast_create(Enterprise)
64   - po1 = ShoppingCartPlugin::PurchaseOrder.create!(:seller => profile, :status => ShoppingCartPlugin::PurchaseOrder::Status::OPENED)
65   - po2 = ShoppingCartPlugin::PurchaseOrder.create!(:seller => profile, :status => ShoppingCartPlugin::PurchaseOrder::Status::SHIPPED)
66   - po3 = ShoppingCartPlugin::PurchaseOrder.create!(:seller => profile, :status => ShoppingCartPlugin::PurchaseOrder::Status::OPENED)
  65 + po1 = OrdersPlugin::Sale.create! :profile => profile, :status => 'confirmed'
  66 + po2 = OrdersPlugin::Sale.create! :profile => profile, :status => 'shipped'
  67 + po3 = OrdersPlugin::Sale.create! :profile => profile, :status => 'confirmed'
67 68 po3.created_at = 1.year.ago
68 69 po3.save!
69   - po4 = ShoppingCartPlugin::PurchaseOrder.create!(:seller => another_profile, :status => ShoppingCartPlugin::PurchaseOrder::Status::OPENED)
  70 + po4 = OrdersPlugin::Sale.create! :profile => another_profile, :status => 'confirmed'
70 71  
71 72 post :reports,
72 73 :profile => profile.identifier,
73 74 :from => (Time.now - 1.day).strftime(TIME_FORMAT),
74 75 :to => (Time.now + 1.day).strftime(TIME_FORMAT),
75   - :filter_status => ShoppingCartPlugin::PurchaseOrder::Status::OPENED
  76 + :filter_status => 'confirmed'
76 77  
77 78 assert_includes assigns(:orders), po1
78 79 assert_not_includes assigns(:orders), po2
... ... @@ -86,14 +87,14 @@ class ShoppingCartPluginMyprofileControllerTest &lt; ActionController::TestCase
86 87 p3 = fast_create(Product, :profile_id => profile.id, :price => 3)
87 88 po1_products = {p1.id => {:quantity => 1, :price => p1.price, :name => p1.name}, p2.id => {:quantity => 2, :price => p2.price, :name => p2.name }}
88 89 po2_products = {p2.id => {:quantity => 1, :price => p2.price, :name => p2.name }, p3.id => {:quantity => 2, :price => p3.price, :name => p3.name}}
89   - po1 = ShoppingCartPlugin::PurchaseOrder.create!(:seller => profile, :products_list => po1_products, :status => ShoppingCartPlugin::PurchaseOrder::Status::OPENED)
90   - po2 = ShoppingCartPlugin::PurchaseOrder.create!(:seller => profile, :products_list => po2_products, :status => ShoppingCartPlugin::PurchaseOrder::Status::OPENED)
  90 + po1 = OrdersPlugin::Sale.create! :profile => profile, :products_list => po1_products, :status => 'confirmed'
  91 + po2 = OrdersPlugin::Sale.create! :profile => profile, :products_list => po2_products, :status => 'confirmed'
91 92  
92 93 post :reports,
93 94 :profile => profile.identifier,
94 95 :from => (Time.now - 1.day).strftime(TIME_FORMAT),
95 96 :to => (Time.now + 1.day).strftime(TIME_FORMAT),
96   - :filter_status => ShoppingCartPlugin::PurchaseOrder::Status::OPENED
  97 + :filter_status => 'confirmed'
97 98  
98 99 lineitem1 = ShoppingCartPlugin::LineItem.new(p1.id, p1.name)
99 100 lineitem1.quantity = 1
... ... @@ -107,20 +108,20 @@ class ShoppingCartPluginMyprofileControllerTest &lt; ActionController::TestCase
107 108 end
108 109  
109 110 should 'be able to update the order status' do
110   - po = ShoppingCartPlugin::PurchaseOrder.create!(:seller => profile, :status => ShoppingCartPlugin::PurchaseOrder::Status::OPENED)
  111 + po = OrdersPlugin::Sale.create!(:profile => profile, :status => 'confirmed')
111 112  
112 113 post :update_order_status,
113 114 :profile => profile.identifier,
114 115 :order_id => po.id,
115   - :order_status => ShoppingCartPlugin::PurchaseOrder::Status::CONFIRMED
  116 + :order_status => 'confirmed'
116 117 po.reload
117   - assert_equal ShoppingCartPlugin::PurchaseOrder::Status::CONFIRMED, po.status
  118 + assert_equal 'confirmed', po.status
118 119 end
119 120  
120 121 private
121 122  
122 123 def settings
123 124 @profile.reload
124   - Noosfero::Plugin::Settings.new(@profile, ShoppingCartPlugin)
  125 + profile.shopping_cart_settings
125 126 end
126 127 end
... ...
plugins/shopping_cart/test/unit/shopping_cart_plugin_test.rb
... ... @@ -28,7 +28,7 @@ class ShoppingCartPluginTest &lt; ActiveSupport::TestCase
28 28  
29 29 should 'be disabled by default on the enterprise' do
30 30 profile = fast_create(Enterprise)
31   - settings = Noosfero::Plugin::Settings.new(profile, ShoppingCartPlugin)
  31 + settings = profile.shopping_cart_settings
32 32 assert !settings.enabled
33 33 end
34 34 end
... ...
plugins/shopping_cart/views/cart.html.erb
... ... @@ -1,30 +0,0 @@
1   -<div id="cart1" class="cart" style="display:none">
2   - <div class="cart-inner">
3   - <div class="cart-content">
4   - <h3><%= _("Basket") %></h3>
5   - <a href="cart:clean" onclick="Cart.clean(this); return false" class="cart-clean"><%=_('Clean basket')%></a>
6   - <ul class="cart-items"></ul>
7   - <div class="cart-total"><%=_('Total:')%> <b></b></div>
8   - <a href="/plugin/shopping_cart/buy" class="cart-buy modal"><%=_('Shopping checkout')%></a>
9   - </div>
10   - <a href="#" onclick="Cart.toggle(this); return false" class="cart-toggle">
11   - <span class="str-show"><%=_('Show basket')%></span>
12   - <span class="str-hide" style="display:none"><%=_('Hide basket')%></span>
13   - </a>
14   - </div>
15   -</div>
16   -<script>
17   - var shoppingCartPluginL10n = {
18   - getProblemConfirmReload: <%= (
19   - _('Ups... I had a problem to load the basket list.') +
20   - "\n" +
21   - _('Did you want to reload this page?')
22   - ).to_json %>,
23   - maxNumberOfItens: <%= (
24   - _('Sorry, you can\'t have more then 100 kinds of items on this basket.')
25   - ).to_json %>,
26   - waitLastRequest: <%= _('Oops, you must wait your last request to finish first!').to_json %>,
27   - removeItem: <%= _('Are you sure you want to remove this item?').to_json %>,
28   - cleanCart: <%= _('Are you sure you want to clean your basket?').to_json %>
29   - }
30   -</script>
plugins/shopping_cart/views/public/_cart.html.erb 0 → 100644
... ... @@ -0,0 +1,82 @@
  1 +<div id="cart1" class="cart<%= '-minimized' if cart_minimized %>">
  2 + <% if cart_minimized %>
  3 + <div class="cart-applet">
  4 + <%= cart_applet %>
  5 +
  6 + <%= link_to _('Shopping checkout'), "/plugin/shopping_cart/buy", class: 'cart-applet-checkout' %>
  7 + <span class="cart-applet-checkout-disabled">
  8 + <%= _('Basket is empty') %>
  9 + </span>
  10 + </div>
  11 + <% end %>
  12 + <div class="cart-inner">
  13 + <div class="cart-content">
  14 + <h3><%= _("Basket") %></h3>
  15 + <div id="cart-profile-name"></div>
  16 + <a href="cart:clean" onclick="cart.clean(); return false" class="cart-clean"><%=_('Clean basket')%></a>
  17 + <ul class="cart-items">
  18 + </ul>
  19 + <%= button 'cart', _('Shopping checkout'), "/plugin/shopping_cart/buy", :class => 'cart-buy modal-toggle' %>
  20 + <div class="cart-total"><%=_('Total:')%> <b></b></div>
  21 + </div>
  22 + <a href="#" onclick="cart.toggle(); return false" class="cart-toggle">
  23 + <span class="str-show"><%=_('Show basket')%></span>
  24 + <span class="str-hide"><%=_('Hide basket')%></span>
  25 + </a>
  26 + </div>
  27 +
  28 + <script id="cart-item-template" type="text/template">
  29 + <li id="cart-item-{{item.id}}">
  30 + <%= button_to_function_without_text 'remove', '', "Cart.removeItem({{item.id}}); return false", :class => 'cart-remove-item' %>
  31 + <div class="picture" style="background-image:url({{item.picture}})"></div>
  32 + <span class="item-name">{{item.name}}</span>
  33 + <div class="item-price">
  34 + <input size="1" value="{{item.quantity}}" />{{item.priceTxt}}
  35 + </div>
  36 + </li>
  37 + </script>
  38 +</div>
  39 +
  40 +<script type="text/javascript">
  41 +jQuery(function($) {
  42 + Cart.l10n = {
  43 + getProblemConfirmReload: <%= (
  44 + _('Ups... I had a problem to load the basket list.') +
  45 + "\n" +
  46 + _('Did you want to reload this page?')
  47 + ).to_json %>,
  48 + maxNumberOfItens: <%= (
  49 + _('Sorry, you can\'t have more then 100 kinds of items on this basket.')
  50 + ).to_json %>,
  51 + waitLastRequest: <%= _('Oops, you must wait your last request to finish first!').to_json %>,
  52 + removeItem: <%= _('Are you sure you want to remove this item?').to_json %>,
  53 + cleanCart: <%= _('Are you sure you want to clean your basket?').to_json %>,
  54 + repeatOrder: <%= _('repeat order').to_json %>,
  55 + }
  56 + // boolean configuration that defines if the behaviour of the cart is "minimized" or "full"
  57 + Cart.minimized = <%= cart_minimized.to_json %>
  58 +
  59 + $.ajax({
  60 + url: "/plugin/shopping_cart/get?profile_id="+<%= profile.id.to_json rescue ''.to_json %>,
  61 + dataType: 'json',
  62 + success: function(data) {
  63 + cart = new Cart(data);
  64 + },
  65 + cache: false,
  66 + error: function(ajax, status, errorThrown) {
  67 + // Give some time to register page unload.
  68 + setTimeout(function() {
  69 + // page unload is not our problem.
  70 + if (Cart.unloadingPage) {
  71 + log('Page unload before cart load.');
  72 + } else {
  73 + log.error('Error getting shopping cart - HTTP '+status, errorThrown);
  74 + if ( confirm(Cart.l10n.getProblemConfirmReload) ) {
  75 + document.location.reload();
  76 + }
  77 + }
  78 + }, 100);
  79 + }
  80 + });
  81 +});
  82 +</script>
... ...
plugins/shopping_cart/views/shopping_cart_plugin/_items.html.erb 0 → 100644
... ... @@ -0,0 +1,47 @@
  1 +<table id="cart-items-table" cellpadding="2" cellspacing="0"
  2 + border="<%= if by_mail then 1 else 0 end %>"
  3 + style="<%= 'border-collapse: collapse' if by_mail %>">
  4 +
  5 + <tr>
  6 + <th>
  7 + <%= _('Item name') %>
  8 + </th>
  9 + <th>
  10 + <%= if by_mail then '&nbsp;#&nbsp;' else '#' end %>
  11 + </th>
  12 + <th>
  13 + <%= _('Price') + " (#{@environment.currency_unit})" %>
  14 + </th>
  15 + </tr>
  16 +
  17 + <% order.items.each do |item| %>
  18 + <tr>
  19 + <td>
  20 + <%= item.name %>
  21 + </td>
  22 + <td class='cart-table-quantity' align="<%= 'center' if by_mail %>">
  23 + <%= item.quantity_consumer_ordered %>
  24 + </td>
  25 + <td class='cart-table-price' align="<%= 'right' if by_mail %>">
  26 + <%= get_price item.product, @environment, item.quantity_consumer_ordered, unit: '' %>
  27 + </td>
  28 +
  29 + </tr>
  30 + <% end %>
  31 +
  32 + <tr>
  33 + <td colspan=2 id='delivery-name'>
  34 + <%= order.supplier_delivery.name if order.supplier_delivery %>
  35 + </td>
  36 + <td id='delivery-price' class="cart-table-price">
  37 + <%= float_to_currency_cart order.supplier_delivery.cost(order.total_price), @environment, unit: '' if order.supplier_delivery %>
  38 + </td>
  39 + </tr>
  40 +
  41 + <th colspan=2 class="cart-table-total-label">
  42 + <%= _('Total:') %>
  43 + </th>
  44 + <th class="cart-table-total-value">
  45 + <%= float_to_currency_cart order.total, @environment %>
  46 + </th>
  47 +</table>
... ...
plugins/shopping_cart/views/shopping_cart_plugin/buy.html.erb
1   -<div id='cart-request-box'>
2   - <%= form_for(:customer, :url => {:action => 'send_request'},
3   - :html => {:onsubmit => "return Cart.send_request(this)", :id => 'cart-request-form'}) do |f| %>
4   - <div id="cart-form-main">
5   - <%= labelled_form_field('* ' + _("Name"), f.text_field(:name, :class => 'required') ) %>
6   - <%= labelled_form_field('* ' + c_("Email"), f.text_field(:email, :class => 'required email') ) %>
7   - <%= labelled_form_field('* ' + c_("Contact phone"), f.text_field(:contact_phone, :class => 'required') ) %>
8   - <%= labelled_form_field(_('Delivery option'), select_tag(:delivery_option, options_for_select(select_delivery_options(@settings.delivery_options, environment)), 'data-profile-identifier' => @profile.identifier)) unless !@settings.delivery || (@settings.free_delivery_price && get_total(@cart[:items]) >= @settings.free_delivery_price) %>
9   - <%= labelled_form_field(_('Payment'), select_tag('customer[payment]', options_for_select([[_("Money"), :money],[_('shopping_cart|Check'), :check]]))) %>
10   - <%= labelled_form_field(s_('shopping_cart|Change'), text_field_tag('customer[change]')) %>
  1 +<div id='cart-request-box' class="row">
  2 + <h1>
  3 + <%= _('Shopping checkout') %>
  4 + <%= button :back, _("haven't finished yet: back to shopping"), 'javascript:history.back()', class: 'cart-go-back' %>
  5 + </h1>
  6 +
  7 + <%= form_for :order, url: {action: :send_request},
  8 + html: {onsubmit: "return Cart.send_request(this)", id: 'cart-request-form'} do |f| %>
  9 +
  10 + <div class="col-lg-6 col-md-6 col-sm-6">
  11 + <fieldset>
  12 + <legend><%=_('Personal identification')%></legend>
  13 +
  14 + <%= f.fields_for :consumer_data, @order.consumer do |ff| %>
  15 + <%= labelled_form_field('* ' + _("Name"), ff.text_field(:name, value: (user.name if user), class: 'required') ) %>
  16 + <%= labelled_form_field('* ' + _("Email"), ff.text_field(:email, value: (user.email if user), class: 'required email') ) %>
  17 + <%= labelled_form_field('* ' + _("Contact phone"), ff.text_field(:contact_phone, value: (user.contact_phone if user), class: 'required') ) %>
  18 + <% end %>
  19 + </fieldset>
  20 +
  21 + <fieldset>
  22 + <legend><%=_("Payment's method")%></legend>
  23 +
  24 + <%= f.fields_for :payment_data do |ff| %>
  25 + <%= labelled_form_field _('Payment'), ff.select(:method, options_for_payment) %>
  26 + <%= labelled_form_field(s_('shopping_cart|Change'), ff.text_field(:change)) %>
  27 + <% end %>
  28 + </fieldset>
  29 +
  30 + <% if profile.delivery_methods.size > 0 %>
  31 + <fieldset>
  32 + <legend><%=_('Delivery or pickup method')%></legend>
  33 + <%= render 'delivery_plugin/order_select', f: f, order: @order %>
  34 + </fieldset>
  35 + <% end %>
11 36 </div>
12   - <% if @settings.delivery %>
13   - <fieldset><legend><%=_('Delivery Address')%></legend>
14   - <%= labelled_form_field(c_('Address (street and number)'), f.text_field(:address)) %>
15   - <%= labelled_form_field(c_('Address reference'), f.text_field(:address_reference)) %>
16   - <%= labelled_form_field(c_('District'), f.text_field(:district)) %>
17   - <%= labelled_form_field( c_("City"), f.text_field(:city)) %>
18   - <%= labelled_form_field(c_('ZIP code'), f.text_field(:zip_code)) %>
  37 +
  38 + <div class="col-lg-6 col-md-6 col-sm-6">
  39 + <fieldset>
  40 + <legend><%=s_('Your Order')%></legend>
  41 + <% supplier_delivery = @order.supplier_delivery || profile.delivery_methods.first %>
  42 + <%= items_table @cart[:items], @profile, supplier_delivery %>
19 43 </fieldset>
20   - <% end %>
21   - <div id="cart-form-actions">
  44 + </div>
  45 +
  46 + <div id="cart-form-actions" class="row">
22 47 <%= submit_button(:send, _('Send buy request')) %>
23 48 </div>
24 49 <% end %>
25   - <% delivery_option = @settings.delivery_options.first && @settings.delivery_options.first.first %>
26   - <%= items_table(@cart[:items], @profile, delivery_option) %>
27   - <%= link_to_function '', "noosfero.modal.close();", :class => 'cart-box-close icon-cancel' %>
28 50 </div>
29 51  
30 52 <%= javascript_include_tag '../plugins/shopping_cart/buy' %>
  53 +
... ...
plugins/shopping_cart/views/shopping_cart_plugin/clear_orders_session.js.erb 0 → 100644
... ... @@ -0,0 +1 @@
  1 +cart.clearOrdersSession();
... ...
plugins/shopping_cart/views/shopping_cart_plugin/mailer/customer_notification.html.erb
... ... @@ -4,52 +4,66 @@
4 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
5 5 </head>
6 6 <body>
7   - <h4><%= _('Hi %s!') % @customer[:name] %></h4>
  7 + <h4><%= _('Hi %s!') % @order.consumer_data[:name] %></h4>
8 8  
9 9 <p>
10   - <%= _('This is a notification e-mail about your buy request on %s.') % link_to(@supplier.name, @supplier.url) %>
11   - <%= _('The supplier already received your buy request and may contact you for confirmation.') %>
12   - <%= _('If you have any doubts, contact us at: %s') % @supplier.contact_email %>
13   - <%= _('Please check if your information below is correct:') %>
  10 + <%= _('This is a notification e-mail about your buy request on the enterprise %s.') % link_to(@order.profile.name, @order.profile.url) %>
  11 + <%= _('The enterprise already received your buy request and will contact you for confirmation.') %>
  12 + <%= _('If you have any doubts about your order, write to us at: %s.') % @order.profile.contact_email %>
  13 + <%= _('Review below the informations of your order:') %>
14 14 </p>
15 15  
16 16 <ul>
17   - <li><b><%= c_('Full name') %>: </b><%= @customer[:name] %></li>
18   - <li><b><%= c_('Email') %>: </b><%= @customer[:email] %></li>
19   - <li><b><%= _('Phone number') %>: </b><%= @customer[:contact_phone] %></li>
20   - <li><b><%= _('Payment') %>: </b><%= @customer[:payment] == 'money' ? _('Money') : _('shopping_cart|Check') %></li>
21   - <% if @customer[:payment] == 'money' %>
22   - <li><b><%= _('shopping_cart|Change') %>: </b><%= @customer[:change] %></li>
  17 + <li><b><%= c_('Full name') %>: </b><%= @order.consumer_data[:name] %></li>
  18 + <li><b><%= c_('Email') %>: </b><%= @order.consumer_data[:email] %></li>
  19 + <li><b><%= _('Phone number') %>: </b><%= @order.consumer_data[:contact_phone] %></li>
  20 +
  21 + <li><b><%= _("Payment's method") %>: </b><%= _ OrdersPlugin::Order::PaymentMethods[@order.payment_data[:method].to_sym].call %></li>
  22 + <% if @order.payment_data[:method] == 'money' %>
  23 + <li><b><%= s_('shopping_cart|Change') %>: </b><%= @order.payment_data[:change] %></li>
  24 + <% end %>
  25 +
  26 + <li><b><%= _('Delivery or pickup') %>:</b></li>
  27 + <%= @order.supplier_delivery_data[:name] %><br/>
  28 + <p>
  29 + <i><%= @order.supplier_delivery_data[:description] %></i>
  30 + </p>
  31 +
  32 + <% if !@order.consumer_delivery_data[:address].blank? || !@order.consumer_delivery_data[:city].blank? || !@order.consumer_delivery_data[:zip_code].blank? || !@order.consumer_delivery_data[:district].blank? || !@order.consumer_delivery_data[:address_reference].blank? %>
  33 + <li><b><%= c_('Address') %>:</b></li>
  34 + <% end %>
  35 + <% if !@order.consumer_delivery_data[:address].blank? %>
  36 + <%= @order.consumer_delivery_data[:address] %><br \>
23 37 <% end %>
24   - <% if !@customer[:address].blank? || !@customer[:city].blank? || !@customer[:zip_code].blank? || !@customer[:district].blank? || !@customer[:address_reference].blank? %>
25   - <li><b><%= c_('Address') %>:</b>
  38 + <% if !@order.consumer_delivery_data[:address_line2].blank? %>
  39 + <%= @order.consumer_delivery_data[:address_line2] %><br \>
26 40 <% end %>
27   - <% if !@customer[:address].blank? %>
28   - <%= @customer[:address] %><br \>
  41 + <% if !@order.consumer_delivery_data[:address_reference].blank? %>
  42 + <%= @order.consumer_delivery_data[:address_reference] %><br \>
29 43 <% end %>
30   - <% if !@customer[:district].blank? %>
31   - <%= @customer[:district] %><br \>
  44 + <% if !@order.consumer_delivery_data[:district].blank? %>
  45 + <%= @order.consumer_delivery_data[:district] %><br \>
32 46 <% end %>
33   - <% if !@customer[:city].blank? %>
34   - <%= @customer[:city] %><br \>
  47 + <% if !@order.consumer_delivery_data[:city].blank? %>
  48 + <%= @order.consumer_delivery_data[:city] %><br \>
35 49 <% end %>
36   - <% if !@customer[:zip_code].blank? %>
37   - <%= @customer[:zip_code] %>
  50 + <% if !@order.consumer_delivery_data[:state].blank? %>
  51 + <%= @order.consumer_delivery_data[:state] %><br \>
38 52 <% end %>
39   - <% if !@customer[:address_reference].blank? %>
40   - <%= @customer[:address_reference] %><br \>
  53 + <% if !@order.consumer_delivery_data[:zip_code].blank? %>
  54 + <%= @order.consumer_delivery_data[:zip_code] %>
41 55 <% end %>
42   - <% if !@customer[:address].blank? || !@customer[:city].blank? || !@customer[:zip_code].blank? || !@customer[:district].blank? || !@customer[:address_reference].blank? %>
  56 + <% if !@order.consumer_delivery_data[:address].blank? || !@order.consumer_delivery_data[:city].blank? || !@order.consumer_delivery_data[:zip_code].blank? || !@order.consumer_delivery_data[:district].blank? || !@order.consumer_delivery_data[:address_reference].blank? %>
43 57 </li>
44 58 <% end %>
45 59 </ul>
46 60  
47 61 <p><%=_('Here are the products you bought:')%></p>
48   - <%= @helper.items_table(@items, @supplier, @delivery_option, true) %>
  62 + <%= items_table(@items, @order.profile, @order.supplier_delivery, true) %>
49 63 <p>
50 64 --<br/>
51 65 <%=_('Thanks for buying with us!')%><br/>
52   - <%= link_to @supplier.name, @supplier.url %>
  66 + <%= link_to @order.profile.name, @order.profile.url %>
53 67 </p>
54 68 <small style="color: #888"><%= _('A service of %s.') % @environment.name %></small>
55 69 </body>
... ...
plugins/shopping_cart/views/shopping_cart_plugin/mailer/supplier_notification.html.erb
... ... @@ -4,46 +4,54 @@
4 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
5 5 </head>
6 6 <body>
7   - <h4><%= _('Hi %s!') % @supplier.name %></h4>
  7 + <h4><%= _('Hi %s!') % @order.profile.name %></h4>
8 8  
9 9 <p>
10   - <%= _('This is a buy request made by %s.') % @customer[:name] %>
  10 + <%= _('This is a buy request made by %s.') % @order.consumer_data[:name] %>
11 11 <%= _('Below follows the customer informations:') %>
12 12 </p>
13 13  
14 14 <ul>
15   - <li><b><%= c_('Full name') %>: </b><%= @customer[:name] %></li>
16   - <li><b><%= c_('Email') %>: </b><%= @customer[:email] %></li>
17   - <li><b><%= _('Phone number') %>: </b><%= @customer[:contact_phone] %></li>
18   - <li><b><%= _('Payment') %>: </b><%= @customer[:payment] == 'money' ? _('Money') : _('shopping_cart|Check') %></li>
19   - <% if @customer[:payment] == 'money' %>
20   - <li><b><%= _('shopping_cart|Change') %>: </b><%= @customer[:change] %></li>
21   - <% end %>
22   - <% if !@customer[:address].blank? || !@customer[:city].blank? || !@customer[:zip_code].blank? || !@customer[:district].blank? || !@customer[:address_reference].blank? %>
  15 + <li><b><%= c_('Full name') %>: </b><%= @order.consumer_data[:name] %></li>
  16 + <li><b><%= c_('Email') %>: </b><%= @order.consumer_data[:email] %></li>
  17 + <li><b><%= _('Phone number') %>: </b><%= @order.consumer_data[:contact_phone] %></li>
  18 +
  19 + <li><b><%= _('Payment') %>: </b><%= OrdersPlugin::Order::PaymentMethods[@order.payment_data[:method].to_sym].call %></li>
  20 + <% if @order.payment_data[:method] == 'money' %>
  21 + <li><b><%= s_('shopping_cart|Change') %>: </b><%= @order.payment_data[:change] %></li>
  22 + <% end %>
  23 +
  24 + <% if !@order.consumer_delivery_data[:address].blank? || !@order.consumer_delivery_data[:city].blank? || !@order.consumer_delivery_data[:zip_code].blank? || !@order.consumer_delivery_data[:district].blank? || !@order.consumer_delivery_data[:address_reference].blank? %>
23 25 <li><b><%= c_('Address') %>:</b>
24 26 <% end %>
25   - <% if !@customer[:address].blank? %>
26   - <%= @customer[:address] %><br \>
  27 + <% if !@order.consumer_delivery_data[:address].blank? %>
  28 + <%= @order.consumer_delivery_data[:address] %><br \>
  29 + <% end %>
  30 + <% if !@order.consumer_delivery_data[:address_line2].blank? %>
  31 + <%= @order.consumer_delivery_data[:address_line2] %><br \>
  32 + <% end %>
  33 + <% if !@order.consumer_delivery_data[:address_reference].blank? %>
  34 + <%= @order.consumer_delivery_data[:address_reference] %><br \>
27 35 <% end %>
28   - <% if !@customer[:district].blank? %>
29   - <%= @customer[:district] %><br \>
  36 + <% if !@order.consumer_delivery_data[:district].blank? %>
  37 + <%= @order.consumer_delivery_data[:district] %><br \>
30 38 <% end %>
31   - <% if !@customer[:city].blank? %>
32   - <%= @customer[:city] %><br \>
  39 + <% if !@order.consumer_delivery_data[:city].blank? %>
  40 + <%= @order.consumer_delivery_data[:city] %><br \>
33 41 <% end %>
34   - <% if !@customer[:zip_code].blank? %>
35   - <%= @customer[:zip_code] %>
  42 + <% if !@order.consumer_delivery_data[:state].blank? %>
  43 + <%= @order.consumer_delivery_data[:state] %><br \>
36 44 <% end %>
37   - <% if !@customer[:address_reference].blank? %>
38   - <%= @customer[:address_reference] %><br \>
  45 + <% if !@order.consumer_delivery_data[:zip_code].blank? %>
  46 + <%= @order.consumer_delivery_data[:zip_code] %>
39 47 <% end %>
40   - <% if !@customer[:address].blank? || !@customer[:city].blank? || !@customer[:zip_code].blank? || !@customer[:district].blank? || !@customer[:address_reference].blank? %>
  48 + <% if !@order.consumer_delivery_data[:address].blank? || !@order.consumer_delivery_data[:city].blank? || !@order.consumer_delivery_data[:zip_code].blank? || !@order.consumer_delivery_data[:district].blank? || !@order.consumer_delivery_data[:address_reference].blank? %>
41 49 </li>
42 50 <% end %>
43 51 </ul>
44 52  
45 53 <p><%=_('And here are the items bought by this customer:')%></p>
46   - <%= @helper.items_table(@items, @supplier, @delivery_option, true) %>
  54 + <%= items_table(@items, @order.profile, @order.supplier_delivery, true) %>
47 55 <p>
48 56 --<br/>
49 57 <%=_('If there are any problems with this email contact the admin of %s.') % @environment.name %>
... ...
plugins/shopping_cart/views/shopping_cart_plugin/send_request.html.erb
... ... @@ -1 +0,0 @@
1   -<%= _("Request sent successfully check your email.")%>
plugins/shopping_cart/views/shopping_cart_plugin/send_request.js.erb 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +<% if @success %>
  2 + window.location.href = <%= url_for(controller: :catalog, profile: @profile.identifier).to_json %>
  3 +<% else %>
  4 + display_notice(<%= "#{_ 'Error'}: #{@error}".to_json %>)
  5 +<% end %>
... ...
plugins/shopping_cart/views/shopping_cart_plugin_myprofile/_orders_list.html.erb
... ... @@ -1,61 +0,0 @@
1   -<% if @orders.empty? %>
2   - <p><i><%= _("No results.") %></i></p>
3   -<% else %>
4   - <table>
5   - <tr>
6   - <th><%= _('Date') %></th>
7   - <th><%= _('Customer') %></th>
8   - <th><%= _('Purchase value') %></th>
9   - <th><%= _('Status')%></th>
10   - <th>&nbsp;</th>
11   - </tr>
12   - <% status_collection.delete_at(0) %>
13   - <% @orders.each do |order|%>
14   - <tr>
15   - <td><%= order.created_at.strftime("%Y-%m-%d")%></td>
16   - <td><%= order.customer_name %></td>
17   - <td style="text-align: right"><%= float_to_currency_cart(order.products_list.sum {|id, qp| qp[:price]*qp[:quantity]}, environment) %></td>
18   - <td>
19   - <% form_tag :action => 'update_order_status' do %>
20   - <%= hidden_field_tag(:order_id, order.id) +
21   - hidden_field_tag(:context_from, @from) +
22   - hidden_field_tag(:context_to, @to) +
23   - hidden_field_tag(:context_status, @status) +
24   - select_tag( :order_status, options_from_collection_for_select(status_collection, :first, :last, order.status),
25   - :onchange => "this.form.submit()" )
26   - %>
27   - <% end %>
28   - </td>
29   - <td><button class="view-order-details" data-order="<%=order.id%>"><%=c_('View details')%></button></td>
30   - </tr>
31   - <tr id="order-details-<%=order.id%>" style="display:none">
32   - <td class="order-info" colspan="5">
33   - <div style="display:none">
34   - <ul class="customer-details">
35   - <% [['name', _('Name')], ['email', _('E-mail')], ['contact_phone', c_('Contact phone')], ['address', c_('Address')], ['district', c_('District')], ['city', c_('City')], ['zip_code', c_('Zip code')], ['delivery_option', _('Delivery option')], ['payment', _('Payment')], ['change', _('shopping_cart|Change')]].each do |field| %>
36   - <% attribute = field.first %>
37   - <% name = field.last %>
38   - <%= content_tag('li', content_tag('strong', name+': ') + order.send('customer_'+attribute)) if !order.send('customer_'+attribute).blank? %>
39   - <% end %>
40   - </ul>
41   - <ul class="order-products">
42   - <% order.products_list.each do |id, qp| %>
43   - <%
44   - begin
45   - product = Product.find(id)
46   - rescue
47   - product = nil
48   - end
49   - %>
50   - <li><%= product ? link_to(product.name, product.url) : qp[:name]%>
51   - &times; <%= qp[:quantity] %> = <%= float_to_currency_cart( qp[:quantity] * qp[:price], environment ) %></li>
52   - <% end %>
53   - </ul>
54   - <br style="clear:both"/>
55   - </div>
56   - </td>
57   - </tr>
58   - <% end %>
59   - </table>
60   -<% end %>
61   -
plugins/shopping_cart/views/shopping_cart_plugin_myprofile/_products_list.html.erb
... ... @@ -1,17 +0,0 @@
1   -<% if @products.empty? %>
2   - <p><i><%= _("No results.") %></i></p>
3   -<% else %>
4   - <table>
5   - <tr>
6   - <th><%= c_('Product') %></th>
7   - <th><%= _('Quantity') %></th>
8   - </tr>
9   - <% @products.each do |id, item|%>
10   - <tr>
11   - <td><%= item.product ? link_to(item.name, item.product.url) : item.name %></td>
12   - <td style="text-align: center"><%= item.quantity %></td>
13   - </tr>
14   - <% end %>
15   - </table>
16   -<% end %>
17   -
plugins/shopping_cart/views/shopping_cart_plugin_myprofile/edit.html.erb
1 1 <h1> <%= _('Basket options') %> </h1>
2 2  
3   -<%= form_for(:settings, :url => {:action => 'edit'}, :html => {:method => 'post'}) do |f| %>
4   - <%= labelled_form_field(_('Enable shopping basket'), f.check_box(:enabled)) %>
5   - <%= labelled_form_field(_('Enable delivery fields on orders'), f.check_box(:delivery)) %>
6   - <% display_delivery_settings = @settings.delivery ? 'auto' : 'none' %>
7   - <fieldset id='delivery_settings' style="display: <%= display_delivery_settings %>"><legend><%=_('Delivery')%></legend>
8   - <table>
9   - <tr>
10   - <th><%= _('Option') %></th>
11   - <th><%= c_('Price') %></th>
12   - <th>&nbsp;</th>
13   - </tr>
14   - <% @settings.delivery_options.each do |option, price| %>
15   - <tr>
16   - <td><%= text_field_tag('settings[delivery_options][options][]', option, :style => 'width: 100%') %></td>
17   - <td><%= text_field_tag('settings[delivery_options][prices][]', price, :style => 'width: 100%') %></td>
18   - <td><%= button_without_text(:close, _('Remove option'), '', :class => 'remove-option') %></td>
19   - </tr>
20   - <% end %>
21   - <tr>
22   - <td><%= text_field_tag('settings[delivery_options][options][]', nil, :style => 'width: 100%') %></td>
23   - <td><%= text_field_tag('settings[delivery_options][prices][]', nil, :style => 'width: 100%') %></td>
24   - <td><%= button_without_text(:close, _('Remove option'), '', :class => 'remove-option') %></td>
25   - </tr>
26   - <tr id='add-new-option-row'>
27   - <td colspan='3' style='background-color: #EEE; text-align: center'><%= link_to(_('ADD NEW OPTION'), '', :id => 'add-new-option') %></td>
28   - </tr>
29   - <tr id="empty-option" style='display: none'>
30   - <td><%= text_field_tag('settings[delivery_options][options][]', nil, :style => 'width: 100%') %></td>
31   - <td><%= text_field_tag('settings[delivery_options][prices][]', nil, :style => 'width: 100%') %></td>
32   - <td><%= button_without_text(:close, _('Remove option'), '', :class => 'remove-option') %></td>
33   - </tr>
34   - </table>
  3 +<%= form_for :settings, url: {action: 'edit'}, html: {onsubmit: '$(this).ajaxSubmit()'} do |f| %>
35 4  
36   - <%= labelled_form_field(_("Order's minimum price for free delivery:"), f.text_field(:free_delivery_price)) %>
37   - <%= content_tag('small', _('Leave empty to always charge the delivery.')) %>
38   - </fieldset>
39   - <br style='clear: both'/>
40   - <br style='clear: both'/>
41 5 <div>
42   - <%= submit_button(:save, c_('Save')) %>
43   - <%= button :back, c_('Back to control panel'), :controller => 'profile_editor' %>
  6 + <%= f.check_box :enabled, onchange: 'this.form.onsubmit()' %>
  7 + <%= f.label :enabled, _('Enable shopping basket') %>
44 8 </div>
45   -<% end%>
  9 +
  10 +<% end %>
  11 +
  12 +<fieldset id='delivery-settings'>
  13 + <label><%=_('Deliveries or pickups')%></label>
  14 + <%= render 'delivery_plugin/admin_method/index' %>
  15 +</fieldset>
46 16  
47 17 <%= javascript_include_tag '../plugins/shopping_cart/edit' %>
... ...
plugins/shopping_cart/views/shopping_cart_plugin_myprofile/edit.js.erb 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +<% if @success %>
  2 + display_notice(<%= _('Option updated successfully.').to_json %>)
  3 +<% else %>
  4 + display_notice(<%= _('Option wasn\'t updated successfully.').to_json %>)
  5 +<% end %>
... ...
plugins/shopping_cart/views/shopping_cart_plugin_myprofile/reports.html.erb
... ... @@ -1,57 +0,0 @@
1   -<h1> <%= _('Purchase Reports') %> </h1>
2   -
3   -<% extend ProfileHelper %>
4   -<% extend ShoppingCartPlugin::CartHelper %>
5   -
6   -<% status = ShoppingCartPlugin::PurchaseOrder::Status.name; pos=-1 %>
7   -<% status_collection = [[nil, c_('All')]] %>
8   -<% status_collection += status.map{|s| [pos+=1, s] } %>
9   -
10   -<% form_tag({}, {:id => 'cart-order-filter'}) do %>
11   - <%= labelled_text_field(c_('From')+' ', :from, @from.strftime("%Y-%m-%d"), :id => 'from', :size => 9) %>
12   - <%= labelled_text_field(_('to')+' ', :to, @to.strftime("%Y-%m-%d"), :id => 'to', :size => 9) %>
13   - <span style="white-space:nowrap"><%= labelled_select(_('Status')+' ', :filter_status, :first, :last, @status, status_collection)%></span>
14   - &nbsp;
15   - <%= submit_button('save', c_('Filter')) %>
16   -<% end %>
17   -
18   -<% tabs = [] %>
19   -<% tabs << {:title => _('Products list'), :id => 'products_list', :content => (render :partial => 'products_list')} %>
20   -<% tabs << {:title => _('Orders list'), :id => 'orders_list', :content => (render :partial => 'orders_list', :locals => {:status_collection => status_collection})} %>
21   -<%= render_tabs(tabs) %>
22   -
23   -<script>
24   - var dates = jQuery( "#from, #to" ).datepicker({
25   - defaultDate: "+1w",
26   - changeMonth: true,
27   - dateFormat: 'yy-mm-dd',
28   - onSelect: function( selectedDate ) {
29   - var option = this.id == "from" ? "minDate" : "maxDate",
30   - instance = jQuery( this ).data( "datepicker" ),
31   - date = jQuery.datepicker.parseDate(
32   - instance.settings.dateFormat ||
33   - jQuery.datepicker._defaults.dateFormat,
34   - selectedDate, instance.settings );
35   - dates.not( this ).datepicker( "option", option, date );
36   - }
37   - });
38   - jQuery(".view-order-details").each(function(index, bt){
39   - jQuery(bt).button({
40   - icons: {
41   - primary: "ui-icon-info"
42   - },
43   - text: false
44   - });
45   - bt.onclick = function(){
46   - var orderId = this.getAttribute("data-order");
47   - var tr = jQuery("#order-details-"+orderId);
48   - var div = jQuery("#order-details-"+orderId+" div");
49   - if ( tr[0].style.display == "none" ) {
50   - tr.show();
51   - div.slideDown('fast');
52   - } else {
53   - div.slideUp("fast", function(){tr.hide()});
54   - }
55   - }
56   - });
57   -</script>
plugins/shopping_cart/views/shopping_cart_plugin_profile/buy.html.erb
... ... @@ -1,35 +0,0 @@
1   -<% person = user.nil? ? Person.new : user %>
2   -<div id='cart-request-box'>
3   - <%= form_for(:customer, person, :url => {:action => 'send_request'},
4   - :html => {:onsubmit => "return Cart.send_request(this)", :id => 'cart-request-form' }) do |f| %>
5   - <div id="cart-form-main">
6   - <%= labelled_form_field('* ' + _("Name"), f.text_field(:name, :class => 'required') ) %>
7   - <%= labelled_form_field('* ' + c_("Email"), f.text_field(:email, :class => 'required email') ) %>
8   - <%= labelled_form_field('* ' + c_("Contact phone"), f.text_field(:contact_phone, :class => 'required') ) %>
9   - </div>
10   - <fieldset><legend><%=_('Delivery Address')%></legend>
11   - <%= labelled_form_field(c_('Address (street and number)'), f.text_field(:address)) %>
12   - <%= labelled_form_field( c_("City"), f.text_field(:city)) %>
13   - <%= labelled_form_field(c_('ZIP code'), f.text_field(:zip_code)) %>
14   - </fieldset>
15   - <div id="cart-form-actions">
16   - <%= submit_button(:send, _('Send buy request')) %>
17   - </div>
18   - <% end %>
19   - <%= items_table(session[:cart][:items], profile) %>
20   - <%= link_to_function '', "noosfero.modal.close();", :class => 'cart-box-close icon-cancel' %>
21   -</div>
22   -
23   -<script type="text/javascript">
24   -//<![CDATA[
25   - jQuery(document).ready(function(){
26   - jQuery("#cart-request-form").validate({
27   - submitHandler: function(form) {
28   - jQuery(form).find('input.submit').attr('disabled', true);
29   - jQuery('#cboxLoadingOverlay').show().addClass('loading');
30   - jQuery('#cboxLoadingGraphic').show().addClass('loading');
31   - }
32   - });
33   - });
34   -//]]>
35   -</script>