Skip to content

Commit

Permalink
showing information
Browse files Browse the repository at this point in the history
  • Loading branch information
lokisk1155 committed Jul 3, 2023
1 parent b574422 commit fa83470
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
10 changes: 9 additions & 1 deletion app/controllers/distributions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,15 @@ def create
end

def confirmation
binding.pry
@storage_location_name = StorageLocation.find(params[:distribution][:storage_location_id]).name
@total_items_requested = 0
@items = {}
params[:distribution][:line_items_attributes].values.each_with_index do |line_item, index|
item = Item.find(line_item["item_id"])
@total_items_requested += line_item["quantity"].to_i
@items[index] = {name: item.name, quantity: line_item["quantity"]}
end

render :confirmation
end

Expand Down
21 changes: 19 additions & 2 deletions app/views/distributions/confirmation.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
<section style="height:100vh;width:100vw;backgroundColor:red;z-index:50">
YOOOOOO
<section class="d-flex flex-column align-items-center py-4">
<div class="card shadow-sm mx-auto" style="width: 50rem;">
<div class="card-body">
<h1 class="text-center">Request Summary</h1>
<hr>
<% @items.each do |index, item_info| %>
<p class="card-text">
<strong><%= item_info[:name] %></strong> for <%= item_info[:quantity] %>
</p>
<hr>
<% end %>
<h3 class="text-start"><strong> You are ordering a total of <%= @total_items_requested %> items. Are you sure?</strong></h3>
<hr>
<h3 class="card-subtitle mb-4 text-start">Please confirm that the above list is what you meant to request</h3>
<div class="d-flex justify-content-between align-items-center">
<%= link_to 'Go back', 'javascript:history.back()', rel: 'nofollow', class: "btn btn-danger btn-lg" %>
</div>
</div>
</div>
</section>

0 comments on commit fa83470

Please sign in to comment.