move to evented mustache system
This commit is contained in:
@@ -71,10 +71,8 @@ class SupplierController < ApplicationController
|
||||
h[:lists] = []
|
||||
grand_total = 0.0
|
||||
for list in @supplier.active_lists(section_id: params[:section_id].presence)
|
||||
hl = list.as_json
|
||||
hl[:total_amount] = list.orders.inject(0.0){|sum, o| sum + o.product_orders.inject(0.0){|s, po| s + (po.amount * po.price).round(2)}}.round(2)
|
||||
hl = list.with_info_as_json
|
||||
grand_total += hl[:total_amount]
|
||||
hl[:section_title] = list.table.section.try(:title)
|
||||
h[:lists] << hl
|
||||
end
|
||||
h[:total_amount] = grand_total.round(2)
|
||||
@@ -87,17 +85,13 @@ class SupplierController < ApplicationController
|
||||
def close_list
|
||||
@list = List.find_by_supplier_id_and_id(current_supplier.id, params[:list_id])
|
||||
@list.close!
|
||||
for user_id in @list.user_ids
|
||||
broadcast_user user_id, 'list_closed', @list
|
||||
end
|
||||
render nothing: true
|
||||
end
|
||||
|
||||
# POST /orders/1/is_helped
|
||||
def mark_list_as_helped
|
||||
@list = List.find_by_supplier_id_and_id(current_supplier.id, params[:list_id])
|
||||
@list.needs_help = false
|
||||
@list.save
|
||||
@list.is_helped!
|
||||
render nothing: true
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user