Files
openfoodnetwork/app/views/spree/orders/_line_item.html.haml
2025-07-17 14:17:57 +02:00

39 lines
1.5 KiB
Plaintext

- variant = line_item.variant
= order_form.fields_for :line_items, line_item do |item_form|
%tr.line-item{class: "variant-#{variant.id}"}
%td.cart-item-description
.item-thumb-image
= render 'spree/shared/variant_thumbnail', variant: variant
= render 'spree/shared/line_item_name', line_item: line_item
- if @insufficient_stock_lines&.include? line_item
%span.out-of-stock
= variant.in_stock? ? t(".insufficient_stock", :on_hand => variant.on_hand) : t(".out_of_stock")
%br/
- if @unavailable_order_variants&.include? line_item.variant
%span.out-of-stock
= t(".unavailable_item")
%br/
%td.cart-item-price
= line_item.single_display_amount_with_adjustments.to_html
%br
%span.unit-price
= format_unit_price(line_item.unit_price)
%td.text-center.cart-item-quantity
- finalized_quantity = @order.completed? ? line_item.quantity : 0
= item_form.number_field :quantity,
:min => 0, "ofn-on-hand" => "#{variant.on_demand && 9999 || variant.on_hand}",
"finalizedquantity" => finalized_quantity, :class => "line_item_quantity", :size => 5,
"ng-model" => "line_item_#{line_item.id}",
"validate-stock-quantity" => true
%td.cart-item-total.text-right
= line_item.display_amount_with_adjustments.to_html unless line_item.quantity.nil?
%td.cart-item-delete.text-center
%a.delete{href: "#", id: "delete_#{dom_id(line_item)}"}
%i.delete.ofn-i_026-trash