.qi_header
  .right=# link_to 'Ajouter une taille', new_admin_product_size_path, :class => "btn btn-primary", :remote => true
  %h1 

    Boutique
    %span
      Détail de la commande
      ="#"+@product_order.id.to_s
%hr
%h3=@product_order.reseaux.name if @product_order.reseaux

   
  
Documents générés
%table
  -@product_order.product_order_documents.each do |document|
    =render document if document.id
    
%hr
%br
  
  
.qi_row
  .qi_pannel.qi_plain.padding
    %p
      =link_to "Voir le détail des sous produits", subs_admin_product_order_path(@product_order)

    %p
      Payée ?
      ="oui" if @product_order.paid
      =link_to "Facture", bill_admin_product_order_path(@product_order)
      
      =link_to "BL #{@product_order.bl_number}", bl_admin_product_order_path(@product_order.token)
      
    
    -if @product_order.paid
      -if !@product_order.shiped
        %p
          =link_to ic(:truck)+" Signaler comme expédiée", ship_admin_product_order_path(@product_order), :data => {:confirm => "Les stocks seront mis à jour"}, :class => "btn btn-success"
      -else
        %p
          Envoyée le 
          =l @product_order.shiped_at if @product_order.shiped_at?
          
    
    %p
      Mode de paiment :
      -if @product_order.product_order_payment_type_ok_id == 3
        CB
      -elsif @product_order.product_order_payment_type_ok_id == 1
        Chèque
      -elsif @product_order.product_order_payment_type_ok_id == 2
        Virement
      -elsif @product_order.product_order_payment_type_ok_id == 4
        Mandat administratif
 

    %table.table
      %tr
        %td
          %h3 Adresse de facturation
          =render @product_order.particular_bill if @product_order.particular_bill
        %td
          %h3 Adresse de livraison
          =render @product_order.particular_send if @product_order.particular_send
    
    %table.table
      =render @product_order.product_order_products.order(:product_id)
  
    
      %tr
        %td{:colspan => 5, :style => "border:0;"}
        %td Total :
        %td= number_to_currency(@product_order.archived_total_articles, locale: :fr)
    
      -if @product_order.vourcher_code_archived
        %tr
          %td{:colspan => 5, :style => "border:0;"}
          %td
            =qit "Code réduction tableau", "Code de réduction "
            ="("+@product_order.vourcher_code_archived.slug+") :"
          %td  
            ="-"
            =number_to_currency @product_order.archived_vourcher_reduction, locale: :fr
    
      %tr
        %td{:colspan => 5, :style => "border:0;"}
        %td Frais de port :
        %td= number_to_currency(@product_order.archived_total_fdp, locale: :fr)
      %tr
        %td{:colspan => 5, :style => "border:0;"}
        %td
          %strong Total :
        %td
          %strong
            = number_to_currency(@product_order.archived_total_ttc, locale: :fr)
    .fdp
      %table.table
        %tr
          %td
            =@product_order.product_fdp_archived.fdp_description
          %td
            =number_to_currency @product_order.product_fdp_archived.price
    %br
    %table.table
      %thead
        %tr
          %th Identifiant paiement
          %th Date de paiement
          %th Type de paiement
  
          %th ID Ogone
          %th Status Ogone
          %th Erreur Ogone
          %th N°Carte
          %th Montant
          %th
    
  
      %tbody#product_order_payments
        =render @product_order.product_order_payments.order("created_at DESC")


%hr 
%hr

-#@product_order.generate_docs
%table.table
  -@product_orders = ProductOrder.where(:completed_finish => true).order("created_at ASC").each do |po|
    
    -if !po.reseaux
      -po.reseaux_id = 2
      -po.save
    -po.generate_docs
    %tr
      %td=po.reseaux.name if po.reseaux
      %td=link_to po.bl_number,[:admin,po]
      %td=po.product_order_documents[0].d_number if po.product_order_documents[0]
%br
%br
%br
%br