Remove enterprises producers tab from dashboard

This commit is contained in:
Pau Perez
2018-05-15 17:27:28 +02:00
parent d218a51d96
commit 5a182e8e88
7 changed files with 0 additions and 80 deletions

View File

@@ -203,14 +203,6 @@ class Enterprise < ActiveRecord::Base
self.supplied_products.where('count_on_hand > 0').present?
end
def supplied_and_active_products_on_hand
self.supplied_products.where('spree_products.count_on_hand > 0').active
end
def active_products_in_order_cycles
self.supplied_and_active_products_on_hand.in_an_active_order_cycle
end
def to_param
permalink
end

View File

@@ -5,7 +5,5 @@
= render 'enterprises_none'
- else
= render 'enterprises_tabs'
= render 'enterprises_hubs_tab'
= render 'enterprises_producers_tab'
= render 'enterprises_footer'

View File

@@ -1,47 +0,0 @@
%div.producers_tab{ ng: { show: "activeTab == 'producers'"} }
%div.list-title.sixteen.columns.alpha
%span.five.columns.alpha
= t "spree_admin_enterprises_producers_name"
- if can? :admin, Spree::Product
%span.centered.three.columns
= t "spree_admin_enterprises_producers_total_products"
%span.centered.three.columns
= t "spree_admin_enterprises_producers_active_products"
- if can? :admin, OrderCycle
%span.centered.three.columns
= t "spree_admin_enterprises_producers_order_cycles"
%div.sixteen.columns.alpha.list
- @enterprises.is_primary_producer.each do |enterprise|
%a.sixteen.columns.alpha.list-item{ class: "#{cycle('odd','even')}", href: "#{main_app.edit_admin_enterprise_path(enterprise)}" }
%span.five.columns.alpha
= enterprise.name
%span.symbol.three.columns.centered
- if can? :admin, Spree::Product
%span.one.column.alpha &nbsp;
%span.text-icon.one.column.centered{ class: "#{enterprise.supplied_products.not_deleted.any? ? "green" : "red" }" }
= enterprise.supplied_products.not_deleted.count
%span.one.column.omega &nbsp;
- else
&nbsp;
%span.symbol.three.columns.centered
- if can? :admin, Spree::Product
%span.one.column.alpha &nbsp;
%span.text-icon.one.column.centered{ class: "#{enterprise.supplied_and_active_products_on_hand.any? ? "green" : "red" }" }
= enterprise.supplied_and_active_products_on_hand.count
%span.one.column.omega &nbsp;
- else
&nbsp;
%span.symbol.three.columns.centered
- if can? :admin, OrderCycle
%span.one.column.alpha &nbsp;
%span.text-icon.one.column.centered{ class: "#{enterprise.active_products_in_order_cycles.any? ? "green" : "orange" }" }
= enterprise.active_products_in_order_cycles.count
%span.one.column.omega &nbsp;
- else
&nbsp;
%span.two.columns.omega.right
%span.icon-arrow-right

View File

@@ -1,5 +1,3 @@
%div.sixteen.columns.alpha.tabs
%div.dashboard_tab.eight.columns.alpha.blue{ ng: { class: "{selected: activeTab == 'hubs'}", click: "activeTab = 'hubs'" } }
= t "spree_admin_enterprises_tabs_hubs"
%div.dashboard_tab.eight.columns.omega.blue{ ng: { class: "{selected: activeTab == 'producers'}", click: "activeTab = 'producers'" } }
= t "spree_admin_enterprises_tabs_producers"

View File

@@ -1935,13 +1935,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
spree_admin_enterprises_fees: "Enterprise Fees"
spree_admin_enterprises_none_create_a_new_enterprise: "CREATE A NEW ENTERPRISE"
spree_admin_enterprises_none_text: "You don't have any enterprises yet"
spree_admin_enterprises_producers_name: "Name"
spree_admin_enterprises_producers_total_products: "Total Products"
spree_admin_enterprises_producers_active_products: "Active Products"
spree_admin_enterprises_producers_order_cycles: "Products in OCs"
spree_admin_enterprises_producers_order_cycles_title: ""
spree_admin_enterprises_tabs_hubs: "HUBS"
spree_admin_enterprises_tabs_producers: "PRODUCERS"
spree_admin_enterprises_producers_manage_products: "MANAGE PRODUCTS"
spree_admin_enterprises_any_active_products_text: "You don't have any active products."
spree_admin_enterprises_create_new_product: "CREATE A NEW PRODUCT"

View File

@@ -88,11 +88,6 @@ feature %q{
end
it "shows me enterprise product info but not payment methods, shipping methods or enterprise fees" do
# Producer product info
page.should have_selector '.producers_tab span', text: 'Total Products'
page.should have_selector '.producers_tab span', text: 'Active Products'
page.should_not have_selector '.producers_tab span', text: 'Products in OCs'
# Payment methods, shipping methods, enterprise fees
page.should_not have_selector '.hubs_tab span', text: 'Payment Methods'
page.should_not have_selector '.hubs_tab span', text: 'Shipping Methods'

View File

@@ -551,16 +551,6 @@ describe Enterprise do
end
end
describe "supplied_and_active_products_on_hand" do
it "find only active products which are in stock" do
supplier = create(:supplier_enterprise)
inactive_product = create(:product, supplier: supplier, on_hand: 1, available_on: Date.tomorrow)
out_of_stock_product = create(:product, supplier: supplier, on_hand: 0, available_on: Date.yesterday)
p1 = create(:product, supplier: supplier, on_hand: 1, available_on: Date.yesterday)
supplier.supplied_and_active_products_on_hand.should == [p1]
end
end
describe "finding variants distributed by the enterprise" do
it "finds master and other variants" do
d = create(:distributor_enterprise)