%tr#p_customer_sheet{:id => p_customer_sheet.id}
  -tr = {}

  -tr[:com_counter] = capture do
    %td
      =p_customer_sheet.com_counter
      
  -tr[:d_number] = capture do
    %td
      -if pd = p_customer_sheet.price_documents.where(:d_prefix => "BC").first
        =pd.d_number
  -tr[:p_commercial] = capture do
    %td
      = p_customer_sheet.p_commercial.long_name if p_customer_sheet.p_commercial
  
  -tr[:created_at] = capture do
    %td=l p_customer_sheet.created_at, :format => :date
  
  -tr[:wish_date] = capture do
    %td=l p_customer_sheet.price_line_block.wish_date, :format => "semaine %V (%Y)"
  
  -tr[:wish_date_2] = capture do
    %td=l p_customer_sheet.price_line_block.wish_date, :format => :date
  

  -tr[:p_customer] = capture do
    %td= p_customer_sheet.p_customer.show_name if p_customer_sheet.p_customer
    
  
  -tr[:tot_amount_ht] = capture do
    %td.numeraire
      =number_to_currency p_customer_sheet.tot_amount_ht
    
  -tr[:tot_amount_ttc] = capture do
    %td.numeraire
      =number_to_currency p_customer_sheet.tot_amount_ttc
  
  -tr[:state] = capture do
    %td
      =raw p_customer_sheet.state_html
      =ic :lock if p_customer_sheet.archived
  
  
  -tr[:actions] = capture do
    %td.actions
      -if p_customer_sheet.state == "brouillon"
        = link_to i(:"trash-o"), [:admin, p_customer_sheet], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cette demande ? ' } , :remote => true
      -if !p_customer_sheet.archived
        = link_to i(:pencil), edit_admin_p_customer_sheet_path(p_customer_sheet), :remote => false
      = link_to i(:eye), admin_p_customer_sheet_path(p_customer_sheet), :remote => false
  
  
  =render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => p_customer_sheet}
  
