<commit_before>- prefixed_sub_header('Order', "#{@order.name}")

#summary
  = process_progression(@order)

= content do

  %div.panel
    %div.order-overview
      %ul
        %li
          %span.key Reference #
          %span.value.reference= @order.reference
        %li
          %span.key Placed
          %span.value= @order.logs.first.created_at.to_s(:pretty)
        %li
          %span.key Status
          %span.value= @order.status.humanize
        %li
          %span.key Total
          %span.value= "#{@order.sku_total_quantity} Item#{@order.sku_total_quantity > 1 ? 's' : ''},"
          %strong.value= @order.formatted_total
        - unless @order.credit_card_payment.blank?
          - if @order.credit_card_payment.authorization_expiry_warning?
            %li
              %span.key Authorization
              - if @order.credit_card_payment.authorization_expired?
                %span.value.indicator.warning Expired!
              - else
                %span.value.indicator.warning Expires Soon!

    %div.billing
      %h3 Billing Details

      %p.card-details
        %span.type{:class => "card-type-#{@order.credit_card_payment.card_type}"}= @order.credit_card_payment.card_type
        %span.number= @order.credit_card_payment.number
        %span.name= @order.credit_card_payment.full_name
        %span.expiry Expiry: #{@order.credit_card_payment.expiry}

    %div.address
      %h3 Billing Address

      %p
        %span.name
          %strong= @order.name
          - if @order.billing_company
            , 
            %span.company #{@order.billing_company}  
        %br/
        %span.street= @order.billing_street
        %br/
        %span.city= @order.billing_city
        %br/
        %span.state #{@order.billing_state} #{@order.billing_postcode}

    %div.address
      %h3 Shipping Address

      %p
        %span.name
          %strong= @order.ship_to
          - if @order.shipping_company
            ,
            %span.company #{@order.shipping_company}  
        %br/
        %span.street= @order.shipping_street
        %br/
        %span.city= @order.shipping_city
        %br/
        %span.state #{@order.shipping_state} #{@order.shipping_postcode}  

  %h3.items.inset Order Items
  %table.items.inset
    %thead
      %tr
        %th Product/SKU
        %th Quantity
        %th.currency Price
        %th.currency Total
        %th.currency Discount

    %tbody
      - @order.items.summary.each do |item|
        %tr
          %td
            = link_to(item.sku_name, path(:product, :id => item.product_id), :class => 'title')
          %td
            %span.numeric= item.quantity
          %td.currency
            %span.numeric= item.formatted_price
          %td.currency
            %span.numeric= item.formatted_total
          %td.currency
            - if item.discounted?
              %span.numeric.discount #{item.formatted_discount} discount
            - else
              &nbsp;

    %tfoot
      %tr
        %th(colspan=3)
          Product Total
        %td.currency
          %span.numeric= @order.formatted_product_total
        %td.currency
          - if @order.discounted_total?
            %span.numeric.discount #{@order.formatted_product_discount} discount
          - else
            &nbsp;

      %tr
        %th(colspan=3)
          Shipping
        %td.currency
          - if @order.free_shipping?
            FREE
          - else
            %span.numeric= @order.formatted_shipping_total
        %td
          &nbsp;

      %tr.total
        %th(colspan=3)
          Total
        %td.currency
          %span.numeric= @order.formatted_total
        %td
          &nbsp;

  %h3.inset Tracking
  %div.tracking.inset.collapsible{:class => @order.tracking_reference.blank? ? 'expanded' : 'collapsed'}
    - if @order.trackable?
      - unless @order.tracking_reference.blank?
        %p#displayTrackingReference.summary
          Tracking reference:
          %strong #{@order.tracking_reference}
          %a.collapsible-expander{:href => '#editTrackingReference'} Change
        
          = link_to('Track order&hellip;'.html_safe, @order.track_shipment, :class => 'track-order')

      #editTrackingReference.details
        = simple_form_for(@order, :url => :update_admin_order_process) do |f|
          = f.input(:tracking_reference)
          %button{:type => 'submit'} Save

    - else
      %p#displayTrackingReference.note This order will be trackable once it has been packed.

  %h3#order-activity-log.logs.inset Logs
  %table.logs.inset
    %thead
      %tr
        %th.boolean Succeeded?
        %th Action
        %th.notes Notes
        %th.meta On

    %tbody
      - @order.logs.summary.each do |log|
        %tr
          %td.boolean
            %span(class="boolean #{log.succeeded?}")
              %span= friendly_bool(log.succeeded?)
          %td
            %span.title= past_tense(log.action)
          %td
            - if log.notes?
              = simple_format(log.notes)
            - else
              &nbsp;
          %td.meta
            %span.time= log.created_at
            by #{log.updater_name}

= footer do
  - if @order.run?(:bill)
    = link_to('Bill', path(:bill, :order_process, :id => @order), :class => 'button')

  - if @order.run?(:pack)
    = form_for(@order, :url => path(:pack, :order_process, :id => @order)) do
      %button Pack

  - if @order.run?(:ship)
    = form_for(@order, :url => path(:ship, :order_process, :id => @order)) do
      %button Ship

  - if @order.editable?
    = edit_button(@order)

  - if @order.run?(:bill)
    = link_to('Edit Payment', path(:payment, @order), :class => 'button edit')

  - if @order.run?(:cancel)
    = link_to('Cancel', path(:cancel, :order_process, :id => @order), :title => 'Cancel Order', :class => 'button delete')
<commit_msg>Remove editable payments and orders for now.<commit_after>- prefixed_sub_header('Order', "#{@order.name}")

#summary
  = process_progression(@order)

= content do

  %div.panel
    %div.order-overview
      %ul
        %li
          %span.key Reference #
          %span.value.reference= @order.reference
        %li
          %span.key Placed
          %span.value= @order.logs.first.created_at.to_s(:pretty)
        %li
          %span.key Status
          %span.value= @order.status.humanize
        %li
          %span.key Total
          %span.value= "#{@order.sku_total_quantity} Item#{@order.sku_total_quantity > 1 ? 's' : ''},"
          %strong.value= @order.formatted_total
        - unless @order.credit_card_payment.blank?
          - if @order.credit_card_payment.authorization_expiry_warning?
            %li
              %span.key Authorization
              - if @order.credit_card_payment.authorization_expired?
                %span.value.indicator.warning Expired!
              - else
                %span.value.indicator.warning Expires Soon!

    %div.billing
      %h3 Billing Details

      %p.card-details
        %span.type{:class => "card-type-#{@order.credit_card_payment.card_type}"}= @order.credit_card_payment.card_type
        %span.number= @order.credit_card_payment.number
        %span.name= @order.credit_card_payment.full_name
        %span.expiry Expiry: #{@order.credit_card_payment.expiry}

    %div.address
      %h3 Billing Address

      %p
        %span.name
          %strong= @order.name
          - if @order.billing_company
            , 
            %span.company #{@order.billing_company}  
        %br/
        %span.street= @order.billing_street
        %br/
        %span.city= @order.billing_city
        %br/
        %span.state #{@order.billing_state} #{@order.billing_postcode}

    %div.address
      %h3 Shipping Address

      %p
        %span.name
          %strong= @order.ship_to
          - if @order.shipping_company
            ,
            %span.company #{@order.shipping_company}  
        %br/
        %span.street= @order.shipping_street
        %br/
        %span.city= @order.shipping_city
        %br/
        %span.state #{@order.shipping_state} #{@order.shipping_postcode}  

  %h3.items.inset Order Items
  %table.items.inset
    %thead
      %tr
        %th Product/SKU
        %th Quantity
        %th.currency Price
        %th.currency Total
        %th.currency Discount

    %tbody
      - @order.items.summary.each do |item|
        %tr
          %td
            = link_to(item.sku_name, path(:product, :id => item.product_id), :class => 'title')
          %td
            %span.numeric= item.quantity
          %td.currency
            %span.numeric= item.formatted_price
          %td.currency
            %span.numeric= item.formatted_total
          %td.currency
            - if item.discounted?
              %span.numeric.discount #{item.formatted_discount} discount
            - else
              &nbsp;

    %tfoot
      %tr
        %th(colspan=3)
          Product Total
        %td.currency
          %span.numeric= @order.formatted_product_total
        %td.currency
          - if @order.discounted_total?
            %span.numeric.discount #{@order.formatted_product_discount} discount
          - else
            &nbsp;

      %tr
        %th(colspan=3)
          Shipping
        %td.currency
          - if @order.free_shipping?
            FREE
          - else
            %span.numeric= @order.formatted_shipping_total
        %td
          &nbsp;

      %tr.total
        %th(colspan=3)
          Total
        %td.currency
          %span.numeric= @order.formatted_total
        %td
          &nbsp;

  %h3.inset Tracking
  %div.tracking.inset.collapsible{:class => @order.tracking_reference.blank? ? 'expanded' : 'collapsed'}
    - if @order.trackable?
      - unless @order.tracking_reference.blank?
        %p#displayTrackingReference.summary
          Tracking reference:
          %strong #{@order.tracking_reference}
          %a.collapsible-expander{:href => '#editTrackingReference'} Change
        
          = link_to('Track order&hellip;'.html_safe, @order.track_shipment, :class => 'track-order')

      #editTrackingReference.details
        = simple_form_for(@order, :url => :update_admin_order_process) do |f|
          = f.input(:tracking_reference)
          %button{:type => 'submit'} Save

    - else
      %p#displayTrackingReference.note This order will be trackable once it has been packed.

  %h3#order-activity-log.logs.inset Logs
  %table.logs.inset
    %thead
      %tr
        %th.boolean Succeeded?
        %th Action
        %th.notes Notes
        %th.meta On

    %tbody
      - @order.logs.summary.each do |log|
        %tr
          %td.boolean
            %span(class="boolean #{log.succeeded?}")
              %span= friendly_bool(log.succeeded?)
          %td
            %span.title= past_tense(log.action)
          %td
            - if log.notes?
              = simple_format(log.notes)
            - else
              &nbsp;
          %td.meta
            %span.time= log.created_at
            by #{log.updater_name}

= footer do
  - if @order.run?(:bill)
    = link_to('Bill', path(:bill, :order_process, :id => @order), :class => 'button')

  - if @order.run?(:pack)
    = form_for(@order, :url => path(:pack, :order_process, :id => @order)) do
      %button Pack

  - if @order.run?(:ship)
    = form_for(@order, :url => path(:ship, :order_process, :id => @order)) do
      %button Ship

  - if @order.run?(:cancel)
    = link_to('Cancel', path(:cancel, :order_process, :id => @order), :title => 'Cancel Order', :class => 'button delete')

{'fraction_non_alphanumeric': 0.12493488452856398, 'fraction_numerical': 0.0017364125716270186, 'mean_word_length': 1.8876911506643268, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2395025', 'n_tokens_mistral': 3724, 'n_tokens_neox': 3596, 'n_words': 654}