From 78f736db454adef347dd2d3dbc80439af32a51b1 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Fri, 15 May 2020 09:55:12 +0200 Subject: [PATCH] Add red border on quantity field when it must be updated --- app/assets/stylesheets/darkswarm/shopping-cart.css.scss | 4 ++++ app/views/spree/orders/_line_item.html.haml | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/darkswarm/shopping-cart.css.scss b/app/assets/stylesheets/darkswarm/shopping-cart.css.scss index bd4a5019c8..3423102b72 100644 --- a/app/assets/stylesheets/darkswarm/shopping-cart.css.scss +++ b/app/assets/stylesheets/darkswarm/shopping-cart.css.scss @@ -102,6 +102,10 @@ float: right; } } + + input.warning { + border: 1px solid $clr-brick; + } } .item-thumb-image { diff --git a/app/views/spree/orders/_line_item.html.haml b/app/views/spree/orders/_line_item.html.haml index cfd4d4a500..5aab298b51 100644 --- a/app/views/spree/orders/_line_item.html.haml +++ b/app/views/spree/orders/_line_item.html.haml @@ -23,7 +23,11 @@ = line_item.single_display_amount_with_adjustments.to_html %td.text-center.cart-item-quantity{"data-hook" => "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, "ng-model" => "line_item_#{line_item.id}", :class => "line_item_quantity", :size => 5 + = 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}", + "ng-class" => "{ warning: #{@insufficient_stock_lines.andand.include? line_item} }" %td.cart-item-total.text-right{"data-hook" => "cart_item_total"} = line_item.display_amount_with_adjustments.to_html unless line_item.quantity.nil?