-
-
Save shankardevy/1e2859dde71c3c05135172fa5b772684 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Cart</h1> | |
<%= if Enum.empty?(@cart.line_items) do %> | |
<p>Your cart is empty</p> | |
<% else %> | |
<%= form_for @cart_changeset, "/cart", fn f -> %> | |
<table class="table"> | |
<thead> | |
<tr> | |
<th>Product name</th> | |
<th>Pack size</th> | |
<th>Quantity</th> | |
<th>Unit price</th> | |
<th>Subtotal</th> | |
<td>Remove?</td> | |
</tr> | |
</thead> | |
<tbody> | |
<%= inputs_for f, :line_items, fn lf -> %> | |
<tr> | |
<td><%= lf.data.product_name %></td> | |
<td><%= lf.data.pack_size %></td> | |
<td> | |
<%= hidden_input lf, :product_id %> | |
<%= number_input lf, :quantity %> | |
<%= error_tag lf, :quantity %> | |
</td> | |
<td>₹ <%= lf.data.unit_price %></td> | |
<td>₹ <%= lf.data.total %></td> | |
<td><%= checkbox lf, :delete %></td> | |
</tr> | |
<% end %> | |
<tr> | |
<td colspan=4>Total</td> | |
<td>₹ <%= @cart.total %></td> | |
<td></td> | |
</tr> | |
</tbody> | |
</table> | |
<div class="form-group"> | |
<%= submit "Update Cart", class: "btn btn-primary" %> | |
</div> | |
<!-- Add the line below --> | |
<%= link "Checkout", to: checkout_path(@conn, :edit), class: "btn btn-primary pull-right " %> | |
<% end %> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment