appirits/comable

View on GitHub
frontend/app/views/comable/orders/confirm.slim

Summary

Maintainability
Test Coverage
#comable-order
  h1
    = @order.class.human_state_name(:confirm)

  section.col-sm-8
    .row
      .col-sm-4.comable-bill_address
        h2
          = @order.class.human_attribute_name(:bill_address)
        .comable-email
          = @order.email
        = render 'comable/shared/address', address: @order.bill_address

      .col-sm-4.comable-ship_address
        h2
          = @order.class.human_attribute_name(:ship_address)
        = render 'comable/shared/address', address: @order.ship_address

      - if @order.payment
        .col-sm-4.comable-payment_method
          h2
            = @order.class.human_attribute_name(:payment_method)
          = @order.payment.name

    - if @order.shipments.any?
      .row
        .col-sm-12.comable-shipment
          h2
            = @order.class.human_attribute_name(:shipment_method)
          - @order.shipments.each.with_index(1) do |shipment, index|
            p
              | ##{index} #{shipment.name}

    .row
      .col-sm-12.comable-order_items
        table
          thead
            tr
              th
              th
                = @order.order_items.human_attribute_name(:price)
              th
                = @order.order_items.human_attribute_name(:quantity)

          tbody
            - @order.order_items.each do |order_item|
              tr
                td
                  .name
                    = order_item.name_with_sku
                  .caption
                    = order_item.product.caption
                td.price
                  = number_to_currency order_item.price
                td.quantity
                  = number_with_delimiter order_item.quantity

  aside.col-sm-4
    table
      thead
        tr
          th colspan="2"
            = form_for @order, as: :order, url: comable.order_path, method: :post do |f|
              = f.submit Comable.t('complete_order')
      tbody
        tr
          th.text-right
            = @order.class.human_attribute_name(:item_total_price)
          td
            = number_to_currency @order.current_item_total_price
        tr
          th.text-right
            = @order.class.human_attribute_name(:payment_fee)
          td
            = number_to_currency @order.current_payment_fee
        tr
          th.text-right
            = @order.class.human_attribute_name(:shipment_fee)
          td
            = number_to_currency @order.current_shipment_fee
        tr
          th.text-right
            = @order.class.human_attribute_name(:total_price)
          td
            = number_to_currency @order.current_total_price