cirandas.net

commit 5f283fa46816a13dba5cd8e7ba852810a6150275

Author: Braulio Bhavamitra <braulio@prout.io>

Merge branch 'master' of http://github.com/CIRANDAS/noosfero-ecosol into stores

%!v(PANIC=String method: strings: negative Repeat count)


diff --git a/Gemfile.lock b/Gemfile.lock
index b0e4641b75e737850b425ad9fe2c46ad59155a46..010dff59eb609f72990b6f7a39892562b6a41446 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -346,10 +346,6 @@       slop (~> 3.4)
     pry-rails (0.3.6)
       pry (>= 0.10.4)
     public_suffix (2.0.5)
-    puma (3.8.2)
-    puma_worker_killer (0.1.0)
-      get_process_mem (~> 0.2)
-      puma (>= 2.7, < 4)
     rack (1.6.8)
     rack-accept (0.4.5)
       rack (>= 0.4)
@@ -416,7 +412,7 @@     riot_js-rails (0.7.1)
       execjs (~> 2)
       rails (>= 3.0, < 6.0)
     rmagick (2.16.0)
-    rollbar (2.14.1)
+    rollbar (2.15.0)
       multi_json
     rspec (3.6.0)
       rspec-core (~> 3.6.0)
@@ -589,7 +585,6 @@   premailer-rails
   protected_attributes
   pry
   pry-rails
-  puma_worker_killer
   rack-contrib
   rack-cors
   rack-timeout
@@ -632,4 +627,4 @@   wirble
   xss_terminate (= 0.0.0)!
 
 BUNDLED WITH
-   1.14.6
+   1.15.4




diff --git a/app/mailers/mail_queuer.rb b/app/mailers/mail_queuer.rb
index fd706bce55f785908b2827a79639913e27f36aae..3d44e79f724180eb04c1b41927c88486123008d1 100644
--- a/app/mailers/mail_queuer.rb
+++ b/app/mailers/mail_queuer.rb
@@ -46,12 +46,12 @@     end
 
     def deliver_schedule last_sched
       limit   = ENV['MAIL_QUEUER_LIMIT'].to_i - 1
-      orig_to = to.dup
-      orig_cc = cc.dup
+      orig_to = Array(to).dup
+      orig_cc = Array(cc).dup
       dests   = {
-        to:  self.to,
-        cc:  self.cc,
-        bcc: self.bcc,
+        to:  Array(self.to),
+        cc:  Array(self.cc),
+        bcc: Array(self.bcc),
       }
 
       loop do
@@ -69,7 +69,7 @@         ##
         # The last schedule is outside the quota period
         #
         if last_sched.scheduled_to < 1.hour.ago
-          last_sched = MailSchedule.create! dest_count: 0, scheduled_to: Time.now
+          last_sched = MailSchedule.create! dest_count: 0, scheduled_to: Time.now.beginning_of_hour
         end
 
         available_limit = limit - last_sched.dest_count




diff --git a/plugins/orders/lib/orders_plugin/report.rb b/plugins/orders/lib/orders_plugin/report.rb
index 36d0b3efec5405baf7db44f88a162e77de026dd0..b511bc0ee081bac277dff78390a154e96e52f039 100644
--- a/plugins/orders/lib/orders_plugin/report.rb
+++ b/plugins/orders/lib/orders_plugin/report.rb
@@ -194,7 +194,7 @@         sheet.add_row [order.code, order.consumer_data[:name], '',order.consumer_data[:contact_phone],'',order.consumer_data[:email],''], style: default
         ["B#{sbs}:C#{sbs}", "D#{sbs}:E#{sbs}", "F#{sbs}:G#{sbs}"].each{ |c| sheet.merge_cells c }
 
         sbs += 1
-        sheet.add_row [t('lib.report.hub'), t('lib.report.payment_method'), t('lib.report.delivery_option'), '','',t('lib.report.created'), t('lib.report.modified')],
+        sheet.add_row [t('lib.report.payment_method'), t('lib.report.hub'), t('lib.report.delivery_option'), '','',t('lib.report.created'), t('lib.report.modified')],
           style: bluecell
         ["D#{sbs}:E#{sbs}"].each{ |c| sheet.merge_cells c }
         # sp = index of the start of the products list / ep = index of the end of the products list
@@ -208,11 +208,11 @@           payment_method = order.payment_data[:method]
           payment_method = payment_method.nil? ? '' : t("payments_plugin.models.payment_methods."+payment_method)
         end
 
-        sheet.add_row [order.suppliers_consumer&.hub_name, payment_method, order.supplier_delivery_data[:name], '','',order.created_at, order.updated_at],
+        sheet.add_row [payment_method, order.suppliers_consumer&.hub_name, order.supplier_delivery_data[:name], '','',order.created_at, order.updated_at],
           style: [default, default, default, default, default, date, date]
         sbs += 1
         sheet.add_row [t('lib.report.product_cod'), t('lib.report.supplier'), t('lib.report.product_name'),
-                       t('lib.report.qty_ordered'),t('lib.report.un'),t('lib.report.price_un'), t('lib.report.value')], style: greencell
+                       t('lib.report.qty_ordered'),t('lib.report.unit'),t('lib.report.price_un'), t('lib.report.value')], style: greencell
         ["D#{sbs}:E#{sbs}"].each{ |c| sheet.merge_cells c }
 
         sbe = sp
@@ -245,8 +245,9 @@           sum += formula_value
         end # closes order.items.each
 
         sum = CurrencyFields.number_as_currency_number(sum)
-        sheet.add_row ['','','','',t('lib.report.total_value'),"=SUM(G#{sp}:G#{ep})", ''], style: [default]*4+[bluecell,currency, default],
-          formula_values: [nil,nil,nil,nil,nil,sum, nil]
+        formula = if sp <= ep then "=SUM(G#{sp}:G#{ep})" else "=0" end
+        sheet.add_row ['','','','','',t('lib.report.total_value'),formula], style: [default]*5+[bluecell,currency],
+          formula_values: [nil,nil,nil,nil,nil,nil, sum]
 
         sheet.add_row [""]
         sbs = sbe + 2




diff --git a/plugins/orders/locales/pt-BR.yml b/plugins/orders/locales/pt-BR.yml
index 242f62d4923ce88f9a4c546b15c8d25556156dc5..efc0e035bc571084a07b99a19f8487de0aba2561 100644
--- a/plugins/orders/locales/pt-BR.yml
+++ b/plugins/orders/locales/pt-BR.yml
@@ -90,6 +90,7 @@         total_selled_value: "Valor total vendido"
         total_price_without_margin: "Valor total sem a margem"
         total_value: "total pago"
         un: un.
+        unit: unidade
         value: Valor
         value_parcel: "Valor usando estoque"
         phone: 'Telefone'




diff --git a/plugins/orders/models/orders_plugin/item.rb b/plugins/orders/models/orders_plugin/item.rb
index 546d4705b6e5a4be7293c96aa76621b919d41ffa..1f6faee11331785bc8a952c98a832aaf5df5c4cf 100644
--- a/plugins/orders/models/orders_plugin/item.rb
+++ b/plugins/orders/models/orders_plugin/item.rb
@@ -277,7 +277,7 @@     end
 
     # Set flags according to past/future data
     # Present flags are used as classes
-    statuses_data.each.with_index do |(status, status_data), i|
+    statuses_data.each.with_index do |(_status, status_data), i|
       prev_status_data = statuses_data[statuses[i-1]] unless i.zero?
 
       if prev_status_data
@@ -295,7 +295,7 @@       end
     end
 
     # reverse_each is necessary to set overwritten with intermediate not_modified
-    statuses_data.reverse_each.with_index do |(status, status_data), i|
+    statuses_data.reverse_each.with_index do |(_status, status_data), i|
       prev_status_data = statuses_data[statuses[-i-1]]
       if status_data[:not_modified] or
           (prev_status_data and prev_status_data[:flags][:filled] and status_data[:quantity] != prev_status_data[:quantity])




diff --git a/plugins/orders/public/javascripts/views/item-quantity-price.tag.slim b/plugins/orders/public/javascripts/views/item-quantity-price.tag.slim
index 1d7fb7cf8f40ca535e3926d0d181a436821a02c1..afb02c8ea1f2326250296e4f83c2f68eee72396b 100644
--- a/plugins/orders/public/javascripts/views/item-quantity-price.tag.slim
+++ b/plugins/orders/public/javascripts/views/item-quantity-price.tag.slim
@@ -79,7 +79,7 @@           }
         }
         var orderTag = this.parent.parent
         orderTag.updateOrder(order)
-        if (order.errors.length > 0)
+        if (order.errors && order.errors.length > 0)
           display_notice(this.t('views.item._edit.error'))
         else
           display_notice(this.t('views.item._edit.saved'))




diff --git a/plugins/orders_cycle/models/orders_cycle_plugin/sale.rb b/plugins/orders_cycle/models/orders_cycle_plugin/sale.rb
index 63be8f09f2d4a70c61bede8f9bc7bf9778b3e463..63f3028bbfe1e49e007f460486b2a7f0fda6e9de 100644
--- a/plugins/orders_cycle/models/orders_cycle_plugin/sale.rb
+++ b/plugins/orders_cycle/models/orders_cycle_plugin/sale.rb
@@ -101,5 +101,6 @@     purchase.destroy if purchase.items(true).blank?
   end
 
   handle_asynchronously :add_purchases_items
+  handle_asynchronously :remove_purchases_items
 
 end




diff --git a/plugins/orders_cycle/views/orders_cycle_plugin_order/edit.js.erb b/plugins/orders_cycle/views/orders_cycle_plugin_order/edit.js.erb
index 911be165e52b1599f3b2362a76f7f33781ba7e39..b14278d19f83b5781ed309d9da50cf16a1a24e7c 100644
--- a/plugins/orders_cycle/views/orders_cycle_plugin_order/edit.js.erb
+++ b/plugins/orders_cycle/views/orders_cycle_plugin_order/edit.js.erb
@@ -1,4 +1,4 @@
-jQuery('#order-<%=@order.id%>').replaceWith("<%= j render('orders_cycle_plugin_order/active_order', :order => @order, :actor_name => @actor_name) %>");
+jQuery('#order-<%=@order&.id%>').replaceWith("<%= j render('orders_cycle_plugin_order/active_order', :order => @order, :actor_name => @actor_name) %>");
 
 orders_cycle.order.product.setEditable(<%=@order.may_edit?(user, @admin).to_json%>)
 




diff --git a/plugins/products/views/products_plugin/page/show.html.erb b/plugins/products/views/products_plugin/page/show.html.erb
index af6a69eb245da169329b6911ea3e6563570d65cc..fc144ad7ce2104e0d671f1b27e35bf6d7b5d5204 100644
--- a/plugins/products/views/products_plugin/page/show.html.erb
+++ b/plugins/products/views/products_plugin/page/show.html.erb
@@ -96,7 +96,7 @@ <%= button_bar do %>
   <%= button_to_function :back, _('Back to the product listing'), "catalog.product.back(#{params[:rank]})" %>
   <% if user and (@user_is_admin or user.is_admin? profile) %>
     <%= button :add, _('Add product or service'), controller: "products_plugin/page", action: :new, profile: profile.identifier %>
-    <%= button :delete, _('Remove product or service'), {:action => 'destroy', :id => @product}, :class => 'requires-permission-products_plugin/page', :confirm => _('Are you sure you want to remove this product?') %>
+    <%= button :delete, _('Remove product or service'), {action: :destroy, id: @product, profile: profile.identifier}, class: 'requires-permission-products_plugin/page', confirm: _('Are you sure you want to remove this product?') %>
   <% end %>
 <% end %>
 




diff --git a/plugins/suppliers/locales/en-US.yml b/plugins/suppliers/locales/en-US.yml
index c4374bc90fa45cf6ea66f4e5e880ea22272c4ce7..7a22f69599ad53c9d42e2f8983127c3f125ee9f5 100644
--- a/plugins/suppliers/locales/en-US.yml
+++ b/plugins/suppliers/locales/en-US.yml
@@ -196,7 +196,7 @@         saved: "Saved!"
         close: "close"
         stock_modal: "Inventory movimentation"
         action: "Action"
-        quantity: "Quantity" 
+        quantity: "Quantity"
         description: "description"
         the_description: "Describe the movimentation. Ex: remotion of 2 boxes to distribution"
         adition: adition
@@ -462,6 +462,8 @@           cancel: Cancel
           rejection_message: "Please, explanain why you are rejecting this membership request"
           inactive: inactive
           active: active
+          filter: Filter
+          select_hub: Select a hub
 
   orders_cycle_plugin:
     terms:




diff --git a/plugins/suppliers/locales/pt-BR.yml b/plugins/suppliers/locales/pt-BR.yml
index bdd4746469722c06a25130225728ec62aaf4180a..991afced34d74f002df7ee16fb042006c058bbe1 100644
--- a/plugins/suppliers/locales/pt-BR.yml
+++ b/plugins/suppliers/locales/pt-BR.yml
@@ -202,7 +202,7 @@         saved: "Salvo!"
         close: "Fechar"
         stock_modal: "Movimentação de Estoque"
         action: "Ação"
-        quantity: "Quantidade" 
+        quantity: "Quantidade"
         description: "Descrição"
         the_description: "Descreva a movimentação. Ex: Saída de 2 caixas para distribuição"
         adition: "adição"
@@ -470,8 +470,8 @@           remove: Remover do grupo
           confirm_remove: "Você tem certeza de que quer remover '%{consumer}' do grupo?"
           disable: Desabilitar consumidor
           enable: Habilitar consumidor
-          confirm_disable: "Você tem certeza de que quer desabilitar '%{consumer}' de fazer pedidos no grupo?" 
-          confirm_enable: "Você tem certeza de que quer reabilitar '%{consumer}' a fazer pedidos no grupo?" 
+          confirm_disable: "Você tem certeza de que quer desabilitar '%{consumer}' de fazer pedidos no grupo?"
+          confirm_enable: "Você tem certeza de que quer reabilitar '%{consumer}' a fazer pedidos no grupo?"
           tasks: "<strong>%{people} pessoas</strong> aguardam aprovação para entrar no grupo"
           manage: "Gerenciar"
           saved: "Salvo!"
@@ -486,6 +486,8 @@           cancel: Cancelar
           rejection_message: "Por favor, explique por que você está rejeitando o pedido de filiação desse membro ao grupo."
           inactive: inativo
           active: ativo
+          filter: Filtro
+          select_hub: Selecione um núcleo
 
   orders_cycle_plugin:
     terms:




diff --git a/plugins/suppliers/public/javascripts/views/consumer-box.tag.slim b/plugins/suppliers/public/javascripts/views/consumer-box.tag.slim
index 543c50c9f8a679bc15c4c47f6600eb172ee70693..7f9ec36fedb09ddd44b31883cfdb349f763ce162 100644
--- a/plugins/suppliers/public/javascripts/views/consumer-box.tag.slim
+++ b/plugins/suppliers/public/javascripts/views/consumer-box.tag.slim
@@ -19,7 +19,7 @@               |{t('views.consumer.index.active')}
             .state if="{!consumer.active}"
               |{t('views.consumer.index.inactive')}
       div.col-xs-3
-        button 
+        button
           |{t('views.consumer.index.detail')}
 
   javascript:




diff --git a/plugins/suppliers/public/javascripts/views/consumer-page.tag.slim b/plugins/suppliers/public/javascripts/views/consumer-page.tag.slim
index 595df7418533f718faaacc4aaf61133e9b239259..2f83cd8bce0fecb02c7418d2e74b4702a0a7635f 100644
--- a/plugins/suppliers/public/javascripts/views/consumer-page.tag.slim
+++ b/plugins/suppliers/public/javascripts/views/consumer-page.tag.slim
@@ -26,10 +26,23 @@           .col-xs-12
             .pending-consumers.consumers-listing.row
               pending-consumer-box each='{consumer in pendingConsumers}' consumer='{consumer}'
 
-  .row
-    .search.col-xs-12
-      input name='search' placeholder="{cs.t('views.consumer.index.search')}" onkeyup='{search}'
-      .search-icon
+  .filter
+    input type='hidden' value="{page}"
+
+    h4
+      |{cs.t("views.consumer.index.filter")}
+    form.form-inline onsubmit="return false"
+      .form-group
+        .name
+          input name='search' placeholder="{cs.t('views.consumer.index.search')}" onkeyup='{search}'
+
+      .form-group.hub_id
+        select name="hub_id" onchange="{search}"
+          option value=""
+            |{cs.t("views.consumer.index.select_hub")}
+          option each="{hub in hubs}" value="{hub.id}" selected="{hub.id == filter_hub_id}"
+            |{hub.name}
+
 
   .consumers-listing.row
     consumer-box each='{consumer in consumers}' consumer='{consumer}'
@@ -45,16 +58,23 @@     this.hubs = opts.hubs;
     this.tasks = opts.tasks;
     this.editView = this.tags['consumer-view']
     this.tasks_count = opts.tasks_count
+    this.filter_hub_id = opts.filter_hub_id
 
     var self = this;
 
     search(e) {
       var needle = removeDiacritics($('input[name="search"]').val().toLowerCase())
       for (var i in this.consumers) {
-        var c      = this.consumers[i]
-        var field1 = removeDiacritics(c.name.toLowerCase())
-        var field2 = c.email || ''
-        this.consumers[i].selected = field1.indexOf(needle) > -1 || field2.indexOf(needle) > -1
+        if (needle) {
+          var field1 = removeDiacritics(this.consumers[i].name.toLowerCase())
+          var field2 = this.consumers[i].email || ''
+          this.consumers[i].selected = field1.indexOf(needle) > -1 || field2.indexOf(needle) > -1
+        } else this.consumers[i].selected = true;
+        // filter hub
+        hub_id = $(".filter select[name=hub_id").val()
+        if (hub_id && this.consumers[i].selected && this.consumers[i].hub_id != hub_id) {
+          this.consumers[i].selected = false
+        }
       }
     }
 




diff --git a/plugins/suppliers/public/javascripts/views/consumer-view.tag.slim b/plugins/suppliers/public/javascripts/views/consumer-view.tag.slim
index 9c10b5c03023b4f8df93016d91354a3d6092492b..096bef66dbe38f52983e4632a87c65e88f396e9c 100644
--- a/plugins/suppliers/public/javascripts/views/consumer-view.tag.slim
+++ b/plugins/suppliers/public/javascripts/views/consumer-view.tag.slim
@@ -13,9 +13,9 @@                 h1
                   |{consumer.name}
                   span if="{consumer.name != consumer.profile_name}"
                     |  ({consumer.profile_name})
-              a.cs-button href="" onclick='{remove}' 
+              a.cs-button href="" onclick='{remove}'
                 |{cs.t("views.consumer.index.remove")}
-              a.cs-button href="" onclick='{toggle}' if="{consumer.active}" 
+              a.cs-button href="" onclick='{toggle}' if="{consumer.active}"
                 |{cs.t("views.consumer.index.disable")}
               a.cs-button href="" onclick='{toggle}' if="{!consumer.active}"
                 |{cs.t("views.consumer.index.enable")}
@@ -143,6 +143,12 @@       this.consumerUrl = Routes.profile_path({profile: this.consumer.identifier})
       if (this.consumer.purchases == undefined)
         this.consumer.purchases = {}
       this.purchases = this.consumer.purchases
+      $(this.root).find('input,textarea').each(function (i,el) {
+        el.value = el.getAttribute('value')
+      })
+      $(this.root).find('select').each(function (i,el) {
+        $(el).val(this.consumer[$(el).attr("name")])
+      }.bind(this))
     }
     this.setConsumer(opts.consumer)
 
@@ -186,7 +192,7 @@         var self = this
         $.get(purchasesUrl, {}, function(purchases) {
           purchases.forEach(function(p) {
             self.consumer.purchases.push(p);
-          }) 
+          })
           self.update();
         }, 'json');
       }




diff --git a/plugins/suppliers/public/javascripts/views/import-modal.tag.slim b/plugins/suppliers/public/javascripts/views/import-modal.tag.slim
index 0eb3af54d8883867c45aa0d0f37b9048c3077fca..99067ba21f87249046b6c741762002e20945b6e8 100644
--- a/plugins/suppliers/public/javascripts/views/import-modal.tag.slim
+++ b/plugins/suppliers/public/javascripts/views/import-modal.tag.slim
@@ -54,14 +54,14 @@     this.t = window.products.t
 
     confirmRemoveAll() {
       var input = $('input.remove_all_suppliers')[0]
-      if (input.check) 
+      if (input.check)
         input.check = confirm(t('views.product.import.confirm_remove_all'))
     }
 
     import() {
       var self = this
       var importUrl = Routes.suppliers_plugin_product_path({profile: noosfero.profile, action: 'import'})
-      
+
       data = new FormData();
       data.append( 'csv',                  $('input.csv')[0].files[0]               )
       data.append( 'remove_all_suppliers', $('input.remove_all_suppliers')[0].value )




diff --git a/plugins/suppliers/public/javascripts/views/product-modal.tag.slim b/plugins/suppliers/public/javascripts/views/product-modal.tag.slim
index 23661359a88a4fac7fc39773e89ec463b8fff69b..c2ff7a7d3cde63a06741174cfaa6bb021885ee97 100644
--- a/plugins/suppliers/public/javascripts/views/product-modal.tag.slim
+++ b/plugins/suppliers/public/javascripts/views/product-modal.tag.slim
@@ -14,7 +14,7 @@             h1.title if="{product.id}"
               |{product.name}
             h1.title if="{!product.id}"
               |{t('views.product.add_product')}
-  
+
       .modal-body
         .row
           .col-xs-12.col-md-5
@@ -31,7 +31,8 @@                 label for="p-name"
                   |{t("views.product.product_name")}
                 small.title if="{product.id}"
                   |{t("views.product.name_change_warning")}
-                input type="text" value="{product.name}" id="p-name"
+                input type="text" value="{product.name}" id="p-name" name='name'
+
                 small.supplier_product_name show="{product.supplier_product_name != product.name && product.supplier_product_name != undefined}"
                   strong
                     |{t("views.product.supplier_product_name")}
@@ -44,8 +45,8 @@
               .form-group
                 label for="p-description"
                   |{t("views.product.description")}
-                textarea value="{product.description}" id="p-description"
-                
+                textarea value="{product.description}" id="p-description" name='description'
+
               .form-group
                 label for="p-product_category_id"
                   |{t("views.product.category")}
@@ -107,7 +108,7 @@         a href="" onclick="{remove}" class="remove_product" if="{product.id}"
           |{t('views.product.remove')}
         span.warning if="{product.id}"
           |{t('views.product.remove_warning')}
-          
+
 
   javascript:
     this.t = window.products.t
@@ -117,6 +118,12 @@       this.parent.typeaheadCategoryInit($('#p-product_category_id'), this.setCategory)
       this.parent.typeaheadUnitInit($('#p-unit_id'), this.setUnit)
     })
 
+    updateFormValues() {
+      $(this.root).find('input,textarea').each(function (i,el) {
+        el.value = el.getAttribute('value')
+      })
+    }
+
     setCategory(e, item) {
       this.product.product_category_id             = item.id
       this.productItem.product.product_category_id = item.id
@@ -151,7 +158,7 @@       if (!this.product.id)
         keys.push('supplier_id')
 
       var self = this;
-      
+
       keys.forEach(function(key) {
         var input = self["p-"+key];
 
@@ -220,14 +227,14 @@     }
 
     validate() {
       var keys = ['name', "supplier_id",'product_category_id']
-      
+
       for (var i in keys) {
         var input = this["p-"+keys[i]]
 
         if (keys[i] == 'supplier_id' && this.product.id)
           continue;
         // to validate category need to see the id instead of the input
-        if (keys[i] == 'product_category_id' && !this.product.product_category_id)
+        if (keys[i] == 'product_category_id' && typeof(this.product.product_category_id) == "string")
           input.value = ""
         if (input.value.trim() == "" || input.value == "0") {
           alert(this.t('views.product.validation_error_'+keys[i]))
@@ -241,7 +248,7 @@
     saveImage() {
       var self = this
       var saveUrl = Routes.suppliers_plugin_product_path({profile: noosfero.profile, action: 'set_image/'+this.product.id})
-      
+
       data = new FormData();
       data.append('image_builder', $('#image')[0].files[0])
       var opts = {




diff --git a/plugins/suppliers/public/javascripts/views/product-page.tag.slim b/plugins/suppliers/public/javascripts/views/product-page.tag.slim
index 8c3f4bbbd3c98247e55f893e3a8f677d4c7fd967..11c7723e251628b12e6ff817b39b2215b004edb7 100644
--- a/plugins/suppliers/public/javascripts/views/product-page.tag.slim
+++ b/plugins/suppliers/public/javascripts/views/product-page.tag.slim
@@ -251,8 +251,7 @@     completeEdition(product, productItem) {
       this.tags['product-modal'].product = product
       this.tags['product-modal'].productItem = productItem
       this.tags['product-modal'].update()
-      // riot is buggy!!
-      $("#p-description").val(this.tags['product-modal'].product.description)
+      this.tags['product-modal'].updateFormValues()
     }
 
     typeaheadCategoryInit (input, selected) {
@@ -286,6 +285,10 @@         { displayKey: 'name', source: source.ttAdapter() }
       )
 
       input.on('typeahead:selected', selected)
+    }
+
+    import() {
+      this.tags['import-modal'].units = opts.units
     }
 
     add() {




diff --git a/plugins/suppliers/public/stylesheets/consumer.scss b/plugins/suppliers/public/stylesheets/consumer.scss
index e602230349152534c50be2c2b42f123396eaeb58..a4fdd0e092d2892b7a62b7c911af9de61853ec0a 100644
--- a/plugins/suppliers/public/stylesheets/consumer.scss
+++ b/plugins/suppliers/public/stylesheets/consumer.scss
@@ -3,8 +3,8 @@   .left { float: left; }
 
   #content {
     .box-container-1 {
-      background-color: #EFEFEF;
-      .main-block { background-color: #EFEFEF; }
+      background-color: white;
+      .main-block { background-color: white; }
     }
 
     .main-block .consumers-page {
@@ -22,47 +22,61 @@         background-repeat: no-repeat;
         background-size: 27px auto;
       }
 
-      .search {
-        margin-top: 30px;
+      .filter {
+        width: 100%;
+        padding: 10px;
+        margin: 20px auto;
+        display: inline-block;
+        background-color: #f8f8f8;
+        border: 1px solid #efefef;
+
+        h4 {
+          font-size: 13px;
+          font-weight: bold;
+          float: left;
+          margin-right: 20px;
+        }
 
         ::-webkit-input-placeholder { /* WebKit, Blink, Edge */
-          color:    $cirandas-header-bg;
+          color:    #bababa;
           font-weight: bold;
         }
         :-moz-placeholder { /* Mozilla Firefox 4 to 18 */
-          color:    $cirandas-header-bg;
+          color:    #bababa;
           font-weight: bold;
           opacity:  1;
         }
         ::-moz-placeholder { /* Mozilla Firefox 19+ */
-          color:    $cirandas-header-bg;
+          color:    #bababa;
           font-weight: bold;
           opacity:  1;
         }
         :-ms-input-placeholder { /* Internet Explorer 10-11 */
-          color:    $cirandas-header-bg;
+          color:    #bababa;
           font-weight: bold;
         }
+
+        select {
+          background-color: #f8f8f8;
+          margin-left: 15px;
+          max-width: 300px;
+        }
+
+        .form-group {
+          width: 30%;
+        }
         input {
           border: none;
-          border-bottom: 2px solid $cirandas-header-bg;
           background-color: transparent;
-          color: $cirandas-header-bg;
           outline: none;
-          margin-bottom: 10px;
           font-size: 16px;
           width: 100%;
-          margin-bottom: 15px;
         }
-        .search-icon {
-          width: 25px;
-          height: 25px;
-          background-image: url(/plugins/consumers_coop/images/pesquisa.png);
-          background-repeat: no-repeat;
-          background-size: 24px auto;
-          position: absolute;
-          top: -2px;
-          right: 16px;
+        input, select {
+          @include input;
+        }
+        input,select {
+          background-color: white;
         }
       }
       .picture-block {
@@ -105,7 +119,7 @@         display: block;
 
         border: 2px solid $cirandas-header-bg;
         background-color: transparent;
-        color: #777; 
+        color: #777;
         font-size: 14px;
         font-weight: bold;
         text-transform: uppercase;
@@ -127,12 +141,12 @@       .right { float: right; }
 
       .consumer-box {
         &.inactive {
-          background-color: #e0e0e0;
+          background-color: #FAFAFA;
           .name-block {
             .state { color: red; }
           }
         }
-        background-color: white;
+        background-color: #F0F0F0;
         &:hover {
           background-color: #DBE2E1;
         }