- content_for(:title) do
  = @group.name
- content_for(:description) do
  = @group.description
- content_for(:image) do
  = url_for(@group.logo) if @group.logo.attached?

- content_for :scripts do
  = render partial: "shared/google_maps_js"

- content_for :injection_data do
  = inject_available_countries
  = inject_group_enterprises(@group)
  = inject_open_street_map_config
  - cache(*CacheService::FragmentCaching.ams_all_taxons) do
    = inject_taxons
  - cache(*CacheService::FragmentCaching.ams_all_properties) do
    = inject_properties

#group-page.row.pad-top.footer-pad{"ng-controller" => "GroupPageCtrl"}
  .small-12.columns.pad-top
    %header
      .row
        .small-12.columns
          = image_tag @group.promo_image.variant(resize_to_limit: [1200, 260]) if @group.promo_image.variable?
      .row
        .small-12.columns.group-header.pad-top
          - if @group.logo.variable?
            = image_tag @group.logo.variant(resize_to_limit: [100, 100]), class: "group-logo"
          - else
            = image_tag "/noimage/group.png", class: "group-logo"
          %h2.group-name= @group.name
          %p= @group.description

  .small-12.columns.pad-top
    .row
      .small-12.medium-12.large-9.embedded-fullwidth.columns
        %div{"ng-controller" => "GroupTabsCtrl"}
          %tabset
            %tab{heading: t(:label_map),
                active: "tabs.map.active",
                select: "select(\'map\')"}
              %div{"ng-if" => "(isActive(\'/map\') && (mapShowed = true)) || mapShowed"}
                = render partial: "shared/map"

            %tab{heading: t(:groups_about),
                active: "tabs.about.active",
                select: "select(\'about\')"}
              .about{ "embedded_target_blank" => true }
                %h1
                  = t :groups_about
                %p!= @group.long_description

            %tab{heading: t(:groups_producers),
                active: "tabs.producers.active",
                select: "select(\'producers\')"}
              .producers{"ng-controller" => "GroupEnterprisesCtrl"}
                .row
                  .small-12.columns
                    %h1
                      = t :groups_producers
                = render "shared/components/enterprise_search"
                = render "producers/filters"

                .row
                  .small-12.columns
                    .active_table
                      %producer.active_table_node.row.animate-repeat{id: "{{producer.path}}",
                      "ng-repeat" => "producer in filteredEnterprises = (Enterprises.producers | searchEnterprises:query | taxons:activeTaxons | properties:activeProperties:'supplied_properties')",
                      "ng-controller" => "ProducerNodeCtrl",
                      "ng-class" => "{'closed' : !open(), 'open' : open(), 'inactive' : !producer.active}",
                      id: "{{producer.hash}}"}

                        .small-12.columns
                          = render "producers/skinny"
                          = render "producers/fat"

                      = render 'shared/components/enterprise_no_results'

            %tab{heading: t(:groups_hubs),
                active: "tabs.hubs.active",
                select: "select(\'hubs\')"}
              .hubs{"ng-controller" => "GroupEnterprisesCtrl"}
                .row
                  .small-12.columns
                    %h1
                      = t :groups_hubs

                = render "shared/components/enterprise_search"
                = render "shops/filters", resource: "Enterprises.hubs", property_filters: "| searchEnterprises:query | taxons:activeTaxons | shipping:shippingTypes"

                .row
                  .small-12.columns
                    .active_table
                      %hub.active_table_node.row.animate-repeat{id: "{{hub.hash}}",
                      "ng-repeat" => "hub in filteredEnterprises = (Enterprises.hubs | searchEnterprises:query | taxons:activeTaxons | shipping:shippingTypes | properties:activeProperties:'distributed_properties' | orderBy:['+orders_close_at'])",
                      "ng-class" => "{'is_profile' : hub.category == 'hub_profile', 'closed' : !open(), 'open' : open(), 'inactive' : !hub.active, 'current' : current()}",
                      "ng-controller" => "HubNodeCtrl"}
                        .small-12.columns
                          = render 'shops/skinny'
                          = render 'shops/fat'

                      = render 'shared/components/enterprise_no_results'

      .small-12.medium-12.large-3.columns.contact
        = render 'contact'

  .small-12.columns.pad-top
    .row.pad-top
      .small-12.columns.text-center.small
        %hr
        %p.text-small
          = "Copyright #{Date.current.year} #{@group.name}"
        %h2
          =link_to_service "https://www.facebook.com/", @group.facebook, title: t(:groups_contact_facebook) do
            %i.ofn-i_044-facebook
          =link_to_service "", @group.email.reverse, title: t(:groups_contact_email), mailto: true do
            %i.ofn-i_050-mail-circle
          =link_to_service "http://", @group.website, title: t(:groups_contact_website) do
            %i.ofn-i_049-web
          .powered-by-embedded
            %img{src: '/favicon.ico'}
            %span
              = t 'powered_by'
            %span
              = t 'title'

= render "shared/footer"
