diff --git a/app/views/spree/admin/overview/_enterprise_row.html.haml b/app/views/spree/admin/overview/_enterprise_row.html.haml new file mode 100644 index 0000000000..682a50b65c --- /dev/null +++ b/app/views/spree/admin/overview/_enterprise_row.html.haml @@ -0,0 +1,33 @@ +%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::PaymentMethod) && enterprise.is_distributor + - payment_method_count = enterprise.payment_methods.count + - if payment_method_count > 0 + %span.icon-ok-sign{ 'ofn-with-tip' => "#{pluralize payment_method_count, 'payment method'}" } + - else + %span.icon-remove-sign{ 'ofn-with-tip' => t('.has_no_payment_methods', enterprise: enterprise.name) } + - else +   + %span.symbol.three.columns.centered + - if can?(:admin, Spree::ShippingMethod) && enterprise.is_distributor + - shipping_method_count = enterprise.shipping_methods.count + - if shipping_method_count > 0 + %span.icon-ok-sign{ 'ofn-with-tip' => "#{pluralize shipping_method_count, 'shipping method'}" } + - else + %span.icon-remove-sign{ 'ofn-with-tip' => t('.has_no_shipping_methods', enterprise: enterprise.name) } + - else +   + %span.symbol.three.columns.centered + - if can?(:admin, EnterpriseFee) && enterprise.is_distributor + - fee_count = enterprise.enterprise_fees.count + - if fee_count > 0 + %span.icon-ok-sign{ 'ofn-with-tip' => "#{pluralize fee_count, 'fee'}" } + - else + %span.icon-warning-sign{ 'ofn-with-tip' => t('.has_no_enterprise_fees', enterprise: enterprise.name) } + - else +   + %span.two.columns.omega.right + %span.icon-arrow-right + diff --git a/app/views/spree/admin/overview/_enterprises.html.haml b/app/views/spree/admin/overview/_enterprises.html.haml index 5b7cfa056b..1ffb68e8cb 100644 --- a/app/views/spree/admin/overview/_enterprises.html.haml +++ b/app/views/spree/admin/overview/_enterprises.html.haml @@ -26,38 +26,7 @@ = t "spree_admin_enterprises_fees" %div.sixteen.columns.alpha.list - @enterprises.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::PaymentMethod - - payment_method_count = enterprise.payment_methods.count - - if payment_method_count > 0 - %span.icon-ok-sign{ 'ofn-with-tip' => "#{pluralize payment_method_count, 'payment method'}" } - - else - %span.icon-remove-sign{ 'ofn-with-tip' => t('.has_no_payment_methods', enterprise: enterprise.name) } - - else -   - %span.symbol.three.columns.centered - - if can? :admin, Spree::ShippingMethod - - shipping_method_count = enterprise.shipping_methods.count - - if shipping_method_count > 0 - %span.icon-ok-sign{ 'ofn-with-tip' => "#{pluralize shipping_method_count, 'shipping method'}" } - - else - %span.icon-remove-sign{ 'ofn-with-tip' => t('.has_no_shipping_methods', enterprise: enterprise.name) } - - else -   - %span.symbol.three.columns.centered - - if can? :admin, EnterpriseFee - - fee_count = enterprise.enterprise_fees.count - - if fee_count > 0 - %span.icon-ok-sign{ 'ofn-with-tip' => "#{pluralize fee_count, 'fee'}" } - - else - %span.icon-warning-sign{ 'ofn-with-tip' => t('.has_no_enterprise_fees', enterprise: enterprise.name) } - - else -   - %span.two.columns.omega.right - %span.icon-arrow-right + = render 'enterprise_row', { enterprise: enterprise } %a.sixteen.columns.alpha.button.bottom.blue{ href: "#{main_app.admin_enterprises_path}" } = t "spree_admin_overview_enterprises_footer"