.center.product_show
  
  .row
    .col_images
      .product_images
        -@product.product_images.order(:position).each do |product_image|
          =link_to image_tag(product_image.image_file.file.square.url), "#", :onclick => "$('#product_default_image').attr('data-zoom-image', $(this).data('zoom-url'));$('#product_default_image').attr('src', $(this).data('large-url'));$('#product_default_image').data('elevateZoom').swaptheimage($(this).data('large-url'), $(this).data('zoom-url')); return false;", :data => {:large_url => product_image.image_file.file.large.medium.url, :zoom_url => product_image.image_file.file.url}
    .col_image
      =image_tag @product.default_image.image_file.file.large.medium.url, :id => "product_default_image", :data => {:zoom_image => @product.default_image.image_file.file.url } if @product.default_image
      <script>
      $('#product_default_image').elevateZoom({cursor: "crosshair",zoomWindowFadeIn: 500, zoomWindowFadeOut: 750}); 
      </script>
      
    .col_description
      .product_description
        %h1= @product_lang.title
        
      
        .price
          -if !@product.price_reduced_ht?
            = number_to_currency(@product.price_ttc, locale: :fr)
          -else
            = number_to_currency(@product.price_reduced_ttc, locale: :fr)

        -if @product.price_reduced_ht?
          .price_reduced
            %span.strip
              = number_to_currency(@product.price_ttc, locale: :fr)
          
          
  
        -@porduct_order_product = ProductOrderProduct.new(product_id: @product.id )
        -@porduct_order_product.product_option_id =  @product.product_options_in_stock.first.id if @product.product_options_in_stock.first
        -@porduct_order_product.product_size_id =  @product.product_sizes_in_stock(@porduct_order_product.product_option_id).first.id if @product.product_sizes_in_stock(@porduct_order_product.product_option_id).first
        
        
        
        -if @product.product_stocks.where("stock_th > 0").count > 0
          = form_for [:public, @porduct_order_product], :remote => true do |f|
            = f.hidden_field :product_id
  
            .product_options
              -@product.product_options_in_stock.each do |product_option|
                
                =link_to product_option.lang(I18n.locale).name, "#", :onclick => "$('#product_option_id').val($(this).data('id'));option_active();update_size_in_stocks($(this).data('sizes-in-stock'));return false;", :data => {:id => product_option.id, :sizes_in_stock =>  @product.product_sizes_in_stock_id(product_option.id)}, :id => "product_option_link_#{product_option.id}", :class => "product_option_link"
                
      
            = f.hidden_field :product_option_id, :id => "product_option_id"
          

                  
  
            #product_sizes.product_sizes
              -@product.product_sizes_in_stock(:all).each do |product_size|
                =link_to product_size.name, "#", :onclick => "$('#product_size_id').val($(this).data('id'));size_active();return false;", :data => {:id => product_size.id }, :id => "product_size_link_#{product_size.id}", :class => "product_size_link "+("in_stock" if @product.product_sizes_in_stock_id(@porduct_order_product.product_option_id).include?(product_size.id)).to_s
              
            
            
        
            = f.hidden_field :product_size_id, :id => "product_size_id"
            
        
            = f.submit qit("add to cart", "Ajouter au panier"), :class => "add_to_cart"
            
            -if [1,2,14,15,33,13,30].include?(@product.product_category_id)
              .size_guide
                =link_to "Guide des tailles", "/fr/guide-des-tailles.html", :target => "_blank"
    
    
            :coffeescript
              @size_active = ->
                $(".product_size_link").removeClass("active")
                $("#product_size_link_"+ $("#product_size_id").val()).addClass("active")
            :javascript
              size_active();
      
            :coffeescript
              @option_active = ->
                $(".product_option_link").removeClass("active")
                $("#product_option_link_"+ $("#product_option_id").val()).addClass("active")
            :javascript
              option_active();
      
            :coffeescript
              @update_size_in_stocks =(ids) ->
                $(".product_size_link").removeClass("in_stock")
                $.each ids, (index, value) ->
                  $("#product_size_link_"+ value).addClass("in_stock")
                $(".in_stock").first().click()
        
            :javascript
              //update_size_in_stocks([1,2]);
      
            :scss
              .product_sizes a{
                display:none;
                &.in_stock{
                  display:inline-block;
                }
              }
              
      
        -else
          .no_stock
            Ce produit n'est plus en stock.
            
  #product_description
    =raw @product_lang.description